Java 类org.eclipse.xtext.ui.editor.validation.XtextAnnotation 实例源码

项目:bts    文件:XtextQuickAssistProcessor.java   
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;
}
项目:bts    文件:IssueUtil.java   
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;
}
项目:bts    文件:IssueUtil.java   
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;
}
项目:bts    文件:IssueUtil.java   
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;
}
项目:bts    文件:IssueUtil.java   
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;
}
项目:CooperateModelingEnvironment    文件:CooperateAnnotationModelListener.java   
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);
    }
}
项目:EASyProducer    文件:EmbeddedXtextSourceEditor.java   
@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);
}
项目:CooperateModelingEnvironment    文件:CooperateAnnotationModelListener.java   
@Override
public void modelChanged(IAnnotationModel model) {
    deleteAllXtextMarkers();
    Iterators.filter(model.getAnnotationIterator(), XtextAnnotation.class)
            .forEachRemaining(this::createXtextAnnotationMarker);
}