public void propertyChange (PropertyChangeEvent evt) { if (evt.getPropertyName() == AnnotationDesc.PROP_ANNOTATION_TYPE) { AnnotationDesc anno = (AnnotationDesc)evt.getSource(); LineAnnotations lineAnnos = (LineAnnotations)lineAnnotationsByMark.get(anno.getMark()); lineAnnos.refreshAnnotations(); refreshLine(lineAnnos.getLine()); } if (evt.getPropertyName() == AnnotationDesc.PROP_MOVE_TO_FRONT) { AnnotationDesc anno = (AnnotationDesc)evt.getSource(); frontAnnotation(anno); } } };
/** * Activate next annotation on the line. Used for cycling through the * annotations */ public AnnotationDesc activateNextAnnotation(int line) { LineAnnotations annos = getLineAnnotations(line); if (annos == null) return null; AnnotationDesc aa = annos.activateNext(); refreshLine(line); return aa; }
public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName() == AnnotationDesc.PROP_ANNOTATION_TYPE) { AnnotationDesc anno = (AnnotationDesc) evt.getSource(); LineAnnotations lineAnnos = (LineAnnotations) lineAnnotationsByMark.get(anno.getMark()); lineAnnos.refreshAnnotations(); refreshLine(lineAnnos.getLine()); } if (evt.getPropertyName() == AnnotationDesc.PROP_MOVE_TO_FRONT) { AnnotationDesc anno = (AnnotationDesc) evt.getSource(); frontAnnotation(anno); } } };
/** Activate next annotation on the line. Used for cycling * through the annotations */ public AnnotationDesc activateNextAnnotation(int line) { LineAnnotations annos = getLineAnnotations(line); if (annos == null) return null; AnnotationDesc aa = annos.activateNext(); refreshLine(line); return aa; }
/** * Move annotation in front of others. The activated annotation is moved in * front of other annotations on the same line */ public void frontAnnotation(AnnotationDesc anno) { int line = anno.getLine(); LineAnnotations annos = getLineAnnotations(line); if (annos == null) return; annos.activate(anno); refreshLine(line); }
/** Move annotation in front of others. The activated annotation * is moved in front of other annotations on the same line */ public void frontAnnotation(AnnotationDesc anno) { int line = anno.getLine(); LineAnnotations annos = getLineAnnotations(line); if (annos == null) return; annos.activate(anno); refreshLine(line); }
/** Remove annotation */ public void removeAnnotation(AnnotationDesc anno) { // find LineAnnotations for the mark LineAnnotations lineAnnos = (LineAnnotations) lineAnnotationsByMark.get(anno.getMark()); int line = lineAnnos.getLine(); // remove annotation from the line lineAnnos.removeAnnotation(anno); // check if this mark is referenced or not. If not, remove it if (!lineAnnos.isMarkStillReferenced(anno.getMark())) { lineAnnotationsByMark.remove(anno.getMark()); MarkChain chain = getLayer().getMarkChain(); chain.removeMark(anno.getOffset()); } // if there is no more annotations on the line, remove LineAnnotations if (lineAnnos.getCount() == 0) { lineAnnotationsArray.remove(lineAnnotationsArray.indexOf(lineAnnos)); } // clear the mark from annotation anno.setMark(null); // remove listener on changes of annotation type anno.removePropertyChangeListener(l); // notify view that must be redrawn refreshLine(line); }
refreshLine(lineAnnos.getLine());