/*package*/ static EditorComponent setupInspector_id4VoD2D0CSEA(
     @NotNull SNode __thisNode__, SNode node, NodeEditorComponent nodeEditorComponent) {
   SNode nodeToSelect = node;
   while (nodeToSelect != null && nodeEditorComponent.findNodeCell(nodeToSelect) == null) {
     nodeToSelect = SNodeOperations.getParent(nodeToSelect);
   }
   nodeEditorComponent.selectNode(nodeToSelect);
   return nodeEditorComponent.getInspector();
 }
 public static EditorComponent call_setupInspector_5681471431307922086(
     SNode thisNode, SNode node, NodeEditorComponent nodeEditorComponent) {
   SNode nodeToSelect = node;
   while (nodeToSelect != null && nodeEditorComponent.findNodeCell(nodeToSelect) == null) {
     nodeToSelect = SNodeOperations.getParent(nodeToSelect);
   }
   nodeEditorComponent.selectNode(nodeToSelect);
   return nodeEditorComponent.getInspector();
 }
Ejemplo n.º 3
0
 @Nullable
 public EditorState saveState(boolean full) {
   BaseEditorState result = new BaseEditorState();
   EditorContext editorContext = getEditorContext();
   if (editorContext != null) {
     result.myMemento = editorContext.createMemento(full);
     EditorComponent editorComponent = getCurrentEditorComponent();
     if (editorComponent instanceof NodeEditorComponent) {
       NodeEditorComponent nodeEditorComponent = (NodeEditorComponent) editorComponent;
       EditorComponent inspector = nodeEditorComponent.getInspector();
       if (inspector != null) {
         EditorContext inspectorContext = inspector.getEditorContext();
         if (inspectorContext != null) {
           result.myInspectorMemento = inspectorContext.createMemento(full);
         }
       }
     }
   }
   return result;
 }
Ejemplo n.º 4
0
  public void loadState(@NotNull EditorState state) {
    if (!(state instanceof BaseEditorState)) return;

    final BaseEditorState s = (BaseEditorState) state;
    if (s.myMemento != null) {
      assert myEditorComponent != null;
      assert myEditorComponent.getEditorContext() != null;

      getEditorContext().setMemento(s.myMemento);
    }
    if (s.myInspectorMemento != null) {
      final NodeEditorComponent editorComponent = (NodeEditorComponent) getCurrentEditorComponent();
      if (editorComponent != null) {
        if (editorComponent.getInspector() != null) {
          editorComponent.getInspector().getEditorContext().setMemento(s.myInspectorMemento);
        } else {
          SwingUtilities.invokeLater(
              new Runnable() {
                int tries = 0;

                @Override
                public void run() {
                  EditorComponent inspector = editorComponent.getInspector();
                  if (inspector != null) {
                    inspector.getEditorContext().setMemento(s.myInspectorMemento);
                  } else if ((tries++) < 3) {
                    try {
                      Thread.sleep(tries * 500);
                    } catch (InterruptedException ignore) {
                    }
                    SwingUtilities.invokeLater(this);
                  } else {
                    LOG.error("couln't restore inspector state: no inspector tool");
                  }
                }
              });
        }
      }
    }
  }