Java Code Examples for com.intellij.openapi.wm.ex.ToolWindowManagerEx#getActiveToolWindowId()
The following examples show how to use
com.intellij.openapi.wm.ex.ToolWindowManagerEx#getActiveToolWindowId() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HideSideWindowsAction.java From consulo with Apache License 2.0 | 6 votes |
public void update(AnActionEvent event) { Presentation presentation = event.getPresentation(); Project project = event.getData(CommonDataKeys.PROJECT); if (project == null) { presentation.setEnabled(false); return; } ToolWindowManagerEx toolWindowManager = ToolWindowManagerEx.getInstanceEx(project); String id = toolWindowManager.getActiveToolWindowId(); if (id != null) { presentation.setEnabled(true); return; } id = toolWindowManager.getLastActiveToolWindowId(); if (id == null) { presentation.setEnabled(false); return; } ToolWindowEx toolWindow = (ToolWindowEx)toolWindowManager.getToolWindow(id); presentation.setEnabled(toolWindow.isVisible()); }
Example 2
Source File: HideToolWindowAction.java From consulo with Apache License 2.0 | 6 votes |
public void update(AnActionEvent event) { Presentation presentation = event.getPresentation(); Project project = event.getData(CommonDataKeys.PROJECT); if (project == null) { presentation.setEnabled(false); return; } ToolWindowManagerEx toolWindowManager = ToolWindowManagerEx.getInstanceEx(project); String id = toolWindowManager.getActiveToolWindowId(); if (id != null) { presentation.setEnabled(true); return; } id = toolWindowManager.getLastActiveToolWindowId(); if (id == null) { presentation.setEnabled(false); return; } ToolWindow toolWindow = toolWindowManager.getToolWindow(id); presentation.setEnabled(toolWindow.isVisible()); }
Example 3
Source File: ContentManagerUtil.java From consulo with Apache License 2.0 | 5 votes |
/** * This is utility method. It returns <code>ContentManager</code> from the current context. */ public static ContentManager getContentManagerFromContext(DataContext dataContext, boolean requiresVisibleToolWindow){ Project project = dataContext.getData(CommonDataKeys.PROJECT); if (project == null) { return null; } ToolWindowManagerEx mgr=ToolWindowManagerEx.getInstanceEx(project); String id = mgr.getActiveToolWindowId(); if (id == null) { if(mgr.isEditorComponentActive()){ id = mgr.getLastActiveToolWindowId(); } } if(id == null){ return null; } ToolWindowEx toolWindow = (ToolWindowEx)mgr.getToolWindow(id); if (requiresVisibleToolWindow && !toolWindow.isVisible()) { return null; } final ContentManager fromContext = dataContext.getData(PlatformDataKeys.CONTENT_MANAGER); if (fromContext != null) return fromContext; return toolWindow != null ? toolWindow.getContentManager() : null; }
Example 4
Source File: HideSideWindowsAction.java From consulo with Apache License 2.0 | 5 votes |
public void actionPerformed(AnActionEvent e) { Project project = e.getData(CommonDataKeys.PROJECT); if (project == null) { return; } ToolWindowManagerEx toolWindowManager = ToolWindowManagerEx.getInstanceEx(project); String id = toolWindowManager.getActiveToolWindowId(); if (id == null) { id = toolWindowManager.getLastActiveToolWindowId(); } toolWindowManager.hideToolWindow(id, true); }
Example 5
Source File: HideToolWindowAction.java From consulo with Apache License 2.0 | 5 votes |
public void actionPerformed(AnActionEvent e) { Project project = e.getData(CommonDataKeys.PROJECT); if (project == null) { return; } ToolWindowManagerEx toolWindowManager = ToolWindowManagerEx.getInstanceEx(project); String id = toolWindowManager.getActiveToolWindowId(); if (id == null) { id = toolWindowManager.getLastActiveToolWindowId(); } toolWindowManager.getToolWindow(id).hide(null); }