Search in sources :

Example 11 with ToolWindowManagerEx

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

the class ToggleWindowedModeAction method setSelected.

public void setSelected(AnActionEvent event, boolean flag) {
    Project project = event.getProject();
    if (project == null) {
        return;
    }
    String id = ToolWindowManager.getInstance(project).getActiveToolWindowId();
    if (id == null) {
        return;
    }
    ToolWindowManagerEx mgr = ToolWindowManagerEx.getInstanceEx(project);
    ToolWindowEx toolWindow = (ToolWindowEx) mgr.getToolWindow(id);
    ToolWindowType type = toolWindow.getType();
    if (ToolWindowType.WINDOWED == type) {
        toolWindow.setType(toolWindow.getInternalType(), null);
    } else {
        toolWindow.setType(ToolWindowType.WINDOWED, null);
    }
}
Also used : Project(com.intellij.openapi.project.Project) ToolWindowEx(com.intellij.openapi.wm.ex.ToolWindowEx) ToolWindowType(com.intellij.openapi.wm.ToolWindowType) ToolWindowManagerEx(com.intellij.openapi.wm.ex.ToolWindowManagerEx)

Example 12 with ToolWindowManagerEx

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

the class EditorTabbedContainer method updateTabBorder.

private void updateTabBorder() {
    if (!myProject.isOpen())
        return;
    ToolWindowManagerEx mgr = (ToolWindowManagerEx) ToolWindowManager.getInstance(myProject);
    String[] ids = mgr.getToolWindowIds();
    Insets border = JBUI.emptyInsets();
    UISettings uiSettings = UISettings.getInstance();
    List<String> topIds = mgr.getIdsOn(ToolWindowAnchor.TOP);
    List<String> bottom = mgr.getIdsOn(ToolWindowAnchor.BOTTOM);
    List<String> rightIds = mgr.getIdsOn(ToolWindowAnchor.RIGHT);
    List<String> leftIds = mgr.getIdsOn(ToolWindowAnchor.LEFT);
    if (!uiSettings.getHideToolStripes() && !uiSettings.getPresentationMode()) {
        border.top = !topIds.isEmpty() ? 1 : 0;
        border.bottom = !bottom.isEmpty() ? 1 : 0;
        border.left = !leftIds.isEmpty() ? 1 : 0;
        border.right = !rightIds.isEmpty() ? 1 : 0;
    }
    for (String each : ids) {
        ToolWindow eachWnd = mgr.getToolWindow(each);
        if (eachWnd == null || !eachWnd.isAvailable())
            continue;
        if (eachWnd.isVisible() && eachWnd.getType() == ToolWindowType.DOCKED) {
            ToolWindowAnchor eachAnchor = eachWnd.getAnchor();
            if (eachAnchor == ToolWindowAnchor.TOP) {
                border.top = 0;
            } else if (eachAnchor == ToolWindowAnchor.BOTTOM) {
                border.bottom = 0;
            } else if (eachAnchor == ToolWindowAnchor.LEFT) {
                border.left = 0;
            } else if (eachAnchor == ToolWindowAnchor.RIGHT) {
                border.right = 0;
            }
        }
    }
    myTabs.getPresentation().setPaintBorder(border.top, border.left, border.right, border.bottom).setTabSidePaintBorder(5);
}
Also used : UISettings(com.intellij.ide.ui.UISettings) ToolWindowManagerEx(com.intellij.openapi.wm.ex.ToolWindowManagerEx)

Example 13 with ToolWindowManagerEx

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

the class SpeedSearchBase method manageSearchPopup.

private void manageSearchPopup(@Nullable SearchPopup searchPopup) {
    Project project = null;
    if (ApplicationManager.getApplication() != null && !ApplicationManager.getApplication().isDisposed()) {
        project = CommonDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext(myComponent));
    }
    if (project != null && project.isDefault()) {
        project = null;
    }
    if (mySearchPopup != null) {
        myPopupLayeredPane.remove(mySearchPopup);
        myPopupLayeredPane.validate();
        myPopupLayeredPane.repaint();
        myPopupLayeredPane = null;
        if (myListenerDisposable != null) {
            Disposer.dispose(myListenerDisposable);
        }
        myListenerDisposable = null;
    } else if (searchPopup != null) {
        FeatureUsageTracker.getInstance().triggerFeatureUsed("ui.tree.speedsearch");
    }
    if (!myComponent.isShowing()) {
        mySearchPopup = null;
    } else {
        mySearchPopup = searchPopup;
    }
    fireStateChanged();
    if (mySearchPopup == null || !myComponent.isDisplayable())
        return;
    if (project != null) {
        myListenerDisposable = Disposer.newDisposable();
        ToolWindowManagerEx toolWindowManager = (ToolWindowManagerEx) ToolWindowManager.getInstance(project);
        toolWindowManager.addToolWindowManagerListener(myWindowManagerListener, myListenerDisposable);
    }
    JRootPane rootPane = myComponent.getRootPane();
    if (rootPane != null) {
        myPopupLayeredPane = rootPane.getLayeredPane();
    } else {
        myPopupLayeredPane = null;
    }
    if (myPopupLayeredPane == null) {
        LOG.error(toString() + " in " + myComponent);
        return;
    }
    myPopupLayeredPane.add(mySearchPopup, JLayeredPane.POPUP_LAYER);
    moveSearchPopup();
}
Also used : Project(com.intellij.openapi.project.Project) ToolWindowManagerEx(com.intellij.openapi.wm.ex.ToolWindowManagerEx)

Example 14 with ToolWindowManagerEx

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

the class ContentManagerUtil method getContentManagerFromContext.

/**
   * This is utility method. It returns <code>ContentManager</code> from the current context.
   */
public static ContentManager getContentManagerFromContext(DataContext dataContext, boolean requiresVisibleToolWindow) {
    Project project = CommonDataKeys.PROJECT.getData(dataContext);
    if (project == null) {
        return null;
    }
    ToolWindowManagerEx mgr = ToolWindowManagerEx.getInstanceEx(project);
    String id = mgr.getActiveToolWindowId();
    if (id == null) {
        if (mgr.isEditorComponentActive()) {
            id = mgr.getLastActiveToolWindowId();
        }
    }
    ToolWindowEx toolWindow = id != null ? (ToolWindowEx) mgr.getToolWindow(id) : null;
    if (requiresVisibleToolWindow && (toolWindow == null || !toolWindow.isVisible())) {
        return null;
    }
    ContentManager fromToolWindow = toolWindow != null ? toolWindow.getContentManager() : null;
    ContentManager fromContext = PlatformDataKeys.CONTENT_MANAGER.getData(dataContext);
    return ObjectUtils.chooseNotNull(fromContext, fromToolWindow);
}
Also used : Project(com.intellij.openapi.project.Project) ToolWindowEx(com.intellij.openapi.wm.ex.ToolWindowEx) ToolWindowManagerEx(com.intellij.openapi.wm.ex.ToolWindowManagerEx)

Example 15 with ToolWindowManagerEx

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

the class BaseToolWindowToggleAction method setSelected.

@Override
public final void setSelected(AnActionEvent e, boolean state) {
    Project project = e.getProject();
    if (project == null) {
        return;
    }
    String id = ToolWindowManager.getInstance(project).getActiveToolWindowId();
    if (id == null) {
        return;
    }
    ToolWindowManagerEx mgr = ToolWindowManagerEx.getInstanceEx(project);
    ToolWindowEx toolWindow = (ToolWindowEx) mgr.getToolWindow(id);
    setSelected(toolWindow, state);
}
Also used : Project(com.intellij.openapi.project.Project) ToolWindowEx(com.intellij.openapi.wm.ex.ToolWindowEx) 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