Ejemplo n.º 1
0
 @Override
 public void testMethodImpl() throws Exception {
   final Editor editor = TestBody.this.initEditor("7424976593885769462", "7424976593885770519");
   EditorComponent editorComponent = (EditorComponent) editor.getCurrentEditorComponent();
   BaseEditorTestBody.invokeAction(
       editorComponent, "jetbrains.mps.ide.editor.actions.Insert_Action");
 }
Ejemplo n.º 2
0
 @Override
 public void testMethodImpl() throws Exception {
   final Editor editor = TestBody.this.initEditor("8143909488490604941", "8143909488490604963");
   EditorComponent editorComponent = (EditorComponent) editor.getCurrentEditorComponent();
   BaseEditorTestBody.invokeAction(
       editorComponent, "jetbrains.mps.ide.editor.actions.Delete_Action");
 }
 @Override
 public void testMethodImpl() throws Exception {
   final Editor editor = TestBody.this.initEditor("5633355289409998034", "5633355289409998035");
   EditorComponent editorComponent = (EditorComponent) editor.getCurrentEditorComponent();
   BaseEditorTestBody.invokeAction(
       editorComponent, "jetbrains.mps.ide.editor.actions.Backspace_Action");
 }
Ejemplo n.º 4
0
 @Override
 public void testMethodImpl() throws Exception {
   final Editor editor = TestBody.this.initEditor("6170050146384276560", "6170050146384276582");
   EditorComponent editorComponent = (EditorComponent) editor.getCurrentEditorComponent();
   BaseEditorTestBody.invokeAction(
       editorComponent, "jetbrains.mps.ide.editor.actions.Insert_Action");
 }
Ejemplo n.º 5
0
 @Override
 public void testMethodImpl() throws Exception {
   final Editor editor = TestBody.this.initEditor("1310272842909656086", "1310272842909656095");
   EditorComponent editorComponent = (EditorComponent) editor.getCurrentEditorComponent();
   BaseEditorTestBody.invokeAction(
       editorComponent, "jetbrains.mps.ide.editor.actions.Insert_Action");
 }
Ejemplo n.º 6
0
 @Override
 public void testMethodImpl() throws Exception {
   final Editor editor = TestBody.this.initEditor("4905320928998872012", "4905320928998872025");
   EditorComponent editorComponent = (EditorComponent) editor.getCurrentEditorComponent();
   BaseEditorTestBody.typeString(editorComponent, ")");
   BaseEditorTestBody.invokeAction(
       editorComponent, "jetbrains.mps.ide.editor.actions.MoveLeft_Action");
 }
 @Override
 public void testMethodImpl() throws Exception {
   final Editor editor = TestBody.this.initEditor("9080919888312410799", "9080919888312410806");
   EditorComponent editorComponent = (EditorComponent) editor.getCurrentEditorComponent();
   BaseEditorTestBody.invokeAction(
       editorComponent, "jetbrains.mps.ide.editor.actions.SelectNext_Action");
   BaseEditorTestBody.invokeAction(
       editorComponent, "jetbrains.mps.ide.editor.actions.End_Action");
 }
 @Override
 public void testMethodImpl() throws Exception {
   final Editor editor = TestBody.this.initEditor("222793074662091832", "222793074662091867");
   EditorComponent editorComponent = (EditorComponent) editor.getCurrentEditorComponent();
   BaseEditorTestBody.invokeAction(editorComponent, "$Copy");
   BaseEditorTestBody.invokeAction(
       editorComponent, "jetbrains.mps.ide.editor.actions.Insert_Action");
   BaseEditorTestBody.invokeAction(editorComponent, "$Paste");
 }
 @Override
 public void testMethodImpl() throws Exception {
   final Editor editor = TestBody.this.initEditor("2025581204008535356", "2025581204008535365");
   EditorComponent editorComponent = (EditorComponent) editor.getCurrentEditorComponent();
   BaseEditorTestBody.invokeAction(
       editorComponent, "jetbrains.mps.ide.editor.actions.SelectNext_Action");
   BaseEditorTestBody.invokeAction(
       editorComponent, "jetbrains.mps.ide.editor.actions.RootHome_Action");
 }
Ejemplo n.º 10
0
 @Override
 public void testMethodImpl() throws Exception {
   final Editor editor = TestBody.this.initEditor("9025751233592076949", "9025751233592076974");
   EditorComponent editorComponent = (EditorComponent) editor.getCurrentEditorComponent();
   BaseEditorTestBody.invokeAction(
       editorComponent, "jetbrains.mps.ide.editor.actions.Delete_Action");
   BaseEditorTestBody.invokeAction(
       editorComponent, "jetbrains.mps.ide.editor.actions.Delete_Action");
 }
 @Override
 public void testMethodImpl() throws Exception {
   final Editor editor = TestBody.this.initEditor("6500338114639041775", "6500338114639041779");
   EditorComponent editorComponent = (EditorComponent) editor.getCurrentEditorComponent();
   BaseEditorTestBody.typeString(editorComponent, " ");
   BaseEditorTestBody.pressKeys(
       editorComponent, ListSequence.fromListAndArray(new ArrayList<String>(), "ctrl SPACE"));
   Assert.assertTrue(editorComponent.getNodeSubstituteChooser().isVisible());
   Assert.assertTrue(editorComponent.getNodeSubstituteChooser().isMenuEmpty());
   editorComponent.getNodeSubstituteChooser().setVisible(false);
   BaseEditorTestBody.pressKeys(
       editorComponent, ListSequence.fromListAndArray(new ArrayList<String>(), " ESCAPE"));
 }
Ejemplo n.º 12
0
  public void dispose() {
    myNodeEditor.dispose();
    myNodeEditor = null;

    myComponent.removeAll();
    myComponent = null;
  }
Ejemplo n.º 13
0
  public void recreateEditor() {
    if (myProject.isDisposed() || !isValid()) return;
    // if (myNodeEditor instanceof NodeEditor) return;

    myComponent.removeAll();

    FileEditorState state = myNodeEditor != null ? getState(FileEditorStateLevel.FULL) : null;

    IOperationContext context = createOperationContext();
    Editor oldNodeEditor = myNodeEditor;
    myNodeEditor = new MPSEditorOpener(myProject).createEditorFor(context, myFile.getNode());
    if (oldNodeEditor != null) {
      oldNodeEditor.dispose();
    }

    if (state != null) {
      setState(state);
    }

    myComponent.add(((BaseNodeEditor) myNodeEditor).getComponent(), BorderLayout.CENTER);
    myComponent.validate();
  }
Ejemplo n.º 14
0
  private void doUpdateWarnings(final MPSFileNodeEditor editor) {
    List<WarningPanel> newWarnings = new ArrayList<WarningPanel>();

    Editor nodeEditor = editor.getNodeEditor();
    if (nodeEditor == null) return;

    EditorComponent editorComponent = nodeEditor.getCurrentEditorComponent();
    if (editorComponent != null && editorComponent.isDisposed()) return;

    SNode node = editor.getFile().getNode();
    if (node == null) return;

    EditorWarningsProvider[] providers = Extensions.getExtensions(EditorWarningsProvider.EP_NAME);

    for (EditorWarningsProvider provider : providers) {
      WarningPanel panel = provider.getWarningPanel(node, myProject);
      if (panel != null) {
        newWarnings.add(panel);
      }
    }

    replaceWarningPanels(editor, newWarnings);
  }
Ejemplo n.º 15
0
  public void setState(final @NotNull FileEditorState state) {
    if (!(state instanceof MPSEditorStateWrapper)) return;
    final MPSEditorStateWrapper wrapper = (MPSEditorStateWrapper) state;

    if (wrapper.getLevel() == FileEditorStateLevel.UNDO) {
      // we need it here since undo might need to flush events which requires write action
      ModelAccess.instance()
          .runWriteAction(
              new Runnable() {
                public void run() {
                  myNodeEditor.loadState(wrapper.getEditorState());
                }
              });
    } else {
      myNodeEditor.loadState(wrapper.getEditorState());
    }
  }
Ejemplo n.º 16
0
 @Nullable
 public JComponent getPreferredFocusedComponent() {
   return isDisposed() ? null : (JComponent) myNodeEditor.getCurrentEditorComponent();
 }
 @Override
 public void testMethodImpl() throws Exception {
   final Editor editor = TestBody.this.initEditor("7888701088960178556", "7888701088960178795");
   EditorComponent editorComponent = (EditorComponent) editor.getCurrentEditorComponent();
   BaseEditorTestBody.typeString(editorComponent, "publicint a=1");
 }
Ejemplo n.º 18
0
 public void dispose() {
   myNodeEditor.dispose();
   myComponent.removeAll();
   myDisposed = true;
 }