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 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();
     highlightManager.mark(
         ((EditorCell) MapSequence.fromMap(_params).get("editorCell")).getSNode(),
         HighlightConstants.NODE_COLOR,
         "node",
         messageOwner);
     Set<SNode> nodes =
         ((EditorComponent) MapSequence.fromMap(_params).get("editorComponent"))
             .getNodesCellDependOn(((EditorCell) MapSequence.fromMap(_params).get("editorCell")));
     if (nodes != null) {
       for (SNode node : SetSequence.fromSet(nodes)) {
         highlightManager.mark(node, HighlightConstants.DEPENDENCY_COLOR, "usage", messageOwner);
       }
     }
     Set<SNodeReference> copyOfRefTargets =
         ((EditorComponent) MapSequence.fromMap(_params).get("editorComponent"))
             .getCopyOfRefTargetsCellDependsOn(
                 ((EditorCell) MapSequence.fromMap(_params).get("editorCell")));
     if (copyOfRefTargets != null) {
       for (SNodeReference nodePointer : SetSequence.fromSet(copyOfRefTargets)) {
         if (((SNodePointer) nodePointer).resolve(MPSModuleRepository.getInstance()) != null) {
           highlightManager.mark(
               ((SNodePointer) nodePointer).resolve(MPSModuleRepository.getInstance()),
               HighlightConstants.DEPENDENCY_COLOR,
               "usage",
               messageOwner);
         }
       }
     }
     highlightManager.repaintAndRebuildEditorMessages();
   } catch (Throwable t) {
     LOG.error("User's action execute method failed. Action:" + "HighlightCellDependencies", t);
   }
 }
示例#3
0
 private void clearHighlighting() {
   myHighlightManager.clearForOwner(myMessageOwner);
 }