{ onDispose( (d) -> { if (attachedTo != null) { attachedTo.removeAnnotationModelListener(listener); } }); }
private synchronized void attachListener(AppNameAnnotationModel annotationModel) { if (attachedTo == annotationModel) { return; } if (attachedTo != null) { attachedTo.removeAnnotationModelListener(listener); } if (annotationModel != null) { annotationModel.addAnnotationModelListener(listener); } attachedTo = annotationModel; }