Search in sources :

Example 1 with DockableEditorTabbedContainer

use of com.intellij.openapi.fileEditor.impl.DockableEditorTabbedContainer in project intellij-community by JetBrains.

the class StatusBarUtil method getCurrentFileEditor.

/**
   * Finds the current file editor.
   */
@Nullable
public static FileEditor getCurrentFileEditor(@NotNull Project project, @Nullable StatusBar statusBar) {
    if (statusBar == null) {
        return null;
    }
    DockContainer c = DockManager.getInstance(project).getContainerFor(statusBar.getComponent());
    EditorsSplitters splitters = null;
    if (c instanceof DockableEditorTabbedContainer) {
        splitters = ((DockableEditorTabbedContainer) c).getSplitters();
    }
    if (splitters != null && splitters.getCurrentWindow() != null) {
        EditorWithProviderComposite editor = splitters.getCurrentWindow().getSelectedEditor();
        if (editor != null) {
            return editor.getSelectedEditorWithProvider().getFirst();
        }
    }
    return null;
}
Also used : EditorWithProviderComposite(com.intellij.openapi.fileEditor.impl.EditorWithProviderComposite) DockableEditorTabbedContainer(com.intellij.openapi.fileEditor.impl.DockableEditorTabbedContainer) DockContainer(com.intellij.ui.docking.DockContainer) EditorsSplitters(com.intellij.openapi.fileEditor.impl.EditorsSplitters) Nullable(org.jetbrains.annotations.Nullable)

Example 2 with DockableEditorTabbedContainer

use of com.intellij.openapi.fileEditor.impl.DockableEditorTabbedContainer in project intellij-community by JetBrains.

the class OpenEditorsContextProvider method clearContext.

@Override
public void clearContext() {
    if (myFileEditorManager != null) {
        myFileEditorManager.closeAllFiles();
        myFileEditorManager.getMainSplitters().clear();
    }
    for (DockContainer container : myDockManager.getContainers()) {
        if (container instanceof DockableEditorTabbedContainer) {
            container.closeAll();
        }
    }
}
Also used : DockableEditorTabbedContainer(com.intellij.openapi.fileEditor.impl.DockableEditorTabbedContainer) DockContainer(com.intellij.ui.docking.DockContainer)

Aggregations

DockableEditorTabbedContainer (com.intellij.openapi.fileEditor.impl.DockableEditorTabbedContainer)2 DockContainer (com.intellij.ui.docking.DockContainer)2 EditorWithProviderComposite (com.intellij.openapi.fileEditor.impl.EditorWithProviderComposite)1 EditorsSplitters (com.intellij.openapi.fileEditor.impl.EditorsSplitters)1 Nullable (org.jetbrains.annotations.Nullable)1