Contributing marker resolution
Plug-ins can also define marker resolutions, so that their problem markers can
participate in the workbench Quick Fix feature. Users can select
a problem marker and choose a Quick Fix from a popup containing the list of supplied
fixes contributed for the marker.
Marker resolutions are contributed using the
org.eclipse.ui.ide.markerResolution
extension point. This extension point allows plug-ins to associate a class
that implements
IMarkerResolutionGenerator
with a particular type of marker. The marker can be qualified
by marker type only, or it can be further qualified by the value of one or more of its
attributes. The JDT contributes a marker resolution for Java problems:
<extension
point="org.eclipse.ui.ide.markerResolution">
<markerResolutionGenerator
markerType="org.eclipse.jdt.core.problem"
class="org.eclipse.jdt.internal.ui.text.correction.CorrectionMarkerResolutionGenerator">
</markerResolutionGenerator>
</extension>
The marker resolution generator is responsible for returning an array of
marker resolutions (
IMarkerResolution)
that will be shown in the Quick Fix popup. The resolution will
be run() if the user selects one of the fixes.
The Problems view supports resolving multiple problems at once. The user can
add other matching problems to the list of problems to fix, and then apply all
fixes in one go. To support multiple resolutions, your implementation of
IMarkerResolution
must be a subclass of
WorkbenchMarkerResolution.