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; }
public Issue getIssueFromAnnotation(Annotation annotation) { if (annotation instanceof XtextAnnotation) { XtextAnnotation xtextAnnotation = (XtextAnnotation) annotation; return xtextAnnotation.getIssue(); } else if(annotation instanceof MarkerAnnotation) { MarkerAnnotation markerAnnotation = (MarkerAnnotation)annotation; return createIssue(markerAnnotation.getMarker()); } else return null; }
public String getCode(Annotation annotation) { if (annotation instanceof MarkerAnnotation) { MarkerAnnotation ma = (MarkerAnnotation) annotation; return getCode(ma.getMarker()); } if (annotation instanceof XtextAnnotation) { XtextAnnotation xa = (XtextAnnotation) annotation; return xa.getIssueCode(); } return null; }
public String[] getIssueData(Annotation annotation) { if (annotation instanceof MarkerAnnotation) { MarkerAnnotation ma = (MarkerAnnotation) annotation; return getIssueData(ma.getMarker()); } if (annotation instanceof XtextAnnotation) { XtextAnnotation xa = (XtextAnnotation) annotation; return xa.getIssueData(); } return null; }
public URI getUriToProblem(Annotation annotation) { if (annotation instanceof MarkerAnnotation) { MarkerAnnotation ma = (MarkerAnnotation) annotation; return getUriToProblem(ma.getMarker()); } if (annotation instanceof XtextAnnotation) { XtextAnnotation xa = (XtextAnnotation) annotation; return xa.getUriToProblem(); } return null; }
private void createXtextAnnotationMarker(XtextAnnotation annotation) { Issue xtextIssue = annotation.getIssue(); String markerType = markerTypeProvider.getMarkerType(xtextIssue); try { markerCreator.createMarker(xtextIssue, associatedFile, markerType); } catch (CoreException e) { LOGGER.warn("Could not create marker on {}.", associatedFile, e); } }
@Override public void modelChanged(IAnnotationModel model) { boolean hasErrors = false; @SuppressWarnings("rawtypes") Iterator iter = model.getAnnotationIterator(); while (!hasErrors && null != iter && iter.hasNext()) { Object tmp = iter.next(); if (tmp instanceof XtextAnnotation) { XtextAnnotation annotation = (XtextAnnotation) tmp; hasErrors = (Severity.ERROR == annotation.getIssue().getSeverity()); } } listener.notifyValidationState(hasErrors); }
@Override public void modelChanged(IAnnotationModel model) { deleteAllXtextMarkers(); Iterators.filter(model.getAnnotationIterator(), XtextAnnotation.class) .forEachRemaining(this::createXtextAnnotationMarker); }