protected void addAnnotation(Annotation annotation, Position position, boolean fireModelChanged) throws BadLocationException { super.addAnnotation(annotation, position, fireModelChanged); synchronized (getLockObject()) { Object cached= fReverseMap.get(position); if (cached == null) fReverseMap.put(position, annotation); else if (cached instanceof List) { List list= (List) cached; list.add(annotation); } else if (cached instanceof Annotation) { List list= new ArrayList(2); list.add(cached); list.add(annotation); fReverseMap.put(position, list); } } }
@Override protected void addAnnotation(Annotation annotation, Position position, boolean fireModelChanged) throws BadLocationException { super.addAnnotation(annotation, position, fireModelChanged); synchronized (getLockObject()) { Object cached= fReverseMap.get(position); if (cached == null) fReverseMap.put(position, annotation); else if (cached instanceof List) { @SuppressWarnings("unchecked") List<Object> list= (List<Object>) cached; list.add(annotation); } else if (cached instanceof Annotation) { List<Object> list= new ArrayList<>(2); list.add(cached); list.add(annotation); fReverseMap.put(position, list); } } }
@Override protected void addAnnotation(Annotation annotation, Position position, boolean fireModelChanged) throws BadLocationException { super.addAnnotation(annotation, position, fireModelChanged); synchronized (getLockObject()) { Object cached= fReverseMap.get(position); if (cached == null) fReverseMap.put(position, annotation); else if (cached instanceof List) { @SuppressWarnings("unchecked") List<Object> list= (List<Object>) cached; list.add(annotation); } else if (cached instanceof Annotation) { List<Object> list= new ArrayList<>(2); list.add(cached); list.add(annotation); fReverseMap.put(position, list); } } }