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); } } } }); } }); } }
public void rehighlightAllFeaturesNow() { ModelAccess.assertLegalRead(); synchronized (myFeaturesHolder) { for (Feature f : ListSequence.fromList(myFeaturesHolder.getAllModelFeatures())) { rehighlightFeatureAndDescendants(f); } } }
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); } }
private void rehighlightFeature(@NotNull Feature feature) { for (MPSTreeNode node : CollectionSequence.fromCollection(myFeaturesHolder.getNodesByFeature(feature))) { rehighlightNode(node, feature); } }