Search in sources :

Example 1 with FileEditorManagerEx

use of com.intellij.openapi.fileEditor.ex.FileEditorManagerEx in project intellij-community by JetBrains.

the class FormOpeningTest method getEditorComponent.

private JComponent getEditorComponent() {
    FileEditorManagerEx editorManager = FileEditorManagerEx.getInstanceEx(getProject());
    EditorWindow window = editorManager.getSplitters().getCurrentWindow();
    return (JComponent) ((JComponent) window.getSelectedEditor().getComponent().getComponents()[0]).getComponents()[0];
}
Also used : FileEditorManagerEx(com.intellij.openapi.fileEditor.ex.FileEditorManagerEx) EditorWindow(com.intellij.openapi.fileEditor.impl.EditorWindow)

Example 2 with FileEditorManagerEx

use of com.intellij.openapi.fileEditor.ex.FileEditorManagerEx in project ideavim by JetBrains.

the class WindowGroup method closeCurrentWindow.

public void closeCurrentWindow(@NotNull DataContext context) {
    final FileEditorManagerEx fileEditorManager = getFileEditorManager(context);
    final EditorWindow window = fileEditorManager.getSplitters().getCurrentWindow();
    if (window != null) {
        window.closeAllExcept(null);
    }
}
Also used : FileEditorManagerEx(com.intellij.openapi.fileEditor.ex.FileEditorManagerEx) EditorWindow(com.intellij.openapi.fileEditor.impl.EditorWindow)

Example 3 with FileEditorManagerEx

use of com.intellij.openapi.fileEditor.ex.FileEditorManagerEx in project ideavim by JetBrains.

the class WindowGroup method closeAllExceptCurrent.

public void closeAllExceptCurrent(@NotNull DataContext context) {
    final FileEditorManagerEx fileEditorManager = getFileEditorManager(context);
    final EditorWindow current = fileEditorManager.getCurrentWindow();
    for (final EditorWindow window : fileEditorManager.getWindows()) {
        if (window != current) {
            window.closeAllExcept(null);
        }
    }
}
Also used : FileEditorManagerEx(com.intellij.openapi.fileEditor.ex.FileEditorManagerEx) EditorWindow(com.intellij.openapi.fileEditor.impl.EditorWindow)

Example 4 with FileEditorManagerEx

use of com.intellij.openapi.fileEditor.ex.FileEditorManagerEx in project ideavim by JetBrains.

the class WindowGroup method selectNextWindow.

public void selectNextWindow(@NotNull DataContext context) {
    final FileEditorManagerEx fileEditorManager = getFileEditorManager(context);
    final EditorWindow current = fileEditorManager.getCurrentWindow();
    if (current != null) {
        fileEditorManager.getNextWindow(current).setAsCurrentWindow(true);
    }
}
Also used : FileEditorManagerEx(com.intellij.openapi.fileEditor.ex.FileEditorManagerEx) EditorWindow(com.intellij.openapi.fileEditor.impl.EditorWindow)

Example 5 with FileEditorManagerEx

use of com.intellij.openapi.fileEditor.ex.FileEditorManagerEx in project ideavim by JetBrains.

the class FileGroup method closeFile.

/**
   * Close the current editor
   *
   * @param context The data context
   */
public void closeFile(@NotNull Editor editor, @NotNull DataContext context) {
    final Project project = PlatformDataKeys.PROJECT.getData(context);
    if (project != null) {
        final FileEditorManagerEx fileEditorManager = FileEditorManagerEx.getInstanceEx(project);
        final EditorWindow window = fileEditorManager.getCurrentWindow();
        final EditorTabbedContainer tabbedPane = window.getTabbedPane();
        if (tabbedPane != null) {
            if (tabbedPane.getTabCount() > 1) {
                final int index = tabbedPane.getSelectedIndex();
                tabbedPane.removeTabAt(index, index + 1);
            } else {
                tabbedPane.close();
            }
        } else {
            VirtualFile virtualFile = EditorData.getVirtualFile(editor);
            if (virtualFile != null) {
                fileEditorManager.closeFile(virtualFile);
            }
        }
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Project(com.intellij.openapi.project.Project) EditorTabbedContainer(com.intellij.openapi.fileEditor.impl.EditorTabbedContainer) FileEditorManagerEx(com.intellij.openapi.fileEditor.ex.FileEditorManagerEx) EditorWindow(com.intellij.openapi.fileEditor.impl.EditorWindow)

Aggregations

FileEditorManagerEx (com.intellij.openapi.fileEditor.ex.FileEditorManagerEx)43 EditorWindow (com.intellij.openapi.fileEditor.impl.EditorWindow)25 Project (com.intellij.openapi.project.Project)20 VirtualFile (com.intellij.openapi.vfs.VirtualFile)18 FileEditor (com.intellij.openapi.fileEditor.FileEditor)6 CommandProcessor (com.intellij.openapi.command.CommandProcessor)4 FileColorManager (com.intellij.ui.FileColorManager)4 Nullable (org.jetbrains.annotations.Nullable)4 Document (com.intellij.openapi.editor.Document)3 TextEditor (com.intellij.openapi.fileEditor.TextEditor)3 EditorWithProviderComposite (com.intellij.openapi.fileEditor.impl.EditorWithProviderComposite)3 ToolWindowManager (com.intellij.openapi.wm.ToolWindowManager)3 NotNull (org.jetbrains.annotations.NotNull)3 Presentation (com.intellij.openapi.actionSystem.Presentation)2 Editor (com.intellij.openapi.editor.Editor)2 Pair (com.intellij.openapi.util.Pair)2 EditorBoundHighlightingPass (com.intellij.codeHighlighting.EditorBoundHighlightingPass)1 HighlightingPass (com.intellij.codeHighlighting.HighlightingPass)1 TextEditorHighlightingPass (com.intellij.codeHighlighting.TextEditorHighlightingPass)1 AllIcons (com.intellij.icons.AllIcons)1