Java Code Examples for org.eclipse.ui.texteditor.MarkerAnnotation#isQuickFixableStateSet()

The following examples show how to use org.eclipse.ui.texteditor.MarkerAnnotation#isQuickFixableStateSet() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XtextQuickAssistProcessor.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public boolean canFix(Annotation annotation) {
	if (annotation.isMarkedDeleted())
		return false;

	// non-persisted annotation
	if (annotation instanceof XtextAnnotation) {
		XtextAnnotation a = (XtextAnnotation) annotation;
		return getResolutionProvider().hasResolutionFor(a.getIssueCode());
	}

	// persisted markerAnnotation
	if (annotation instanceof MarkerAnnotation) {
		MarkerAnnotation markerAnnotation = (MarkerAnnotation) annotation;
		if (!markerAnnotation.isQuickFixableStateSet())
			markerAnnotation.setQuickFixable(getResolutionProvider().hasResolutionFor(
					issueUtil.getCode(markerAnnotation)));
		return markerAnnotation.isQuickFixable();
	}

	if (annotation instanceof SpellingAnnotation) {
		return true;
	}

	return false;
}
 
Example 2
Source File: XtextMarkerAnnotationImageProvider.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
private Map<String, Image> getImages(Annotation annotation) {
	if(annotation.isMarkedDeleted())
		return XtextPluginImages.getAnnotationImagesDeleted();
	else {
		if (annotation instanceof MarkerAnnotation) {
			MarkerAnnotation ma = (MarkerAnnotation) annotation;
			if(ma.isQuickFixableStateSet() && ma.isQuickFixable())
				return XtextPluginImages.getAnnotationImagesFixable();
		}
		return XtextPluginImages.getAnnotationImagesNonfixable();
	}
}
 
Example 3
Source File: JsonQuickAssistProcessor.java    From KaiZen-OpenAPI-Editor with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public boolean canFix(Annotation annotation) {
    if (annotation.isMarkedDeleted()) {
        return false;
    }
    if (annotation instanceof MarkerAnnotation) {
        MarkerAnnotation markerAnnotation = (MarkerAnnotation) annotation;
        if (!markerAnnotation.isQuickFixableStateSet()) {
            markerAnnotation.setQuickFixable(
                    generators.stream().anyMatch(e -> e.hasResolutions(markerAnnotation.getMarker())));
        }
        return markerAnnotation.isQuickFixable();
    }
    return false;
}