1 /*******************************************************************************
2  *  Copyright (c) 2005, 2019 IBM Corporation and others.
3  *
4  *  This program and the accompanying materials
5  *  are made available under the terms of the Eclipse Public License 2.0
6  *  which accompanies this distribution, and is available at
7  *  https://www.eclipse.org/legal/epl-2.0/
8  *
9  *  SPDX-License-Identifier: EPL-2.0
10  *
11  *  Contributors:
12  *     IBM Corporation - initial API and implementation
13  *******************************************************************************/
14 package org.eclipse.pde.internal.ui.correction;
15 
16 import org.eclipse.core.resources.IMarker;
17 import org.eclipse.core.runtime.CoreException;
18 import org.eclipse.pde.core.IBaseModel;
19 import org.eclipse.pde.internal.core.builders.PDEMarkerFactory;
20 import org.eclipse.pde.internal.core.text.build.Build;
21 import org.eclipse.pde.internal.core.text.build.BuildModel;
22 
23 public abstract class BuildEntryMarkerResolution extends AbstractPDEMarkerResolution {
24 
25 	protected String fEntry;
26 	protected String fToken;
27 
BuildEntryMarkerResolution(int type, IMarker marker)28 	public BuildEntryMarkerResolution(int type, IMarker marker) {
29 		super(type, marker);
30 		try {
31 			fEntry = (String) marker.getAttribute(PDEMarkerFactory.BK_BUILD_ENTRY);
32 			fToken = (String) marker.getAttribute(PDEMarkerFactory.BK_BUILD_TOKEN);
33 		} catch (CoreException e) {
34 		}
35 	}
36 
createChange(Build build)37 	protected abstract void createChange(Build build);
38 
39 	@Override
createChange(IBaseModel model)40 	protected void createChange(IBaseModel model) {
41 		if (model instanceof BuildModel)
42 			createChange((Build) ((BuildModel) model).getBuild());
43 	}
44 }
45