To support fixing multiple problems at the same time your quick fix has to implement org.eclipse.ui.views.markers.WorkbenchMarkerResolution
and must be registered using the extention point org.eclipse.ui.ide.markerResolution
. The following example is from the Eclipse plug-in eclipse-pmd:
<extension
point="org.eclipse.ui.ide.markerResolution">
<markerResolutionGenerator
class="ch.acanda.eclipse.pmd.java.resolution.PMDMarkerResolutionGenerator"
markerType="ch.acanda.eclipse.pmd.core.pmdMarker">
</markerResolutionGenerator>
</extension>
It is indeed a bit tricky to create a CompilationUnit
from an IMarker
and even trickier to find the offending ASTNode
. Have a look at the abstract class ASTQuickFix from eclipse-pmd. It creates a CompilationUnit
from an IMarker
and delegates finding the ASTNode
to its subclasses which can define their own node finding strategy, e.g. NodeWithinPositionNodeFinder.