Java 类org.eclipse.jface.text.IInformationControlExtension2 实例源码

项目:Eclipse-Postfix-Code-Completion    文件:JavaExpandHover.java   
@Override
protected Object getHoverInfoForLine(final ISourceViewer viewer, final int line) {
    final boolean showTemporaryProblems= PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_CORRECTION_INDICATION);
    IAnnotationModel model= viewer.getAnnotationModel();
    IDocument document= viewer.getDocument();

    if (model == null)
        return null;

    List<Annotation> exact= new ArrayList<Annotation>();
    HashMap<Position, Object> messagesAtPosition= new HashMap<Position, Object>();

    Iterator<Annotation> e= model.getAnnotationIterator();
    while (e.hasNext()) {
        Annotation annotation= e.next();

        if (fAnnotationAccess instanceof IAnnotationAccessExtension)
            if (!((IAnnotationAccessExtension)fAnnotationAccess).isPaintable(annotation))
                continue;

        if (annotation instanceof IJavaAnnotation && !isIncluded((IJavaAnnotation)annotation, showTemporaryProblems))
            continue;

        AnnotationPreference pref= fLookup.getAnnotationPreference(annotation);
        if (pref != null) {
            String key= pref.getVerticalRulerPreferenceKey();
            if (key != null && !fStore.getBoolean(key))
                continue;
        }

        Position position= model.getPosition(annotation);
        if (position == null)
            continue;

        if (compareRulerLine(position, document, line) == 1) {

            if (isDuplicateMessage(messagesAtPosition, position, annotation.getText()))
                continue;

            exact.add(annotation);
        }
    }

    sort(exact, model);

    if (exact.size() > 0)
        setLastRulerMouseLocation(viewer, line);

    if (exact.size() > 0) {
        Annotation first= exact.get(0);
        if (!isBreakpointAnnotation(first))
            exact.add(0, new NoBreakpointAnnotation());
    }

    if (exact.size() <= 1)
        return null;

    AnnotationHoverInput input= new AnnotationHoverInput();
    input.fAnnotations= exact.toArray(new Annotation[0]);
    input.fViewer= viewer;
    input.fRulerInfo= fCompositeRuler;
    input.fAnnotationListener= fgListener;
    input.fDoubleClickListener= fDblClickListener;
    input.redoAction= new AnnotationExpansionControl.ICallback() {

        public void run(IInformationControlExtension2 control) {
            control.setInput(getHoverInfoForLine(viewer, line));
        }

    };
    input.model= model;

    return input;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:JavaExpandHover.java   
@Override
protected Object getHoverInfoForLine(final ISourceViewer viewer, final int line) {
    final boolean showTemporaryProblems= PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_CORRECTION_INDICATION);
    IAnnotationModel model= viewer.getAnnotationModel();
    IDocument document= viewer.getDocument();

    if (model == null)
        return null;

    List<Annotation> exact= new ArrayList<Annotation>();
    HashMap<Position, Object> messagesAtPosition= new HashMap<Position, Object>();

    Iterator<Annotation> e= model.getAnnotationIterator();
    while (e.hasNext()) {
        Annotation annotation= e.next();

        if (fAnnotationAccess instanceof IAnnotationAccessExtension)
            if (!((IAnnotationAccessExtension)fAnnotationAccess).isPaintable(annotation))
                continue;

        if (annotation instanceof IJavaAnnotation && !isIncluded((IJavaAnnotation)annotation, showTemporaryProblems))
            continue;

        AnnotationPreference pref= fLookup.getAnnotationPreference(annotation);
        if (pref != null) {
            String key= pref.getVerticalRulerPreferenceKey();
            if (key != null && !fStore.getBoolean(key))
                continue;
        }

        Position position= model.getPosition(annotation);
        if (position == null)
            continue;

        if (compareRulerLine(position, document, line) == 1) {

            if (isDuplicateMessage(messagesAtPosition, position, annotation.getText()))
                continue;

            exact.add(annotation);
        }
    }

    sort(exact, model);

    if (exact.size() > 0)
        setLastRulerMouseLocation(viewer, line);

    if (exact.size() > 0) {
        Annotation first= exact.get(0);
        if (!isBreakpointAnnotation(first))
            exact.add(0, new NoBreakpointAnnotation());
    }

    if (exact.size() <= 1)
        return null;

    AnnotationHoverInput input= new AnnotationHoverInput();
    input.fAnnotations= exact.toArray(new Annotation[0]);
    input.fViewer= viewer;
    input.fRulerInfo= fCompositeRuler;
    input.fAnnotationListener= fgListener;
    input.fDoubleClickListener= fDblClickListener;
    input.redoAction= new AnnotationExpansionControl.ICallback() {

        public void run(IInformationControlExtension2 control) {
            control.setInput(getHoverInfoForLine(viewer, line));
        }

    };
    input.model= model;

    return input;
}
项目:Eclipse-Postfix-Code-Completion    文件:AnnotationExpansionControl.java   
void run(IInformationControlExtension2 control);
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:AnnotationExpansionControl.java   
void run(IInformationControlExtension2 control);