@Override protected Object getHoverInfoInternal(final ITextViewer textViewer, final int lineNumber, final int offset) { final Set<String> messages = Sets.newLinkedHashSet(); List<Annotation> annotations = getAnnotations(lineNumber, offset); for (Annotation annotation : annotations) { if (annotation.getText() != null) { messages.add(annotation.getText().trim()); } } if (messages.size()>0) return formatInfo(messages); return null; }
@Override protected void computeInformation() { if (fSelection != null) { Rectangle subjectArea= fSelection.canvas.getBounds(); Annotation annotation= fSelection.fAnnotation; String msg; if (annotation != null) msg= annotation.getText(); else msg= null; setInformation(msg, subjectArea); } }
private boolean includeAnnotation(Annotation annotation, Position position, HashMap<Position, Object> messagesAtPosition) { if (!isIncluded(annotation)) return false; String text= annotation.getText(); return (text != null && !isDuplicateAnnotation(messagesAtPosition, position, text)); }
protected void computeInformation() { if (fSelection != null) { Rectangle subjectArea= fSelection.canvas.getBounds(); Annotation annotation= fSelection.fAnnotation; String msg; if (annotation != null) msg= annotation.getText(); else msg= null; setInformation(msg, subjectArea); } }
private boolean includeAnnotation(Annotation annotation, Position position, HashMap<Position, Object> messagesAtPosition) { if (!isIncluded(annotation)) return false; String text= annotation.getText(); return (text != null && !isDuplicateAnnotation(messagesAtPosition, position, text)); }
@Override protected void computeInformation() { if (fSelection != null) { Rectangle subjectArea= fSelection.canvas.getBounds(); Annotation annotation= fSelection.fAnnotation; String msg; if (annotation != null) msg= annotation.getText(); else msg= null; setInformation(msg, subjectArea); } }
private void createAnnotationInformation(Composite parent, final Annotation annotation) { Composite composite= new Composite(parent, SWT.NONE); composite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); GridLayout layout= new GridLayout(2, false); layout.marginHeight= 2; layout.marginWidth= 2; layout.horizontalSpacing= 0; composite.setLayout(layout); final Canvas canvas= new Canvas(composite, SWT.NO_FOCUS); GridData gridData= new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false); gridData.widthHint= 17; gridData.heightHint= 16; canvas.setLayoutData(gridData); canvas.addPaintListener(new PaintListener() { public void paintControl(PaintEvent e) { e.gc.setFont(null); fMarkerAnnotationAccess.paint(annotation, e.gc, canvas, new Rectangle(0, 0, 16, 16)); } }); StyledText text= new StyledText(composite, SWT.MULTI | SWT.WRAP | SWT.READ_ONLY); GridData data= new GridData(SWT.FILL, SWT.FILL, true, true); text.setLayoutData(data); String annotationText= annotation.getText(); if (annotationText != null) text.setText(annotationText); }
private void createAnnotationInformation(Composite parent, final Annotation annotation) { Composite composite= new Composite(parent, SWT.NONE); composite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); GridLayout layout= new GridLayout(2, false); layout.marginHeight= 2; layout.marginWidth= 2; layout.horizontalSpacing= 0; composite.setLayout(layout); final Canvas canvas= new Canvas(composite, SWT.NO_FOCUS); GridData gridData= new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false); gridData.widthHint= 17; gridData.heightHint= 16; canvas.setLayoutData(gridData); canvas.addPaintListener(new PaintListener() { @Override public void paintControl(PaintEvent e) { e.gc.setFont(null); fMarkerAnnotationAccess.paint(annotation, e.gc, canvas, new Rectangle(0, 0, 16, 16)); } }); StyledText text= new StyledText(composite, SWT.MULTI | SWT.WRAP | SWT.READ_ONLY); GridData data= new GridData(SWT.FILL, SWT.FILL, true, true); text.setLayoutData(data); String annotationText= annotation.getText(); if (annotationText != null) text.setText(annotationText); }
private String getAnnotationModelHoverMessage(IAnnotationModel model, IRegion hoverRegion) { Iterator<Annotation> e = model.getAnnotationIterator(); while (e.hasNext()) { Annotation a = e.next(); if (a instanceof XMLProblemAnnotation) { Position p = model.getPosition(a); if (p.overlapsWith(hoverRegion.getOffset(), hoverRegion.getLength())) { String msg = a.getText(); if (msg != null && msg.trim().length() > 0) { return formatMessage(msg); } } } } return null; }
private void createAnnotationInformation(Composite parent, final Annotation annotation) { Composite composite= new Composite(parent, SWT.NONE); composite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); GridLayout layout= new GridLayout(2, false); layout.marginHeight= 2; layout.marginWidth= 2; layout.horizontalSpacing= 0; composite.setLayout(layout); final Canvas canvas= new Canvas(composite, SWT.NO_FOCUS); GridData gridData= new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false); gridData.widthHint= 17; gridData.heightHint= 16; canvas.setLayoutData(gridData); canvas.addPaintListener(new PaintListener() { @Override public void paintControl(PaintEvent e) { e.gc.setFont(null); fMarkerAnnotationAccess.paint(annotation, e.gc, canvas, new Rectangle(0, 0, 16, 16)); } }); StyledText text= new StyledText(composite, SWT.MULTI | SWT.WRAP | SWT.READ_ONLY); GridData data= new GridData(SWT.FILL, SWT.FILL, true, true); text.setLayoutData(data); String annotationText= annotation.getText(); if (annotationText != null) text.setText(annotationText); }
/** * {@inheritDoc} * * @deprecated As of 3.4, replaced by {@link ITextHoverExtension2#getHoverInfo2(ITextViewer, IRegion)} */ @Deprecated @Override public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) { IAnnotationModel model= getAnnotationModel(fSourceViewer); if (model == null) return null; Iterator<Annotation> e= model.getAnnotationIterator(); while (e.hasNext()) { Annotation a= e.next(); if (isIncluded(a)) { Position p= model.getPosition(a); if (p != null && p.overlapsWith(hoverRegion.getOffset(), hoverRegion.getLength())) { String msg= a.getText(); if (msg != null && msg.trim().length() > 0) return msg; } } } return null; }
/** * {@inheritDoc} * * @deprecated As of 3.4, replaced by {@link ITextHoverExtension2#getHoverInfo2(ITextViewer, IRegion)} */ @Deprecated @Override public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) { IAnnotationModel model= getAnnotationModel(fSourceViewer); if (model == null) return null; Iterator<Annotation> e= model.getAnnotationIterator(); while (e.hasNext()) { Annotation a= e.next(); if (isIncluded(a)) { Position p= model.getPosition(a); if (p != null && p.overlapsWith(hoverRegion.getOffset(), hoverRegion.getLength())) { String msg= a.getText(); if (msg != null && msg.trim().length() > 0) return msg; } } } return null; }
protected void updateStatusLine() { final ITextSelection selection = (ITextSelection) getSelectionProvider().getSelection(); final Annotation annotation = getAnnotation(selection.getOffset(), selection.getLength()); String message = null; if (annotation != null) { updateMarkerViews(annotation); if (isProblemMarkerAnnotation(annotation)) { message = annotation.getText(); } } setStatusLineMessage(message); }
protected void updateStatusLine() { ITextSelection selection= (ITextSelection) getSelectionProvider().getSelection(); Annotation annotation= getAnnotation(selection.getOffset(), selection.getLength()); String message= null; if (annotation != null) { updateMarkerViews(annotation); if (annotation instanceof IJavaAnnotation && ((IJavaAnnotation) annotation).isProblem() || isProblemMarkerAnnotation(annotation)) message= annotation.getText(); } setStatusLineErrorMessage(null); setStatusLineMessage(message); }
protected void updateStatusLine() { ITextSelection selection= (ITextSelection) getSelectionProvider().getSelection(); Annotation annotation= getAnnotation(selection.getOffset(), selection.getLength()); setStatusLineErrorMessage(null); setStatusLineMessage(null); if (annotation != null) { updateMarkerViews(annotation); if (annotation instanceof IJavaAnnotation && ((IJavaAnnotation) annotation).isProblem()) setStatusLineMessage(annotation.getText()); } }
protected void updateStatusLine() { ITextSelection selection= (ITextSelection) getSelectionProvider().getSelection(); Annotation annotation= getAnnotation(selection.getOffset(), selection.getLength()); String message= null; if (annotation != null) { updateMarkerViews(annotation); if (annotation instanceof IJavaAnnotation && ((IJavaAnnotation) annotation).isProblem() || isProblemMarkerAnnotation(annotation)) message= annotation.getText(); } setStatusLineErrorMessage(null); setStatusLineMessage(message); }
@Override protected Object getHoverInfoInternal(ITextViewer textViewer, final int lineNumber, final int offset) { AnnotationInfo result = recentAnnotationInfo; if (result != null) return result; List<Annotation> annotations = getAnnotations(lineNumber, offset); if (annotations != null) { for (Annotation annotation : annotations) { if (annotation.getText() != null) { Position position = getAnnotationModel().getPosition(annotation); final IQuickAssistInvocationContext invocationContext = new QuickAssistInvocationContext(sourceViewer, position.getOffset(), position.getLength(), true); CompletionProposalRunnable runnable = new CompletionProposalRunnable(invocationContext); // Note: the resolutions have to be retrieved from the UI thread, otherwise // workbench.getActiveWorkbenchWindow() will return null in LanguageSpecificURIEditorOpener and // cause an exception Display.getDefault().syncExec(runnable); result = new AnnotationInfo (annotation, position, sourceViewer, runnable.proposals); recentAnnotationInfo = result; return result; } } } return null; }
/** * Jumps to the next annotation according to the given direction. * * @param forward <code>true</code> if search direction is forward, <code>false</code> if backward * @return the selected annotation or <code>null</code> if none * @see #isNavigationTarget(Annotation) * @see #findAnnotation(int, int, boolean, Position) * @since 3.2 */ @Override public Annotation gotoAnnotation(boolean forward) { ITextSelection selection= (ITextSelection) getSelectionProvider().getSelection(); Position position= new Position(0, 0); Annotation annotation= findAnnotation(selection.getOffset(), selection.getLength(), forward, position); setStatusLineErrorMessage(null); setStatusLineMessage(null); if (annotation != null) { selectAndReveal(position.getOffset(), position.getLength()); setStatusLineMessage(annotation.getText()); } return annotation; }
/** * Jumps to the next annotation according to the given direction. * * @param forward <code>true</code> if search direction is forward, <code>false</code> if backward * @return the selected annotation or <code>null</code> if none * @see #isNavigationTarget(Annotation) * @see #findAnnotation(int, int, boolean, Position) * @since 3.2 */ @Override public Annotation gotoAnnotation(boolean forward) { ITextSelection selection= (ITextSelection) getSelectionProvider().getSelection(); Position position= new Position(0, 0); Annotation annotation= findAnnotation(selection.getOffset(), selection.getLength(), forward, position); setStatusLineErrorMessage(null); setStatusLineMessage(null); if (annotation != null) { selectAndReveal(position.getOffset(), position.getLength()); setStatusLineMessage(annotation.getText()); } return annotation; }
/** * Jumps to the next annotation according to the given direction. * * @param forward <code>true</code> if search direction is forward, <code>false</code> if backward * @return the selected annotation or <code>null</code> if none * @see #isNavigationTarget(Annotation) * @see #findAnnotation(int, int, boolean, Position) * @since 3.2 */ public Annotation gotoAnnotation(boolean forward) { ITextSelection selection= (ITextSelection) getSelectionProvider().getSelection(); Position position= new Position(0, 0); Annotation annotation= findAnnotation(selection.getOffset(), selection.getLength(), forward, position); setStatusLineErrorMessage(null); setStatusLineMessage(null); if (annotation != null) { selectAndReveal(position.getOffset(), position.getLength()); setStatusLineMessage(annotation.getText()); } return annotation; }