1 11 package org.eclipse.pde.internal.ui.correction; 12 13 import org.eclipse.core.resources.IFile; 14 import org.eclipse.core.resources.IMarker; 15 import org.eclipse.core.resources.IResource; 16 import org.eclipse.core.runtime.CoreException; 17 import org.eclipse.core.runtime.IProgressMonitor; 18 import org.eclipse.pde.core.IBaseModel; 19 import org.eclipse.pde.internal.ui.util.ModelModification; 20 import org.eclipse.pde.internal.ui.util.PDEModelUtility; 21 import org.eclipse.swt.graphics.Image; 22 import org.eclipse.ui.IMarkerResolution2; 23 24 public abstract class AbstractPDEMarkerResolution implements IMarkerResolution2 { 25 26 public static final int CREATE_TYPE = 1; 27 public static final int RENAME_TYPE = 2; 28 public static final int REMOVE_TYPE = 3; 29 30 protected int fType; 31 35 protected IResource fResource; 36 37 public AbstractPDEMarkerResolution(int type) { 38 fType = type; 39 } 40 41 public Image getImage() { 42 return null; 43 } 44 45 public int getType() { 46 return fType; 47 } 48 49 public String getDescription() { 50 return getLabel(); 51 } 52 53 public void run(IMarker marker) { 54 fResource = marker.getResource(); 55 ModelModification modification = new ModelModification((IFile)marker.getResource()) { 56 protected void modifyModel(IBaseModel model, IProgressMonitor monitor) throws CoreException { 57 createChange(model); 58 } 59 }; 60 PDEModelUtility.modifyModel(modification, null); 61 } 62 63 protected abstract void createChange(IBaseModel model); 64 65 } 66 | Popular Tags |