Package com.iizigo.quickfix
Class QuickFixAdapter
- java.lang.Object
- org.eclipse.ui.views.markers.WorkbenchMarkerResolution
- com.iizigo.quickfix.QuickFixAdapter
- All Implemented Interfaces:
IQuickFixer,org.eclipse.ui.IMarkerResolution,org.eclipse.ui.IMarkerResolution2
- Direct Known Subclasses:
CloseProjectQuickFixer,CreateModuleFolders,DeleteFile,DeleteProperty,DeleteRect,GotoProperty,RecoverModuleSettings,RenameResource
public abstract class QuickFixAdapter extends org.eclipse.ui.views.markers.WorkbenchMarkerResolution implements IQuickFixer
The quick-fixes adapter class to Eclipse. It handles resolution of quick-fixes that can be grouped with others that are similar to allow multi-selection.- Author:
- Christopher Mindus
Constructor Summary
Constructors Constructor Description QuickFixAdapter()
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleancanBeGrouped()Checks if this resolution can be grouped together with other ones.org.eclipse.core.resources.IMarker[]findOtherMarkers(org.eclipse.core.resources.IMarker[] markers)Iterate through the list of supplied markers.java.lang.StringgetDescription()Returns optional additional information about the resolution.org.eclipse.swt.graphics.ImagegetImage()Returns the image to be displayed in the list of resolutions.abstract java.lang.StringgetLabel()Returns a short label indicating what the resolution will do.org.eclipse.core.resources.IMarkergetMarker()Gets the marker if theisMarkerRequired()is true.booleanisMarkerRequired()Indicates if the label returned and also the description depends on the marker selected.abstract voidrun(org.eclipse.core.resources.IMarker marker)Runs this resolution.voidsetMarker(org.eclipse.core.resources.IMarker marker)Call to set the marker in a new instance of the quick-fixer.
Method Detail
getDescription
public java.lang.String getDescription()
Returns optional additional information about the resolution. The additional information will be presented to assist the user in deciding if the selected proposal is the desired choice.- Specified by:
getDescriptionin interfaceorg.eclipse.ui.IMarkerResolution2- Returns:
- the additional information or
null
getImage
public org.eclipse.swt.graphics.Image getImage()
Returns the image to be displayed in the list of resolutions. The image would typically be shown to the left of the display string.- Specified by:
getImagein interfaceorg.eclipse.ui.IMarkerResolution2- Returns:
- the image to be shown or
nullif no image is desired
getLabel
public abstract java.lang.String getLabel()
Returns a short label indicating what the resolution will do.- Specified by:
getLabelin interfaceorg.eclipse.ui.IMarkerResolution- Specified by:
getLabelin interfaceIQuickFixer- Returns:
- a short label for this resolution
isMarkerRequired
public boolean isMarkerRequired()
Indicates if the label returned and also the description depends on the marker selected. In case this method returns true, a new Quick-Fix of the same instance is created followed bysetMarker(marker). The implementation ofgetLabel()can therefore be redirected togetLabel(marker)instead.- Specified by:
isMarkerRequiredin interfaceIQuickFixer- Returns:
- false by default.
setMarker
public void setMarker(org.eclipse.core.resources.IMarker marker)
Call to set the marker in a new instance of the quick-fixer.- Specified by:
setMarkerin interfaceIQuickFixer- Parameters:
marker- The marker.
getMarker
public org.eclipse.core.resources.IMarker getMarker()
Gets the marker if theisMarkerRequired()is true.
run
public abstract void run(org.eclipse.core.resources.IMarker marker)
Runs this resolution.- Specified by:
runin interfaceorg.eclipse.ui.IMarkerResolution- Specified by:
runin interfaceIQuickFixer- Parameters:
marker- the marker to resolve
canBeGrouped
public boolean canBeGrouped()
Checks if this resolution can be grouped together with other ones. By default it can be grouped, but e.g. the "Go to Property" should not be grouped (you can't go to several places at once).- Returns:
- true by default, override to return false for e.g. the "Go to Property" quick-fixer.
findOtherMarkers
public org.eclipse.core.resources.IMarker[] findOtherMarkers(org.eclipse.core.resources.IMarker[] markers)
Iterate through the list of supplied markers. Return any that can also have the receiver applied to them.- Specified by:
findOtherMarkersin classorg.eclipse.ui.views.markers.WorkbenchMarkerResolution- Parameters:
markers- The array of markers.- Returns:
- IMarker[]