com.intellij.openapi.fileEditor.ex.FileEditorManagerEx Java Examples

The following examples show how to use com.intellij.openapi.fileEditor.ex.FileEditorManagerEx. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FileUtilsTest.java    From lsp4intellij with Apache License 2.0 6 votes vote down vote up
@PrepareForTest(FileEditorManager.class)
@Test
public void testEditorFromVirtualFile() {
  VirtualFile file = PowerMockito.mock(VirtualFile.class);
  Project project = PowerMockito.mock(Project.class);

  Editor editor = PowerMockito.mock(Editor.class);
  TextEditor textEditor = PowerMockito.mock(TextEditor.class);
  PowerMockito.when(textEditor.getEditor()).thenReturn(editor);

  FileEditorManagerEx fileEditorManagerEx = PowerMockito.mock(FileEditorManagerEx.class);
  PowerMockito.mockStatic(FileEditorManager.class);
  PowerMockito.when(fileEditorManagerEx.getAllEditors(file))
      .thenReturn(new FileEditor[]{textEditor})
      .thenReturn(new FileEditor[0]);
  PowerMockito.when(FileEditorManager.getInstance(project)).thenReturn(fileEditorManagerEx);

  Assert.assertEquals(editor, FileUtils.editorFromVirtualFile(file, project));

  Assert.assertNull(FileUtils.editorFromVirtualFile(file, project));
}
 
Example #2
Source File: PinActiveTabAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
protected Handler getHandler(@Nonnull AnActionEvent e) {
  Project project = e.getProject();
  EditorWindow currentWindow = e.getData(EditorWindow.DATA_KEY);

  Content content = currentWindow != null ? null : getContentFromEvent(e);
  if (content != null && content.isPinnable()) {
    return createHandler(content);
  }

  final EditorWindow window = currentWindow != null ? currentWindow :
                              project != null ? FileEditorManagerEx.getInstanceEx(project).getCurrentWindow() : null;
  VirtualFile selectedFile = window == null ? null : getFileFromEvent(e, window);
  if (selectedFile != null) {
    return createHandler(window, selectedFile);
  }
  return null;
}
 
Example #3
Source File: CloseEditorAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void actionPerformed(AnActionEvent e) {
  final Project project = e.getData(CommonDataKeys.PROJECT);

  FileEditorManagerEx editorManager = getEditorManager(project);
  EditorWindow window = e.getData(EditorWindow.DATA_KEY);
  VirtualFile file = null;
  if (window == null) {
    window = editorManager.getActiveWindow().getResult();
    if (window != null) {
      file = window.getSelectedFile();
    }
  }
  else {
    file = e.getData(PlatformDataKeys.VIRTUAL_FILE);
  }
  if (file != null) {
    editorManager.closeFile(file, window);
  }
}
 
Example #4
Source File: CoverageView.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
protected void selectElementFromEditor(@Nonnull FileEditor editor) {
  if (myProject.isDisposed() || !CoverageView.this.isShowing()) return;
  if (myStateBean.myAutoScrollFromSource) {
    final VirtualFile file = FileEditorManagerEx.getInstanceEx(myProject).getFile(editor);
    if (file != null) {
      if (canSelect(file)) {
        PsiElement e = null;
        if (editor instanceof TextEditor) {
          final int offset = ((TextEditor)editor).getEditor().getCaretModel().getOffset();
          PsiDocumentManager.getInstance(myProject).commitAllDocuments();
          final PsiFile psiFile = PsiManager.getInstance(myProject).findFile(file);
          if (psiFile != null) {
            e = psiFile.findElementAt(offset);
          }
        }
        myBuilder.select(e != null ? e : file);
      }
    }
  }
}
 
Example #5
Source File: EmacsIdeasAction.java    From emacsIDEAs with Apache License 2.0 6 votes vote down vote up
private ArrayList<Editor> collect_active_editors(AnActionEvent e) {
    ArrayList<Editor> editors = new ArrayList<Editor>();

    final Project project = e.getData(CommonDataKeys.PROJECT);
    final FileEditorManagerEx fileEditorManager = FileEditorManagerEx.getInstanceEx(project);
    FileEditor[] selectedEditors = fileEditorManager.getSelectedEditors();

    for (FileEditor selectedEditor : selectedEditors) {
        if (selectedEditor instanceof TextEditor) {
            Editor editor = ((TextEditor) selectedEditor).getEditor();
            editors.add(editor);
        }
    }

    return editors;
}
 
Example #6
Source File: CloseAllEditorsAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void actionPerformed(final AnActionEvent e) {
  final Project project = e.getData(CommonDataKeys.PROJECT);
  CommandProcessor commandProcessor = CommandProcessor.getInstance();
  commandProcessor.executeCommand(project, () -> {
    final EditorWindow window = e.getData(EditorWindow.DATA_KEY);
    if (window != null) {
      final VirtualFile[] files = window.getFiles();
      for (final VirtualFile file : files) {
        window.closeFile(file);
      }
      return;
    }
    FileEditorManagerEx fileEditorManager = FileEditorManagerEx.getInstanceEx(project);
    VirtualFile selectedFile = fileEditorManager.getSelectedFiles()[0];
    VirtualFile[] openFiles = fileEditorManager.getSiblings(selectedFile);
    for (final VirtualFile openFile : openFiles) {
      fileEditorManager.closeFile(openFile);
    }
  }, IdeBundle.message("command.close.all.editors"), null);
}
 
Example #7
Source File: DesktopToolWindowManagerImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
private EditorsSplitters getSplittersToFocus() {
  WindowManagerEx windowManager = (WindowManagerEx)myWindowManager.get();

  Window activeWindow = TargetAWT.to(windowManager.getMostRecentFocusedWindow());

  if (activeWindow instanceof DesktopFloatingDecorator) {
    IdeFocusManager ideFocusManager = IdeFocusManager.findInstanceByComponent(activeWindow);
    IdeFrame lastFocusedFrame = ideFocusManager.getLastFocusedFrame();
    JComponent frameComponent = lastFocusedFrame != null ? lastFocusedFrame.getComponent() : null;
    Window lastFocusedWindow = frameComponent != null ? SwingUtilities.getWindowAncestor(frameComponent) : null;
    activeWindow = ObjectUtil.notNull(lastFocusedWindow, activeWindow);
  }

  FileEditorManagerEx fem = FileEditorManagerEx.getInstanceEx(myProject);
  EditorsSplitters splitters = activeWindow != null ? fem.getSplittersFor(activeWindow) : null;
  return splitters != null ? splitters : fem.getSplitters();
}
 
Example #8
Source File: DumbServiceImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
private void updateFinished() {
  if (!WriteAction.compute(this::switchToSmartMode)) return;

  if (ApplicationManager.getApplication().isInternal()) LOG.info("updateFinished");

  try {
    myPublisher.exitDumbMode();
    FileEditorManagerEx.getInstanceEx(myProject).refreshIcons();
  }
  finally {
    // It may happen that one of the pending runWhenSmart actions triggers new dumb mode;
    // in this case we should quit processing pending actions and postpone them until the newly started dumb mode finishes.
    while (!isDumb()) {
      final Runnable runnable;
      synchronized (myRunWhenSmartQueue) {
        if (myRunWhenSmartQueue.isEmpty()) {
          break;
        }
        runnable = myRunWhenSmartQueue.pullFirst();
      }
      doRun(runnable);
    }
  }
}
 
Example #9
Source File: CloseAllEditorsButActiveAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
@RequiredUIAccess
@Override
public void update(@Nonnull AnActionEvent event) {
  Presentation presentation = event.getPresentation();
  Project project = event.getData(CommonDataKeys.PROJECT);
  if (project == null) {
    presentation.setEnabled(false);
    return;
  }
  FileEditorManagerEx fileEditorManager = FileEditorManagerEx.getInstanceEx(project);
  VirtualFile selectedFile;
  final EditorWindow window = event.getData(EditorWindow.DATA_KEY);
  if (window != null) {
    presentation.setEnabled(window.getFiles().length > 1);
    return;
  }
  else {
    if (fileEditorManager.getSelectedFiles().length == 0) {
      presentation.setEnabled(false);
      return;
    }
    selectedFile = fileEditorManager.getSelectedFiles()[0];
  }
  VirtualFile[] siblings = fileEditorManager.getSiblings(selectedFile);
  presentation.setEnabled(siblings.length > 1);
}
 
Example #10
Source File: CloseAllEditorsButActiveAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
@RequiredUIAccess
@Override
public void actionPerformed(@Nonnull AnActionEvent e) {
  Project project = e.getData(CommonDataKeys.PROJECT);
  FileEditorManagerEx fileEditorManager = FileEditorManagerEx.getInstanceEx(project);
  VirtualFile selectedFile;
  final EditorWindow window = e.getData(EditorWindow.DATA_KEY);
  if (window != null) {
    window.closeAllExcept(e.getData(PlatformDataKeys.VIRTUAL_FILE));
    return;
  }
  selectedFile = fileEditorManager.getSelectedFiles()[0];
  final VirtualFile[] siblings = fileEditorManager.getSiblings(selectedFile);
  for (final VirtualFile sibling : siblings) {
    if (!Comparing.equal(selectedFile, sibling)) {
      fileEditorManager.closeFile(sibling);
    }
  }
}
 
Example #11
Source File: EditorTabbedContainer.java    From consulo with Apache License 2.0 6 votes vote down vote up
@RequiredUIAccess
@Override
public void actionPerformed(final AnActionEvent e) {
  final FileEditorManagerEx mgr = FileEditorManagerEx.getInstanceEx(myProject);
  consulo.fileEditor.impl.EditorWindow window;
  final VirtualFile file = (VirtualFile)myTabInfo.getObject();
  if (ActionPlaces.EDITOR_TAB.equals(e.getPlace())) {
    window = myWindow;
  }
  else {
    window = mgr.getCurrentWindow();
  }

  if (window != null) {
    if (BitUtil.isSet(e.getModifiers(), InputEvent.ALT_MASK)) {
      window.closeAllExcept(file);
    }
    else {
      if (window.findFileComposite(file) != null) {
        mgr.closeFile(file, window);
      }
    }
  }
}
 
Example #12
Source File: EditorTabbedContainer.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void mouseReleased(MouseEvent e) {
  if (UIUtil.isCloseClick(e, MouseEvent.MOUSE_RELEASED)) {
    final TabInfo info = myTabs.findInfo(e);
    if (info != null) {
      IdeEventQueue.getInstance().blockNextEvents(e);
      if (e.isAltDown() && e.getButton() == MouseEvent.BUTTON1) {//close others
        List<TabInfo> allTabInfos = myTabs.getTabs();
        for (TabInfo tabInfo : allTabInfos) {
          if (tabInfo == info) continue;
          FileEditorManagerEx.getInstanceEx(myProject).closeFile((VirtualFile)tabInfo.getObject(), myWindow);
        }
      }
      else {
        FileEditorManagerEx.getInstanceEx(myProject).closeFile((VirtualFile)info.getObject(), myWindow);
      }
    }
  }
}
 
Example #13
Source File: EditorTabbedContainer.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void dragOutFinished(MouseEvent event, TabInfo source) {
  boolean copy = UIUtil.isControlKeyDown(event) || mySession.getResponse(event) == DockContainer.ContentResponse.ACCEPT_COPY;
  if (!copy) {
    myFile.putUserData(FileEditorManagerImpl.CLOSING_TO_REOPEN, Boolean.TRUE);
    FileEditorManagerEx.getInstanceEx(myProject).closeFile(myFile, myWindow);
  }
  else {
    source.setHidden(false);
  }

  mySession.process(event);
  if (!copy) {
    myFile.putUserData(FileEditorManagerImpl.CLOSING_TO_REOPEN, null);
  }

  myFile = null;
  mySession = null;
}
 
Example #14
Source File: FavoritesAutoscrollFromSourceHandler.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
protected void selectElementFromEditor(@Nonnull FileEditor editor) {
  final VirtualFile file = FileEditorManagerEx.getInstanceEx(myProject).getFile(editor);
  if (file != null) {
    final PsiFile psiFile = PsiManager.getInstance(myProject).findFile(file);
    if (psiFile != null) {
      final SelectInTarget target = mySelectInTarget;
      if (target != null) {
        final SelectInContext selectInContext = SelectInContextImpl.createEditorContext(myProject, editor);

        if (target.canSelect(selectInContext)) {
          target.selectIn(selectInContext, false);
        }
      }
    }
  }
}
 
Example #15
Source File: MoveEditorToOppositeTabGroupAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
public void actionPerformed(final AnActionEvent event) {
  final VirtualFile vFile = event.getData(PlatformDataKeys.VIRTUAL_FILE);
  final Project project = event.getData(CommonDataKeys.PROJECT);
  if (vFile == null || project == null) {
    return;
  }
  final EditorWindow window = event.getData(EditorWindow.DATA_KEY);
  if (window != null) {
    final EditorWindow[] siblings = window.findSiblings();
    if (siblings.length == 1) {
      final EditorWithProviderComposite editorComposite = window.getSelectedEditor();
      final HistoryEntry entry = editorComposite.currentStateAsHistoryEntry();
      ((FileEditorManagerImpl)FileEditorManagerEx.getInstanceEx(project)).openFileImpl3(UIAccess.get(), siblings[0], vFile, true, entry, true);
      window.closeFile(vFile);
    }
  }
}
 
Example #16
Source File: FileDropHandler.java    From consulo with Apache License 2.0 6 votes vote down vote up
private void openFiles(final Project project, final List<File> fileList, EditorWindow editorWindow) {
  if (editorWindow == null && myEditor != null) {
    editorWindow = findEditorWindow(project);
  }
  final LocalFileSystem fileSystem = LocalFileSystem.getInstance();
  for (File file : fileList) {
    final VirtualFile vFile = fileSystem.refreshAndFindFileByIoFile(file);
    final FileEditorManagerEx fileEditorManager = (FileEditorManagerEx) FileEditorManager.getInstance(project);
    if (vFile != null) {
      NonProjectFileWritingAccessProvider.allowWriting(vFile);

      if (editorWindow != null) {
        fileEditorManager.openFileWithProviders(vFile, true, editorWindow);
      }
      else {
        new OpenFileDescriptor(project, vFile).navigate(true);
      }
    }
  }
}
 
Example #17
Source File: FileDropHandler.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nullable
private EditorWindow findEditorWindow(Project project) {
  final Document document = myEditor.getDocument();
  final VirtualFile file = FileDocumentManager.getInstance().getFile(document);
  if (file != null) {
    final FileEditorManagerEx fileEditorManager = (FileEditorManagerEx) FileEditorManager.getInstance(project);
    final EditorWindow[] windows = fileEditorManager.getWindows();
    for (EditorWindow window : windows) {
      final EditorWithProviderComposite composite = window.findFileComposite(file);
      if (composite == null) {
        continue;
      }
      for (FileEditor editor : composite.getEditors()) {
        if (editor instanceof TextEditor && ((TextEditor)editor).getEditor() == myEditor) {
          return window;
        }
      }
    }
  }
  return null;
}
 
Example #18
Source File: TabNavigationActionBase.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void update(@Nonnull AnActionEvent event) {
  Presentation presentation = event.getPresentation();
  Project project = event.getData(CommonDataKeys.PROJECT);
  presentation.setEnabled(false);
  if (project == null) {
    return;
  }
  final ToolWindowManager windowManager = ToolWindowManager.getInstance(project);
  if (windowManager.isEditorComponentActive()) {
    final FileEditorManagerEx editorManager = FileEditorManagerEx.getInstanceEx(project);
    EditorWindow currentWindow = event.getData(EditorWindow.DATA_KEY);
    if (currentWindow == null) {
      editorManager.getCurrentWindow();
    }
    if (currentWindow != null) {
      final VirtualFile[] files = currentWindow.getFiles();
      presentation.setEnabled(files.length > 1);
    }
    return;
  }

  ContentManager contentManager = event.getData(PlatformDataKeys.NONEMPTY_CONTENT_MANAGER);
  presentation.setEnabled(contentManager != null && contentManager.getContentCount() > 1 && contentManager.isSingleSelection());
}
 
Example #19
Source File: IdeDocumentHistoryImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void gotoPlaceInfo(@Nonnull PlaceInfo info) {
  final boolean wasActive = ToolWindowManager.getInstance(myProject).isEditorComponentActive();
  EditorWindow wnd = info.getWindow();
  FileEditorManagerEx editorManager = getFileEditorManager();
  final Pair<FileEditor[], FileEditorProvider[]> editorsWithProviders =
          wnd != null && wnd.isValid() ? editorManager.openFileWithProviders(info.getFile(), wasActive, wnd) : editorManager.openFileWithProviders(info.getFile(), wasActive, false);

  editorManager.setSelectedEditor(info.getFile(), info.getEditorTypeId());

  final FileEditor[] editors = editorsWithProviders.getFirst();
  final FileEditorProvider[] providers = editorsWithProviders.getSecond();
  for (int i = 0; i < editors.length; i++) {
    String typeId = providers[i].getEditorTypeId();
    if (typeId.equals(info.getEditorTypeId())) {
      editors[i].setState(info.getNavigationState());
    }
  }
}
 
Example #20
Source File: EditorTabbedContainer.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void close() {
  TabInfo selected = myTabs.getTargetInfo();
  if (selected == null) return;

  final VirtualFile file = (VirtualFile)selected.getObject();
  final FileEditorManagerEx mgr = FileEditorManagerEx.getInstanceEx(myProject);

  AsyncResult<EditorWindow> window = mgr.getActiveWindow();
  window.doWhenDone(wnd -> {
    if (wnd != null) {
      if (wnd.findFileComposite(file) != null) {
        mgr.closeFile(file, wnd);
      }
    }
  });
}
 
Example #21
Source File: SelectInContextImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
public static SelectInContext createEditorContext(Project project, FileEditor editor) {
  if (project == null || editor == null) {
    return null;
  }
  VirtualFile file = FileEditorManagerEx.getInstanceEx(project).getFile(editor);
  if (file == null) {
    return null;
  }
  final PsiFile psiFile = PsiManager.getInstance(project).findFile(file);
  if (psiFile == null) {
    return null;
  }
  if (editor instanceof TextEditor) {
    return new TextEditorContext((TextEditor)editor, psiFile);
  }
  else {
    return new SimpleSelectInContext(psiFile);
  }
}
 
Example #22
Source File: NextSplitAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void update(final AnActionEvent event){
  final Project project = event.getData(CommonDataKeys.PROJECT);
  final Presentation presentation = event.getPresentation();
  if (project == null) {
    presentation.setEnabled(false);
    return;
  }
  final FileEditorManagerEx manager = FileEditorManagerEx.getInstanceEx(project);
  final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
  presentation.setEnabled (toolWindowManager.isEditorComponentActive() && manager.isInSplitter() && manager.getCurrentWindow() != null);
}
 
Example #23
Source File: XVariablesViewBase.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void registerInlineEvaluator(final XStackFrame stackFrame, final XSourcePosition position, final Project project) {
  final VirtualFile file = position.getFile();
  final FileEditor fileEditor = FileEditorManagerEx.getInstanceEx(project).getSelectedEditor(file);
  if (fileEditor instanceof TextEditor) {
    final Editor editor = ((TextEditor)fileEditor).getEditor();
    removeSelectionListener();
    mySelectionListener = new MySelectionListener(editor, stackFrame, project);
    editor.getSelectionModel().addSelectionListener(mySelectionListener);
  }
}
 
Example #24
Source File: CloseEditorsActionBase.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
protected List<Pair<EditorComposite, EditorWindow>> getFilesToClose(final AnActionEvent event) {
  final ArrayList<Pair<EditorComposite, EditorWindow>> res = new ArrayList<>();
  final Project project = event.getData(CommonDataKeys.PROJECT);
  final FileEditorManagerEx editorManager = FileEditorManagerEx.getInstanceEx(project);
  final EditorWindow editorWindow = event.getData(EditorWindow.DATA_KEY);
  final EditorWindow[] windows;
  if (editorWindow != null) {
    windows = new EditorWindow[]{editorWindow};
  }
  else {
    windows = editorManager.getWindows();
  }
  final FileStatusManager fileStatusManager = FileStatusManager.getInstance(project);
  if (fileStatusManager != null) {
    for (int i = 0; i != windows.length; ++i) {
      final EditorWindow window = windows[i];
      final EditorComposite[] editors = window.getEditors();
      for (final EditorComposite editor : editors) {
        if (isFileToClose(editor, window)) {
          res.add(Pair.create(editor, window));
        }
      }
    }
  }
  return res;
}
 
Example #25
Source File: PrevSplitAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void update(final AnActionEvent event){
  final Project project = event.getData(CommonDataKeys.PROJECT);
  final Presentation presentation = event.getPresentation();
  if (project == null) {
    presentation.setEnabled(false);
    return;
  }
  final FileEditorManagerEx manager = FileEditorManagerEx.getInstanceEx(project);
  final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
  presentation.setEnabled (toolWindowManager.isEditorComponentActive() && manager.isInSplitter() && manager.getCurrentWindow() != null);
}
 
Example #26
Source File: SplitAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void update(final AnActionEvent event) {
  final Project project = event.getData(CommonDataKeys.PROJECT);
  final Presentation presentation = event.getPresentation();
  presentation.setText (myOrientation == SwingConstants.VERTICAL
                        ? IdeBundle.message("action.split.vertically")
                        : IdeBundle.message("action.split.horizontally"));
  if (project == null) {
    presentation.setEnabled(false);
    return;
  }
  final FileEditorManagerEx fileEditorManager = FileEditorManagerEx.getInstanceEx(project);
  presentation.setEnabled(fileEditorManager.hasOpenedFile ());
}
 
Example #27
Source File: ImplementationViewComponent.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void actionPerformed(AnActionEvent e) {
  PsiElement element = myElements[myIndex];
  PsiElement navigationElement = element.getNavigationElement();
  PsiFile file = getContainingFile(navigationElement);
  if (file == null) return;
  VirtualFile virtualFile = file.getVirtualFile();
  if (virtualFile == null) return;
  Project project = element.getProject();
  FileEditorManagerEx fileEditorManager = FileEditorManagerEx.getInstanceEx(project);
  OpenFileDescriptor descriptor = new OpenFileDescriptor(project, virtualFile, navigationElement.getTextOffset());
  fileEditorManager.openTextEditor(descriptor, myFocusEditor);
}
 
Example #28
Source File: SplitAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void actionPerformed(final AnActionEvent event) {
  final Project project = event.getData(CommonDataKeys.PROJECT);
  final FileEditorManagerEx fileEditorManager = FileEditorManagerEx.getInstanceEx(project);
  final EditorWindow window = event.getData(EditorWindow.DATA_KEY);

  fileEditorManager.createSplitter(myOrientation, window);
}
 
Example #29
Source File: NextSplitAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void actionPerformed(AnActionEvent e) {
  final Project project = e.getData(CommonDataKeys.PROJECT);
  final CommandProcessor commandProcessor = CommandProcessor.getInstance();
  commandProcessor.executeCommand(
    project, new Runnable(){
      public void run() {
        final FileEditorManagerEx manager = FileEditorManagerEx.getInstanceEx(project);
        manager.setCurrentWindow(manager.getNextWindow(manager.getCurrentWindow()));
      }
    }, IdeBundle.message("command.go.to.next.split"), null
  );
}
 
Example #30
Source File: PrevSplitAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void actionPerformed(AnActionEvent e) {
  final Project project = e.getData(CommonDataKeys.PROJECT);
  final CommandProcessor commandProcessor = CommandProcessor.getInstance();
  commandProcessor.executeCommand(
    project, new Runnable(){
      public void run() {
        final FileEditorManagerEx manager = FileEditorManagerEx.getInstanceEx(project);
        manager.setCurrentWindow(manager.getPrevWindow(manager.getCurrentWindow()));
      }
    }, IdeBundle.message("command.go.to.prev.split"), null
  );
}