コード例 #1
0
 private synchronized void attachListener(AppNameAnnotationModel annotationModel) {
   if (attachedTo == annotationModel) {
     return;
   }
   if (attachedTo != null) {
     attachedTo.removeAnnotationModelListener(listener);
   }
   if (annotationModel != null) {
     annotationModel.addAnnotationModelListener(listener);
   }
   attachedTo = annotationModel;
 }
コード例 #2
0
 @Override
 protected String compute() {
   AppNameAnnotationModel annotationModel = appNameAnnotationModel.getValue();
   attachListener(annotationModel);
   if (annotationModel != null) {
     AppNameAnnotation a = annotationModel.getSelectedAppAnnotation();
     if (a != null) {
       return a.getText();
     }
   }
   return null;
 }
コード例 #3
0
 {
   onDispose(
       (d) -> {
         if (attachedTo != null) {
           attachedTo.removeAnnotationModelListener(listener);
         }
       });
 }
コード例 #4
0
 @Override
 protected List<String> compute() {
   AppNameAnnotationModel annotationModel = appNameAnnotationModel.getValue();
   attachListener(annotationModel);
   if (annotationModel != null) {
     List<String> applicationNames = new ArrayList<>();
     for (Iterator<Annotation> itr = annotationModel.getAnnotationIterator();
         itr.hasNext(); ) {
       Annotation next = itr.next();
       if (next instanceof AppNameAnnotation) {
         AppNameAnnotation a = (AppNameAnnotation) next;
         applicationNames.add(a.getText());
       }
     }
     return applicationNames;
   }
   return Collections.emptyList();
 }