Search in sources :

Example 1 with EditorWindow

use of com.intellij.openapi.fileEditor.impl.EditorWindow 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 EditorWindow

use of com.intellij.openapi.fileEditor.impl.EditorWindow 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 EditorWindow

use of com.intellij.openapi.fileEditor.impl.EditorWindow in project ideavim by JetBrains.

the class WindowGroup method findWindowsInRow.

@NotNull
private static List<EditorWindow> findWindowsInRow(@NotNull EditorWindow anchor, @NotNull List<EditorWindow> windows, final boolean vertical) {
    final Rectangle anchorRect = getEditorWindowRectangle(anchor);
    if (anchorRect != null) {
        final List<EditorWindow> result = new ArrayList<EditorWindow>();
        final double coord = vertical ? anchorRect.getX() : anchorRect.getY();
        for (EditorWindow window : windows) {
            final Rectangle rect = getEditorWindowRectangle(window);
            if (rect != null) {
                final double min = vertical ? rect.getX() : rect.getY();
                final double max = min + (vertical ? rect.getWidth() : rect.getHeight());
                if (coord >= min && coord <= max) {
                    result.add(window);
                }
            }
        }
        Collections.sort(result, new Comparator<EditorWindow>() {

            @Override
            public int compare(EditorWindow window1, EditorWindow window2) {
                final Rectangle rect1 = getEditorWindowRectangle(window1);
                final Rectangle rect2 = getEditorWindowRectangle(window2);
                if (rect1 != null && rect2 != null) {
                    final double diff = vertical ? (rect1.getY() - rect2.getY()) : (rect1.getX() - rect2.getX());
                    return diff < 0 ? -1 : diff > 0 ? 1 : 0;
                }
                return 0;
            }
        });
        return result;
    }
    return Collections.singletonList(anchor);
}
Also used : EditorWindow(com.intellij.openapi.fileEditor.impl.EditorWindow) NotNull(org.jetbrains.annotations.NotNull)

Example 4 with EditorWindow

use of com.intellij.openapi.fileEditor.impl.EditorWindow 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 5 with EditorWindow

use of com.intellij.openapi.fileEditor.impl.EditorWindow 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)

Aggregations

EditorWindow (com.intellij.openapi.fileEditor.impl.EditorWindow)33 FileEditorManagerEx (com.intellij.openapi.fileEditor.ex.FileEditorManagerEx)22 Project (com.intellij.openapi.project.Project)16 VirtualFile (com.intellij.openapi.vfs.VirtualFile)14 EditorWithProviderComposite (com.intellij.openapi.fileEditor.impl.EditorWithProviderComposite)5 FileEditor (com.intellij.openapi.fileEditor.FileEditor)3 EditorComposite (com.intellij.openapi.fileEditor.impl.EditorComposite)3 Pair (com.intellij.openapi.util.Pair)3 CommandProcessor (com.intellij.openapi.command.CommandProcessor)2 Document (com.intellij.openapi.editor.Document)2 FileColorManager (com.intellij.ui.FileColorManager)2 NotNull (org.jetbrains.annotations.NotNull)2 Nullable (org.jetbrains.annotations.Nullable)2 HprofEditor (com.android.tools.idea.editors.hprof.HprofEditor)1 Presentation (com.intellij.openapi.actionSystem.Presentation)1 EditorEx (com.intellij.openapi.editor.ex.EditorEx)1 OpenFileDescriptor (com.intellij.openapi.fileEditor.OpenFileDescriptor)1 TextEditor (com.intellij.openapi.fileEditor.TextEditor)1 EditorTabbedContainer (com.intellij.openapi.fileEditor.impl.EditorTabbedContainer)1 EditorsSplitters (com.intellij.openapi.fileEditor.impl.EditorsSplitters)1