Search in sources :

Example 1 with WorkbenchMarkerResolutionAdapter

use of org.eclipse.xtext.ui.editor.quickfix.WorkbenchMarkerResolutionAdapter in project xtext-eclipse by eclipse.

the class AbstractQuickfixTest method applyQuickfixOnMultipleMarkers.

protected void applyQuickfixOnMultipleMarkers(IMarker[] markers) {
    MarkerResolutionGenerator generator = getInjector().getInstance(MarkerResolutionGenerator.class);
    IMarker primaryMarker = markers[0];
    IMarkerResolution[] resolutions = generator.getResolutions(primaryMarker);
    Assert.assertEquals(1, resolutions.length);
    assertTrue(resolutions[0] instanceof WorkbenchMarkerResolutionAdapter);
    WorkbenchMarkerResolutionAdapter resolution = (WorkbenchMarkerResolutionAdapter) resolutions[0];
    List<IMarker> others = Lists.newArrayList(resolution.findOtherMarkers(markers));
    assertFalse(others.contains(primaryMarker));
    assertEquals(markers.length - 1, others.size());
    others.add(primaryMarker);
    resolution.run(others.toArray(new IMarker[others.size()]), new NullProgressMonitor());
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IMarkerResolution(org.eclipse.ui.IMarkerResolution) WorkbenchMarkerResolutionAdapter(org.eclipse.xtext.ui.editor.quickfix.WorkbenchMarkerResolutionAdapter) IMarker(org.eclipse.core.resources.IMarker) MarkerResolutionGenerator(org.eclipse.xtext.ui.editor.quickfix.MarkerResolutionGenerator)

Aggregations

IMarker (org.eclipse.core.resources.IMarker)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 IMarkerResolution (org.eclipse.ui.IMarkerResolution)1 MarkerResolutionGenerator (org.eclipse.xtext.ui.editor.quickfix.MarkerResolutionGenerator)1 WorkbenchMarkerResolutionAdapter (org.eclipse.xtext.ui.editor.quickfix.WorkbenchMarkerResolutionAdapter)1