Exemplo n.º 1
0
  protected void initConsoleTab(@Nullable final String history) {
    getProject()
        .getModelAccess()
        .executeCommand(
            new Runnable() {
              public void run() {
                createConsoleModel();
                addBuiltInImports();
                loadHistory(history);
                createEditor();
                myFileEditor = new ConsoleFileEditor(myEditor);
              }
            });

    this.setLayout(new BorderLayout());

    DefaultActionGroup group = new DefaultActionGroup();
    registerActions(group);
    ActionToolbar toolbar =
        ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, group, false);
    JPanel toolbarComponent = new JPanel(new BorderLayout());
    toolbarComponent.add(toolbar.getComponent(), BorderLayout.CENTER);

    this.add(toolbarComponent, BorderLayout.WEST);
    this.add(myEditor.getExternalComponent(), BorderLayout.CENTER);

    myHighlighter = check_6q36mf_a0o0ic(myTool.getProject());
    myHighlighter.addAdditionalEditorComponent(myEditor);
  }
Exemplo n.º 2
0
 public void selectNode(final SNode nodeToSelect) {
   myTool
       .getToolWindow()
       .activate(
           new Runnable() {
             public void run() {
               getProject()
                   .getRepository()
                   .getModelAccess()
                   .runReadAction(
                       new Runnable() {
                         public void run() {
                           myEditor.selectNode(nodeToSelect);
                           getEditorComponent().ensureSelectionVisible();
                           IdeFocusManager.getInstance(myTool.getProject())
                               .requestFocus(myEditor, false);
                         }
                       });
             }
           });
   myTool.selectTab(this);
 }
Exemplo n.º 3
0
 protected void createEditor() {
   this.myEditor =
       new UIEditorComponent(
           check_6q36mf_a0a0a0a82(ProjectHelper.toMPSProject(myTool.getProject())), null) {
         @Nullable
         @Override
         public Object getData(@NonNls String key) {
           if (PlatformDataKeys.FILE_EDITOR.is(key)) {
             return myFileEditor;
           }
           if (PlatformDataKeys.PASTE_PROVIDER.is(key)) {
             PasteProvider parentPasteProvider =
                 as_6q36mf_a0a0a1a0a0a0a0cb(super.getData(key), PasteProvider.class);
             return (myTool.getPasteAsRef()
                 ? new BaseConsoleTab.MyPasteProvider(parentPasteProvider)
                 : parentPasteProvider);
           }
           return super.getData(key);
         }
       };
   myEditor.editNode(myRoot);
 }
Exemplo n.º 4
0
 public void execute(
     @Nullable final SNode command,
     @Nullable final Runnable executeBefore,
     @Nullable final Runnable executeAfter) {
   myTool.selectTab(this);
   final SNode[] typedCommand = new SNode[1];
   getProject()
       .getModelAccess()
       .executeCommand(
           new Runnable() {
             public void run() {
               typedCommand[0] =
                   SConceptOperations.createNewNode(
                       SNodeOperations.asInstanceConcept(
                           MetaAdapterFactory.getConcept(
                               0xde1ad86d6e504a02L,
                               0xb306d4d17f64c375L,
                               0x4e27160acb4484bL,
                               "jetbrains.mps.console.base.structure.CommandHolder")));
               if (command != null) {
                 addNodeImports(command);
                 SLinkOperations.setTarget(
                     typedCommand[0],
                     MetaAdapterFactory.getContainmentLink(
                         0xde1ad86d6e504a02L,
                         0xb306d4d17f64c375L,
                         0x4e27160acb4484bL,
                         0x4e27160acb44924L,
                         "command"),
                     SNodeOperations.copyNode(
                         SLinkOperations.getTarget(
                             SLinkOperations.getTarget(
                                 myRoot,
                                 MetaAdapterFactory.getContainmentLink(
                                     0xde1ad86d6e504a02L,
                                     0xb306d4d17f64c375L,
                                     0x15fb34051f725a2cL,
                                     0x15fb34051f725bb1L,
                                     "commandHolder")),
                             MetaAdapterFactory.getContainmentLink(
                                 0xde1ad86d6e504a02L,
                                 0xb306d4d17f64c375L,
                                 0x4e27160acb4484bL,
                                 0x4e27160acb44924L,
                                 "command"))));
                 SLinkOperations.setTarget(
                     SLinkOperations.getTarget(
                         myRoot,
                         MetaAdapterFactory.getContainmentLink(
                             0xde1ad86d6e504a02L,
                             0xb306d4d17f64c375L,
                             0x15fb34051f725a2cL,
                             0x15fb34051f725bb1L,
                             "commandHolder")),
                     MetaAdapterFactory.getContainmentLink(
                         0xde1ad86d6e504a02L,
                         0xb306d4d17f64c375L,
                         0x4e27160acb4484bL,
                         0x4e27160acb44924L,
                         "command"),
                     SNodeOperations.copyNode(command));
               }
             }
           });
   BHReflection.invoke(
       SLinkOperations.getTarget(
           SLinkOperations.getTarget(
               myRoot,
               MetaAdapterFactory.getContainmentLink(
                   0xde1ad86d6e504a02L,
                   0xb306d4d17f64c375L,
                   0x15fb34051f725a2cL,
                   0x15fb34051f725bb1L,
                   "commandHolder")),
           MetaAdapterFactory.getContainmentLink(
               0xde1ad86d6e504a02L,
               0xb306d4d17f64c375L,
               0x4e27160acb4484bL,
               0x4e27160acb44924L,
               "command")),
       SMethodTrimmedId.create("execute", null, "5WvH$QO9bva"),
       getConsoleContext(),
       getConsoleStream(),
       new Runnable() {
         public void run() {
           getProject()
               .getModelAccess()
               .executeCommand(
                   new Runnable() {
                     public void run() {
                       ListSequence.fromList(
                               SLinkOperations.getChildren(
                                   SLinkOperations.getTarget(
                                       myRoot,
                                       MetaAdapterFactory.getContainmentLink(
                                           0xde1ad86d6e504a02L,
                                           0xb306d4d17f64c375L,
                                           0x15fb34051f725a2cL,
                                           0x15fb34051f725bafL,
                                           "history")),
                                   MetaAdapterFactory.getContainmentLink(
                                       0xde1ad86d6e504a02L,
                                       0xb306d4d17f64c375L,
                                       0xa835f28c1aa02beL,
                                       0x63da33792b5df49aL,
                                       "item")))
                           .addElement(
                               SNodeOperations.copyNode(
                                   SLinkOperations.getTarget(
                                       myRoot,
                                       MetaAdapterFactory.getContainmentLink(
                                           0xde1ad86d6e504a02L,
                                           0xb306d4d17f64c375L,
                                           0x15fb34051f725a2cL,
                                           0x15fb34051f725bb1L,
                                           "commandHolder"))));
                       SNodeOperations.deleteNode(
                           SLinkOperations.getTarget(
                               SLinkOperations.getTarget(
                                   myRoot,
                                   MetaAdapterFactory.getContainmentLink(
                                       0xde1ad86d6e504a02L,
                                       0xb306d4d17f64c375L,
                                       0x15fb34051f725a2cL,
                                       0x15fb34051f725bb1L,
                                       "commandHolder")),
                               MetaAdapterFactory.getContainmentLink(
                                   0xde1ad86d6e504a02L,
                                   0xb306d4d17f64c375L,
                                   0x4e27160acb4484bL,
                                   0x4e27160acb44924L,
                                   "command")));
                       check_6q36mf_a2a0a0a0a0a2a0d0kc(executeBefore);
                     }
                   });
         }
       },
       new Runnable() {
         public void run() {
           getProject()
               .getModelAccess()
               .executeCommand(
                   new Runnable() {
                     public void run() {
                       SLinkOperations.setTarget(
                           SLinkOperations.getTarget(
                               myRoot,
                               MetaAdapterFactory.getContainmentLink(
                                   0xde1ad86d6e504a02L,
                                   0xb306d4d17f64c375L,
                                   0x15fb34051f725a2cL,
                                   0x15fb34051f725bb1L,
                                   "commandHolder")),
                           MetaAdapterFactory.getContainmentLink(
                               0xde1ad86d6e504a02L,
                               0xb306d4d17f64c375L,
                               0x4e27160acb4484bL,
                               0x4e27160acb44924L,
                               "command"),
                           SLinkOperations.getTarget(
                               typedCommand[0],
                               MetaAdapterFactory.getContainmentLink(
                                   0xde1ad86d6e504a02L,
                                   0xb306d4d17f64c375L,
                                   0x4e27160acb4484bL,
                                   0x4e27160acb44924L,
                                   "command")));
                       check_6q36mf_a1a0a0a0a0a3a0d0kc(executeAfter);
                     }
                   });
         }
       });
 }