import org.eclipse.ui.texteditor.AnnotationPreferenceLookup;
/**
- *
- *
+ *
+ *
* @since 3.0
*/
public class JavaExpandHover extends AnnotationExpandHover {
/** Id of the no breakpoint fake annotation */
- public static final String NO_BREAKPOINT_ANNOTATION= "net.sourceforge.phpdt.internal.ui.NoBreakpointAnnotation"; //$NON-NLS-1$
+ public static final String NO_BREAKPOINT_ANNOTATION = "net.sourceforge.phpdt.internal.ui.NoBreakpointAnnotation"; //$NON-NLS-1$
- private static class NoBreakpointAnnotation extends Annotation implements IAnnotationPresentation {
+ private static class NoBreakpointAnnotation extends Annotation implements
+ IAnnotationPresentation {
public NoBreakpointAnnotation() {
- super(NO_BREAKPOINT_ANNOTATION, false, JavaHoverMessages.getString("NoBreakpointAnnotation.addBreakpoint"));
+ super(NO_BREAKPOINT_ANNOTATION, false, JavaHoverMessages
+ .getString("NoBreakpointAnnotation.addBreakpoint"));
}
/*
- * @see org.eclipse.jface.text.source.IAnnotationPresentation#paint(org.eclipse.swt.graphics.GC, org.eclipse.swt.widgets.Canvas, org.eclipse.swt.graphics.Rectangle)
+ * @see org.eclipse.jface.text.source.IAnnotationPresentation#paint(org.eclipse.swt.graphics.GC,
+ * org.eclipse.swt.widgets.Canvas,
+ * org.eclipse.swt.graphics.Rectangle)
*/
public void paint(GC gc, Canvas canvas, Rectangle bounds) {
- // draw affordance so the user know she can click here to get a breakpoint
- Image fImage= PHPUiImages.get(PHPUiImages.IMG_FIELD_PUBLIC);
+ // draw affordance so the user know she can click here to get a
+ // breakpoint
+ Image fImage = PHPUiImages.get(PHPUiImages.IMG_FIELD_PUBLIC);
ImageUtilities.drawImage(fImage, gc, canvas, bounds, SWT.CENTER);
}
}
}
- private AnnotationPreferenceLookup fLookup= new AnnotationPreferenceLookup();
- private IPreferenceStore fStore= PHPeclipsePlugin.getDefault().getCombinedPreferenceStore();
+ private AnnotationPreferenceLookup fLookup = new AnnotationPreferenceLookup();
+
+ private IPreferenceStore fStore = PHPeclipsePlugin.getDefault()
+ .getCombinedPreferenceStore();
- public JavaExpandHover(CompositeRuler ruler, IAnnotationAccess access, IDoubleClickListener doubleClickListener) {
+ public JavaExpandHover(CompositeRuler ruler, IAnnotationAccess access,
+ IDoubleClickListener doubleClickListener) {
super(ruler, access, doubleClickListener);
}
/*
- * @see org.eclipse.ui.internal.texteditor.AnnotationExpandHover#getHoverInfoForLine(org.eclipse.jface.text.source.ISourceViewer, int)
+ * @see org.eclipse.ui.internal.texteditor.AnnotationExpandHover#getHoverInfoForLine(org.eclipse.jface.text.source.ISourceViewer,
+ * int)
*/
- 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();
+ 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 exact= new ArrayList();
- HashMap messagesAtPosition= new HashMap();
+ List exact = new ArrayList();
+ HashMap messagesAtPosition = new HashMap();
- Iterator e= model.getAnnotationIterator();
+ Iterator e = model.getAnnotationIterator();
while (e.hasNext()) {
- Annotation annotation= (Annotation) e.next();
+ Annotation annotation = (Annotation) e.next();
if (fAnnotationAccess instanceof IAnnotationAccessExtension)
- if (!((IAnnotationAccessExtension)fAnnotationAccess).isPaintable(annotation))
+ if (!((IAnnotationAccessExtension) fAnnotationAccess)
+ .isPaintable(annotation))
continue;
-
- if (annotation instanceof IJavaAnnotation && !isIncluded((IJavaAnnotation)annotation, showTemporaryProblems))
+
+ if (annotation instanceof IJavaAnnotation
+ && !isIncluded((IJavaAnnotation) annotation,
+ showTemporaryProblems))
continue;
- AnnotationPreference pref= fLookup.getAnnotationPreference(annotation);
+ AnnotationPreference pref = fLookup
+ .getAnnotationPreference(annotation);
if (pref != null) {
- String key= pref.getVerticalRulerPreferenceKey();
+ String key = pref.getVerticalRulerPreferenceKey();
if (key != null && !fStore.getBoolean(key))
continue;
}
- Position position= model.getPosition(annotation);
+ Position position = model.getPosition(annotation);
if (position == null)
continue;
if (compareRulerLine(position, document, line) == 1) {
- if (isDuplicateMessage(messagesAtPosition, position, annotation.getText()))
+ if (isDuplicateMessage(messagesAtPosition, position, annotation
+ .getText()))
continue;
exact.add(annotation);
setLastRulerMouseLocation(viewer, line);
if (exact.size() > 0) {
- Annotation first= (Annotation) exact.get(0);
+ Annotation first = (Annotation) exact.get(0);
if (!isBreakpointAnnotation(first))
exact.add(0, new NoBreakpointAnnotation());
}
if (exact.size() <= 1)
return null;
- AnnotationHoverInput input= new AnnotationHoverInput();
- input.fAnnotations= (Annotation[]) exact.toArray(new Annotation[0]);
- input.fViewer= viewer;
- input.fRulerInfo= fCompositeRuler;
- input.fAnnotationListener= fgListener;
- input.fDoubleClickListener= fDblClickListener;
- input.redoAction= new AnnotationExpansionControl.ICallback() {
+ AnnotationHoverInput input = new AnnotationHoverInput();
+ input.fAnnotations = (Annotation[]) 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;
+ input.model = model;
return input;
}
- private boolean isIncluded(IJavaAnnotation annotation, boolean showTemporaryProblems) {
-
+ private boolean isIncluded(IJavaAnnotation annotation,
+ boolean showTemporaryProblems) {
+
// XXX: see https://bugs.eclipse.org/bugs/show_bug.cgi?id=138601
- if (annotation instanceof ProblemAnnotation && JavaMarkerAnnotation.TASK_ANNOTATION_TYPE.equals(annotation.getType()))
+ if (annotation instanceof ProblemAnnotation
+ && JavaMarkerAnnotation.TASK_ANNOTATION_TYPE.equals(annotation
+ .getType()))
return false;
-
+
if (!annotation.isProblem())
return true;
-
+
if (annotation.isMarkedDeleted() && !annotation.hasOverlay())
return true;
-
+
if (annotation.hasOverlay() && !annotation.isMarkedDeleted())
return true;
-
-
+
if (annotation.hasOverlay())
return (!isIncluded(annotation.getOverlay(), showTemporaryProblems));
-
- return showTemporaryProblems; //&& JavaCorrectionProcessor.hasCorrections((Annotation)annotation);
+
+ return showTemporaryProblems; // &&
+ // JavaCorrectionProcessor.hasCorrections((Annotation)annotation);
}
/*
* @see org.eclipse.ui.internal.texteditor.AnnotationExpandHover#getOrder(org.eclipse.jface.text.source.Annotation)
*/
protected int getOrder(Annotation annotation) {
- if (isBreakpointAnnotation(annotation))
+ if (isBreakpointAnnotation(annotation))
return 1000;
else
return super.getOrder(annotation);
private boolean isBreakpointAnnotation(Annotation a) {
if (a instanceof JavaMarkerAnnotation) {
- JavaMarkerAnnotation jma= (JavaMarkerAnnotation) a;
+ JavaMarkerAnnotation jma = (JavaMarkerAnnotation) a;
// HACK to get breakpoints to show up first
return jma.getType().equals("org.eclipse.debug.core.breakpoint"); //$NON-NLS-1$
}