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

下面列出了怎么用org.eclipse.jface.text.IInformationControlExtension2的API类实例代码及写法,或者点击链接到github查看源代码。

@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;
}
 
void run(IInformationControlExtension2 control); 
 类所在包
 同包方法