Search in sources :

Example 11 with FileEditorManagerEx

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

the class ToolWindowManagerImpl method getSplittersToFocus.

private EditorsSplitters getSplittersToFocus() {
    Window activeWindow = myWindowManager.getMostRecentFocusedWindow();
    if (activeWindow instanceof FloatingDecorator) {
        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 = ObjectUtils.notNull(lastFocusedWindow, activeWindow);
    }
    FileEditorManagerEx fem = FileEditorManagerEx.getInstanceEx(myProject);
    EditorsSplitters splitters = activeWindow != null ? fem.getSplittersFor(activeWindow) : null;
    return splitters != null ? splitters : fem.getSplitters();
}
Also used : EditorsSplitters(com.intellij.openapi.fileEditor.impl.EditorsSplitters) FileEditorManagerEx(com.intellij.openapi.fileEditor.ex.FileEditorManagerEx)

Example 12 with FileEditorManagerEx

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

the class NextSplitAction method actionPerformed.

public void actionPerformed(AnActionEvent e) {
    final Project project = e.getProject();
    final CommandProcessor commandProcessor = CommandProcessor.getInstance();
    commandProcessor.executeCommand(project, () -> {
        final FileEditorManagerEx manager = FileEditorManagerEx.getInstanceEx(project);
        manager.setCurrentWindow(manager.getNextWindow(manager.getCurrentWindow()));
    }, IdeBundle.message("command.go.to.next.split"), null);
}
Also used : Project(com.intellij.openapi.project.Project) CommandProcessor(com.intellij.openapi.command.CommandProcessor) FileEditorManagerEx(com.intellij.openapi.fileEditor.ex.FileEditorManagerEx)

Example 13 with FileEditorManagerEx

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

the class NextSplitAction method update.

public void update(final AnActionEvent event) {
    final Project project = event.getProject();
    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);
}
Also used : Project(com.intellij.openapi.project.Project) ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager) Presentation(com.intellij.openapi.actionSystem.Presentation) FileEditorManagerEx(com.intellij.openapi.fileEditor.ex.FileEditorManagerEx)

Example 14 with FileEditorManagerEx

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

the class ChangeSplitterOrientationAction method actionPerformed.

public void actionPerformed(final AnActionEvent event) {
    final Project project = event.getProject();
    final FileEditorManagerEx fileEditorManager = FileEditorManagerEx.getInstanceEx(project);
    fileEditorManager.changeSplitterOrientation();
}
Also used : Project(com.intellij.openapi.project.Project) FileEditorManagerEx(com.intellij.openapi.fileEditor.ex.FileEditorManagerEx)

Example 15 with FileEditorManagerEx

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

the class CloseAllEditorsAction method actionPerformed.

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);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Project(com.intellij.openapi.project.Project) CommandProcessor(com.intellij.openapi.command.CommandProcessor) FileEditorManagerEx(com.intellij.openapi.fileEditor.ex.FileEditorManagerEx) EditorWindow(com.intellij.openapi.fileEditor.impl.EditorWindow)

Aggregations

FileEditorManagerEx (com.intellij.openapi.fileEditor.ex.FileEditorManagerEx)37 EditorWindow (com.intellij.openapi.fileEditor.impl.EditorWindow)19 Project (com.intellij.openapi.project.Project)18 VirtualFile (com.intellij.openapi.vfs.VirtualFile)16 FileEditor (com.intellij.openapi.fileEditor.FileEditor)5 CommandProcessor (com.intellij.openapi.command.CommandProcessor)4 ToolWindowManager (com.intellij.openapi.wm.ToolWindowManager)3 NotNull (org.jetbrains.annotations.NotNull)3 Presentation (com.intellij.openapi.actionSystem.Presentation)2 Document (com.intellij.openapi.editor.Document)2 Editor (com.intellij.openapi.editor.Editor)2 TextEditor (com.intellij.openapi.fileEditor.TextEditor)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 GeneralSettings (com.intellij.ide.GeneralSettings)1 IdeEventQueue (com.intellij.ide.IdeEventQueue)1 CloseAction (com.intellij.ide.actions.CloseAction)1