Search in sources :

Example 16 with ToolWindowManagerEx

use of com.intellij.openapi.wm.ex.ToolWindowManagerEx in project intellij-community by JetBrains.

the class HideAllToolWindowsAction method update.

public void update(AnActionEvent event) {
    Presentation presentation = event.getPresentation();
    Project project = event.getProject();
    if (project == null) {
        presentation.setEnabled(false);
        return;
    }
    ToolWindowManagerEx toolWindowManager = ToolWindowManagerEx.getInstanceEx(project);
    String[] ids = toolWindowManager.getToolWindowIds();
    for (String id : ids) {
        if (HideToolWindowAction.shouldBeHiddenByShortCut(toolWindowManager, id)) {
            presentation.setEnabled(true);
            presentation.setText(IdeBundle.message("action.hide.all.windows"), true);
            return;
        }
    }
    final DesktopLayout layout = toolWindowManager.getLayoutToRestoreLater();
    if (layout != null) {
        presentation.setEnabled(true);
        presentation.setText(IdeBundle.message("action.restore.windows"));
        return;
    }
    presentation.setEnabled(false);
}
Also used : Project(com.intellij.openapi.project.Project) DesktopLayout(com.intellij.openapi.wm.impl.DesktopLayout) Presentation(com.intellij.openapi.actionSystem.Presentation) ToolWindowManagerEx(com.intellij.openapi.wm.ex.ToolWindowManagerEx)

Example 17 with ToolWindowManagerEx

use of com.intellij.openapi.wm.ex.ToolWindowManagerEx in project intellij-community by JetBrains.

the class HideAllToolWindowsAction method performAction.

public static void performAction(final Project project) {
    ToolWindowManagerEx toolWindowManager = ToolWindowManagerEx.getInstanceEx(project);
    DesktopLayout layout = new DesktopLayout();
    layout.copyFrom(toolWindowManager.getLayout());
    // to clear windows stack
    toolWindowManager.clearSideStack();
    //toolWindowManager.activateEditorComponent();
    String[] ids = toolWindowManager.getToolWindowIds();
    boolean hasVisible = false;
    for (String id : ids) {
        if (HideToolWindowAction.shouldBeHiddenByShortCut(toolWindowManager, id)) {
            toolWindowManager.getToolWindow(id).hide(null);
            hasVisible = true;
        }
    }
    if (hasVisible) {
        toolWindowManager.setLayoutToRestoreLater(layout);
        toolWindowManager.activateEditorComponent();
    } else {
        final DesktopLayout restoredLayout = toolWindowManager.getLayoutToRestoreLater();
        if (restoredLayout != null) {
            toolWindowManager.setLayoutToRestoreLater(null);
            toolWindowManager.setLayout(restoredLayout);
        }
    }
}
Also used : DesktopLayout(com.intellij.openapi.wm.impl.DesktopLayout) ToolWindowManagerEx(com.intellij.openapi.wm.ex.ToolWindowManagerEx)

Example 18 with ToolWindowManagerEx

use of com.intellij.openapi.wm.ex.ToolWindowManagerEx in project intellij-community by JetBrains.

the class HideSideWindowsAction method actionPerformed.

public void actionPerformed(AnActionEvent e) {
    Project project = e.getProject();
    if (project == null) {
        return;
    }
    ToolWindowManagerEx toolWindowManager = ToolWindowManagerEx.getInstanceEx(project);
    String id = toolWindowManager.getActiveToolWindowId();
    if (id == null) {
        id = toolWindowManager.getLastActiveToolWindowId();
    }
    if (HideToolWindowAction.shouldBeHiddenByShortCut(toolWindowManager, id)) {
        toolWindowManager.hideToolWindow(id, true);
    }
}
Also used : Project(com.intellij.openapi.project.Project) ToolWindowManagerEx(com.intellij.openapi.wm.ex.ToolWindowManagerEx)

Example 19 with ToolWindowManagerEx

use of com.intellij.openapi.wm.ex.ToolWindowManagerEx in project intellij-community by JetBrains.

the class HideToolWindowAction method update.

public void update(AnActionEvent event) {
    Presentation presentation = event.getPresentation();
    Project project = event.getProject();
    if (project == null) {
        presentation.setEnabled(false);
        return;
    }
    ToolWindowManagerEx toolWindowManager = ToolWindowManagerEx.getInstanceEx(project);
    String id = toolWindowManager.getActiveToolWindowId();
    if (id == null) {
        id = toolWindowManager.getLastActiveToolWindowId();
    }
    presentation.setEnabled(shouldBeHiddenByShortCut(toolWindowManager, id));
}
Also used : Project(com.intellij.openapi.project.Project) Presentation(com.intellij.openapi.actionSystem.Presentation) ToolWindowManagerEx(com.intellij.openapi.wm.ex.ToolWindowManagerEx)

Example 20 with ToolWindowManagerEx

use of com.intellij.openapi.wm.ex.ToolWindowManagerEx in project android by JetBrains.

the class AndroidThemePreviewToolWindowManager method initToolWindow.

private void initToolWindow() {
    myToolWindow = ToolWindowManager.getInstance(myProject).registerToolWindow(TOOL_WINDOW_ID, false, ToolWindowAnchor.RIGHT, myProject, false);
    myToolWindow.setIcon(AndroidIcons.ThemesPreview);
    myToolWindow.setAvailable(false, null);
    myToolWindow.setAutoHide(false);
    // Add a listener so we only update the preview when it's visible
    ((ToolWindowManagerEx) ToolWindowManager.getInstance(myProject)).addToolWindowManagerListener(new ToolWindowManagerAdapter() {

        @Override
        public void stateChanged() {
            if (myProject.isDisposed()) {
                return;
            }
            final ToolWindow window = ToolWindowManager.getInstance(myProject).getToolWindow(TOOL_WINDOW_ID);
            if (window != null && window.isAvailable()) {
                final boolean visible = window.isVisible();
                AndroidEditorSettings.getInstance().getGlobalState().setVisible(visible);
                if (visible && !myIsToolWindowVisible) {
                    updatePreview();
                }
                myIsToolWindowVisible = visible;
            }
        }
    });
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) ToolWindowManagerAdapter(com.intellij.openapi.wm.ex.ToolWindowManagerAdapter) ToolWindowManagerEx(com.intellij.openapi.wm.ex.ToolWindowManagerEx)

Aggregations

ToolWindowManagerEx (com.intellij.openapi.wm.ex.ToolWindowManagerEx)37 Project (com.intellij.openapi.project.Project)14 ToolWindow (com.intellij.openapi.wm.ToolWindow)13 ToolWindowManagerAdapter (com.intellij.openapi.wm.ex.ToolWindowManagerAdapter)9 Content (com.intellij.ui.content.Content)7 ToolWindowEx (com.intellij.openapi.wm.ex.ToolWindowEx)6 ToolWindowManager (com.intellij.openapi.wm.ToolWindowManager)5 Presentation (com.intellij.openapi.actionSystem.Presentation)4 ToolWindowManagerListener (com.intellij.openapi.wm.ex.ToolWindowManagerListener)4 DesktopLayout (com.intellij.openapi.wm.impl.DesktopLayout)4 Disposable (com.intellij.openapi.Disposable)3 ToolWindowType (com.intellij.openapi.wm.ToolWindowType)3 ContentManager (com.intellij.ui.content.ContentManager)2 LightToolWindow (com.intellij.designer.LightToolWindow)1 com.intellij.execution (com.intellij.execution)1 RunDashboardManager (com.intellij.execution.dashboard.RunDashboardManager)1 ConsoleViewImpl (com.intellij.execution.impl.ConsoleViewImpl)1 ConsoleView (com.intellij.execution.ui.ConsoleView)1 OccurenceNavigator (com.intellij.ide.OccurenceNavigator)1 ProjectViewImpl (com.intellij.ide.projectView.impl.ProjectViewImpl)1