/** Get tooltip text for the mouse position */ // TODO: does not work for asynchronous tooltip texts public String getToolTipText(MouseEvent e) { int line = (int) ((float) e.getY() / (float) lineHeight); if (annos.getNumberOfAnnotations(line) == 0) return null; if (isMouseOverCycleButton(e) && annos.getNumberOfAnnotations(line) > 1) { return java.text.MessageFormat.format(LocaleSupport.getString("cycling-glyph_tooltip"), // NOI18N new Object[] { new Integer(annos.getNumberOfAnnotations(line)) }); } else if (isMouseOverGlyph(e)) { return annos.getActiveAnnotation(line).getShortDescription(); } else return null; }
@Override public void run() { try { int line = Utilities.getLineOffset((BaseDocument) doc, currentPosition); int startOffset = Utilities.getRowStartFromLineOffset((BaseDocument) doc, line); int endOffset = Utilities.getRowEnd((BaseDocument) doc, startOffset); AnnotationDesc desc = annotations.getActiveAnnotation(line); if (desc == null) { return ; } Collection<BaseAnnotation> annos; if (COMBINED_TYPES.contains(desc.getAnnotationType())) { annos = findAnnotations(comp, startOffset, endOffset); } else { annos = Collections.singletonList(findAnnotation(comp, desc, startOffset, endOffset)); } for (BaseAnnotation a : annos) { if (a != null) { anno.set(a); point.set(comp.modelToView(startOffset).getLocation()); break; } } } catch (BadLocationException ex) { ex.printStackTrace(); } } });
@Override public void run() { int dot = comp.getCaret().getDot(); Annotations annotations = ((BaseDocument) document).getAnnotations(); Line line = NbEditorUtilities.getLine(document, dot, false); if (line == null) { return ; } int lineNumber = line.getLineNumber(); AnnotationDesc desc = annotations.getActiveAnnotation(lineNumber); values[0] = lineNumber; values[1] = desc; } });
/** Get tooltip text for the mouse position */ // TODO: does not work for asynchronous tooltip texts public String getToolTipText (MouseEvent e) { if (editorUI == null) return null; int line = getLineFromMouseEvent(e); if (annos.getNumberOfAnnotations(line) == 0) return null; if (isMouseOverCycleButton(e) && annos.getNumberOfAnnotations(line) > 1) { return java.text.MessageFormat.format ( LocaleSupport.getString ("cycling-glyph_tooltip"), //NOI18N new Object[] { new Integer (annos.getNumberOfAnnotations(line)) }); } else if (isMouseOverGlyph(e)) { return annos.getActiveAnnotation(line).getShortDescription(); } else return null; }
int line = getLineFromMouseEvent(e); int offset; if (annos.getActiveAnnotation(line) != null) offset = annos.getActiveAnnotation(line).getOffset(); else offset = Utilities.getRowStartFromLineOffset(doc, line);
int line = (int) ((float) e.getY() / (float) lineHeight); int offset; if (annos.getActiveAnnotation(line) != null) offset = annos.getActiveAnnotation(line).getOffset(); else offset = Utilities.getRowStartFromLineOffset(doc, line);
AnnotationDesc anno = annos.getActiveAnnotation(line);
AnnotationDesc anno = annos.getActiveAnnotation(line);
AnnotationDesc anno = doc.getAnnotations().getActiveAnnotation(mark); if (anno == null) return false;
AnnotationDesc anno = doc.getAnnotations().getActiveAnnotation(mark); if (anno == null) {