public void doExecute(@NotNull final AnActionEvent event, final Map<String, Object> _params) { try { NodeHighlightManager highlightManager = ((EditorComponent) MapSequence.fromMap(_params).get("editorComponent")) .getHighlightManager(); EditorMessageOwner messageOwner = ((EditorComponent) MapSequence.fromMap(_params).get("editorComponent")) .getHighlightMessagesOwner(); Set<SNode> usages = FindUsagesManager.getInstance() .findUsages( Collections.singleton( SNodeOperations.getConceptDeclaration( ((SNode) MapSequence.fromMap(_params).get("node")))), SearchType.INSTANCES, new ModelsOnlyScope( ((SModelDescriptor) MapSequence.fromMap(_params).get("model"))), null); for (SNode ref : SetSequence.fromSet(usages)) { if (ref.getContainingRoot() == ((EditorComponent) MapSequence.fromMap(_params).get("editorComponent")) .getRootCell() .getSNode() .getContainingRoot()) { highlightManager.mark(ref, HighlightConstants.INSTANCES_COLOR, "usage", messageOwner); } } highlightManager.repaintAndRebuildEditorMessages(); } catch (Throwable t) { if (log.isErrorEnabled()) { log.error("User's action execute method failed. Action:" + "HighlightInstances", t); } } }
public List<?> createParameterObjects( SNode node, IOperationContext operationContext, EditorContext editorContext) { SAbstractConcept concept = MetaAdapterFactory.getConcept( 0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x111b251a62aL, "jetbrains.mps.lang.typesystem.structure.ReportErrorStatement"); AbstractModule module = ((AbstractModule) SNodeOperations.getModel(node).getModule()); Set<SNode> errorInstances = FindUsagesManager.getInstance() .findInstances( module.getScope(), Collections.singleton(concept), true, new EmptyProgressMonitor()); return SetSequence.fromSet(errorInstances) .toListSequence() .select( new ISelector<SNode, SNode>() { public SNode select(SNode it) { return SNodeOperations.cast( it, MetaAdapterFactory.getConcept( 0x7a5dda6291404668L, 0xab76d5ed1746f2b2L, 0x111b251a62aL, "jetbrains.mps.lang.typesystem.structure.ReportErrorStatement")); } }) .toListSequence(); }