Java 类org.eclipse.ui.texteditor.AnnotationPreferenceLookup 实例源码

项目:APICloud-Studio    文件:ProblemAnnotation.java   
private static int computeLayer(String annotationType, AnnotationPreferenceLookup lookup)
{
    Annotation annotation = new Annotation(annotationType, false, null);
    AnnotationPreference preference = lookup.getAnnotationPreference(annotation);
    if (preference != null)
    {
        return preference.getPresentationLayer() + 1;
    }
    else
    {
        return IAnnotationAccessExtension.DEFAULT_LAYER + 1;
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:CompilationUnitDocumentProvider.java   
private static int computeLayer(String annotationType, AnnotationPreferenceLookup lookup) {
    Annotation annotation= new Annotation(annotationType, false, null);
    AnnotationPreference preference= lookup.getAnnotationPreference(annotation);
    if (preference != null)
        return preference.getPresentationLayer() + 1;
    else
        return IAnnotationAccessExtension.DEFAULT_LAYER + 1;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:CompilationUnitDocumentProvider.java   
private static int computeLayer(String annotationType, AnnotationPreferenceLookup lookup) {
    Annotation annotation= new Annotation(annotationType, false, null);
    AnnotationPreference preference= lookup.getAnnotationPreference(annotation);
    if (preference != null)
        return preference.getPresentationLayer() + 1;
    else
        return IAnnotationAccessExtension.DEFAULT_LAYER + 1;
}
项目:brainfuck    文件:BfSourceViewerConfiguration.java   
@Override
public Object getHoverInfo2(ITextViewer textViewer, IRegion hoverRegion) {
    IAnnotationModel model = sourceViewer.getAnnotationModel();
    @SuppressWarnings("unchecked")
    Iterator<Annotation> i = model.getAnnotationIterator();
    Annotation provideText = null;
    AnnotationPreferenceLookup preferenceLookup = EditorsUI.getAnnotationPreferenceLookup();
    int annotationLayer = -1;
    while (i.hasNext()) {
        Annotation ann = i.next();

        Position p = model.getPosition(ann);
        if (p == null || !p.overlapsWith(hoverRegion.getOffset(), hoverRegion.getLength())) {
            continue;
        }
        if (UNCHANGED_QUICKDIFF_ANNOTATION.equals(ann.getType())) {
            continue; //Ignore unchanged line notification
        }
        if (provideText == null) {
            provideText = ann;
        }
        AnnotationPreference preference = preferenceLookup.getAnnotationPreference(ann);
        if (preference != null && preference.getPresentationLayer() > annotationLayer) {
            provideText = ann;
            annotationLayer = preference.getPresentationLayer();
        }
    }
    String text = null;
    if (provideText != null) {
        if (this.hoverContributions.containsKey(provideText.getType())) {
            text = this.hoverContributions.get(provideText.getType()).getHoverText(provideText, textViewer, hoverRegion);
        }
        else {
            text = "<b>" +  provideText.getText() + "</b>";
        }
    }
    try {
        if (text == null) {
            IDocument document = textViewer.getDocument();
            if (document instanceof IDocumentExtension3) {
                IDocumentExtension3 ext3 = (IDocumentExtension3) document;
                ITypedRegion partition = ext3.getPartition(EditorConstants.BF_PARTITIONING, hoverRegion.getOffset(), false);
                if (EditorConstants.PARTITION_TYPE_BRAINFUCK_CODE.equals(partition.getType())) {
                    text = "Offset: [<b>" + hoverRegion.getOffset() + "</b>]";
                }
            }
        }
    }
    catch (BadLocationException | BadPartitioningException ex) {
        BfActivator.getDefault().logError("hoverRegion partitioning could not be evaluated", ex);
    }
    return text;
}