@Override protected void removeAllAnnotations(boolean fireModelChanged) { super.removeAllAnnotations(fireModelChanged); synchronized (getLockObject()) { fReverseMap.clear(); } }
/** * Converts an String containing an IP address in dotted quad form into the corresponding domain * name. ex. 127.0.0.1 -> 1.0.0.127.IN-ADDR.ARPA. * * @return A String containing the domain name. */ public static String inaddrString(String s) { try { return ReverseMap.fromAddress(s).toString(); } catch (UnknownHostException e) { return null; } }
@Override @SuppressWarnings({"unchecked"}) protected void removeAnnotation(Annotation annotation, boolean fireModelChanged) { Position position = getPosition(annotation); synchronized (getLockObject()) { Object cached = fReverseMap.get(position); if (cached instanceof List) { List<Annotation> list = (List<Annotation>) cached; list.remove(annotation); if (list.size() == 1) { fReverseMap.put(position, list.get(0)); list.clear(); } } else if (cached instanceof Annotation) { fReverseMap.remove(position); } } super.removeAnnotation(annotation, fireModelChanged); }
@Override @SuppressWarnings({"unchecked"}) 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<Annotation> list = (List<Annotation>) cached; list.add(annotation); } else if (cached instanceof Annotation) { List<Annotation> list = new ArrayList<Annotation>(2); list.add((Annotation) cached); list.add(annotation); fReverseMap.put(position, list); } } }
private Object getAnnotations(Position position) { synchronized (getLockObject()) { return fReverseMap.get(position); } }
/** * Converts an InetAddress into the corresponding domain name (127.0.0.1 -> * 1.0.0.127.IN-ADDR.ARPA.) * * @return A String containing the domain name. */ public static String inaddrString(InetAddress addr) { return ReverseMap.fromAddress(addr).toString(); }