예제 #1
0
 private void registerNode(@NotNull final MPSTreeNode node) {
   final Feature feature = myFeatureExtractor.getFeature(node);
   if (feature != null) {
     synchronized (myFeaturesHolder) {
       myFeaturesHolder.putNodeWithFeature(feature, node);
     }
     myCommandQueue.runTask(
         new Runnable() {
           public void run() {
             ModelAccess.instance()
                 .runReadAction(
                     new Runnable() {
                       public void run() {
                         synchronized (myFeaturesHolder) {
                           // check if node isn't already removed from tree
                           if (myFeaturesHolder.getNodesByFeature(feature).contains(node)) {
                             rehighlightNode(node, feature);
                           }
                         }
                       }
                     });
           }
         });
   }
 }
예제 #2
0
 public void rehighlightAllFeaturesNow() {
   ModelAccess.assertLegalRead();
   synchronized (myFeaturesHolder) {
     for (Feature f : ListSequence.fromList(myFeaturesHolder.getAllModelFeatures())) {
       rehighlightFeatureAndDescendants(f);
     }
   }
 }
예제 #3
0
 private void unregisterNode(@NotNull MPSTreeNode node) {
   Feature feature = myFeatureExtractor.getFeature(node);
   if (feature != null) {
     synchronized (myFeaturesHolder) {
       if (myFeaturesHolder.getNodesByFeature(feature).contains(node)) {
         myFeaturesHolder.removeNodeWithFeature(feature, node);
       } else {
         if (LOG.isEnabledFor(Priority.ERROR)) {
           LOG.error(
               "trying to remove tree node which was not registered: "
                   + node.getClass().getName()
                   + " "
                   + feature);
         }
       }
     }
     unhighlightNode(node);
   }
 }
예제 #4
0
 private void rehighlightFeature(@NotNull Feature feature) {
   for (MPSTreeNode node :
       CollectionSequence.fromCollection(myFeaturesHolder.getNodesByFeature(feature))) {
     rehighlightNode(node, feature);
   }
 }