Java Code Examples for com.intellij.openapi.wm.ToolWindowManager#getToolWindow()
The following examples show how to use
com.intellij.openapi.wm.ToolWindowManager#getToolWindow() .
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: FreelineUtil.java From freeline with BSD 3-Clause "New" or "Revised" License | 7 votes |
private static void processConsole(Project project, ProcessHandler processHandler) { ConsoleView consoleView = FreeUIManager.getInstance(project).getConsoleView(project); consoleView.clear(); consoleView.attachToProcess(processHandler); ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project); ToolWindow toolWindow; toolWindow = toolWindowManager.getToolWindow(TOOL_ID); // if already exist tool window then show it if (toolWindow != null) { toolWindow.show(null); return; } toolWindow = toolWindowManager.registerToolWindow(TOOL_ID, true, ToolWindowAnchor.BOTTOM); toolWindow.setTitle("free...."); toolWindow.setStripeTitle("Free Console"); toolWindow.setShowStripeButton(true); toolWindow.setIcon(PluginIcons.ICON_TOOL_WINDOW); toolWindow.getContentManager().addContent(new ContentImpl(consoleView.getComponent(), "Build", true)); toolWindow.show(null); }
Example 2
Source File: LafManagerImpl.java From consulo with Apache License 2.0 | 6 votes |
public static void updateToolWindows() { for (Project project : ProjectManager.getInstance().getOpenProjects()) { final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project); for (String id : toolWindowManager.getToolWindowIds()) { final ToolWindow toolWindow = toolWindowManager.getToolWindow(id); for (Content content : toolWindow.getContentManager().getContents()) { final JComponent component = content.getComponent(); if (component != null) { IJSwingUtilities.updateComponentTreeUI(component); } } final JComponent c = toolWindow.getComponent(); if (c != null) { IJSwingUtilities.updateComponentTreeUI(c); } } } }
Example 3
Source File: ToggleDockModeAction.java From consulo with Apache License 2.0 | 6 votes |
public void update(AnActionEvent event) { super.update(event); Presentation presentation = event.getPresentation(); Project project = event.getData(CommonDataKeys.PROJECT); if (project == null) { presentation.setEnabled(false); return; } ToolWindowManager mgr = ToolWindowManager.getInstance(project); String id = mgr.getActiveToolWindowId(); if (id == null) { presentation.setEnabled(false); return; } ToolWindow toolWindow = mgr.getToolWindow(id); presentation.setEnabled(toolWindow.isAvailable() && ToolWindowType.FLOATING != toolWindow.getType()); }
Example 4
Source File: ToggleDockModeAction.java From consulo with Apache License 2.0 | 6 votes |
public void setSelected(AnActionEvent event, boolean flag) { Project project = event.getData(CommonDataKeys.PROJECT); if (project == null) { return; } ToolWindowManager windowManager = ToolWindowManager.getInstance(project); String id = windowManager.getActiveToolWindowId(); if (id == null) { return; } ToolWindow toolWindow = windowManager.getToolWindow(id); ToolWindowType type = toolWindow.getType(); if (ToolWindowType.DOCKED == type) { toolWindow.setType(ToolWindowType.SLIDING, null); } else if (ToolWindowType.SLIDING == type) { toolWindow.setType(ToolWindowType.DOCKED, null); } }
Example 5
Source File: TestToolWindow.java From intellij-reference-diagram with Apache License 2.0 | 6 votes |
private static TestToolWindow createViewTab(Project project, PsiElement baseElement) { final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project); ToolWindow toolWindow = toolWindowManager.getToolWindow(TOOL_WINDOW_ID); if (toolWindow == null) { toolWindow = toolWindowManager.registerToolWindow(TOOL_WINDOW_ID, true, ToolWindowAnchor.BOTTOM); } final TestToolWindow view = new TestToolWindow(project); ToolWindow finalToolWindow = toolWindow; toolWindow.activate(() -> { final String text = SymbolPresentationUtil.getSymbolPresentableText(baseElement); final ContentImpl content = new ContentImpl(view, "to " + text, true); finalToolWindow.getContentManager().addContent(content); finalToolWindow.getContentManager().setSelectedContent(content, true); }); return view; }
Example 6
Source File: YiiStormSettingsPage.java From yiistorm with MIT License | 6 votes |
@Override public void apply() throws ConfigurationException { PropertiesComponent properties = PropertiesComponent.getInstance(project); properties.setValue("enableYiiStorm", String.valueOf(enableYiiStorm.isSelected())); properties.setValue("themeName", themeNameField.getText()); properties.setValue("langName", langField.getText()); properties.setValue("yiicFile", yiicFileField.getText()); // properties.setValue("yiiConfigPath", yiiConfigPath.getText()); // properties.setValue("yiiLitePath", yiiLitePath.getText()); // properties.setValue("useYiiCompleter", String.valueOf(useYiiCompleter.isSelected())); // properties.setValue("useYiiMigrations", String.valueOf(useMigrationsCheckbox.isSelected())); final ToolWindowManager manager = ToolWindowManager.getInstance(project); final ToolWindow tw = manager.getToolWindow("Migrations"); if (tw != null) { tw.setAvailable(MigrationsCondition.makeCondition(project), null); } /* if (properties.getBoolean("useYiiCompleter", false)) { YiiStormProjectComponent.getInstance(project).loadConfigParser(); } else { YiiStormProjectComponent.getInstance(project).clearConfigParser(); } */ }
Example 7
Source File: RemoteServersViewImpl.java From consulo with Apache License 2.0 | 6 votes |
@Override public void showDeployment(@Nonnull final ServerConnection<?> connection, @Nonnull final String deploymentName) { ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(myProject); final ToolWindow toolWindow = toolWindowManager.getToolWindow(ServersToolWindowManager.ID); if (toolWindow != null) { toolWindowManager.invokeLater(new Runnable() { @Override public void run() { ServersToolWindowContent component = getServersViewComponent(toolWindow); if (component != null) { component.select(connection, deploymentName); } } }); } }
Example 8
Source File: BaseToolWindowToggleAction.java From consulo with Apache License 2.0 | 6 votes |
@Override public final void update(AnActionEvent e) { super.update(e); Presentation presentation = e.getPresentation(); Project project = e.getData(CommonDataKeys.PROJECT); if (project == null) { presentation.setEnabled(false); return; } ToolWindowManager mgr = ToolWindowManager.getInstance(project); String id = mgr.getActiveToolWindowId(); if (id == null) { presentation.setEnabled(false); return; } ToolWindow window = mgr.getToolWindow(id); if (window == null) { presentation.setEnabled(false); return; } update(window, presentation); }
Example 9
Source File: ExternalSystemUtil.java From consulo with Apache License 2.0 | 6 votes |
public static void ensureToolWindowInitialized(@Nonnull Project project, @Nonnull ProjectSystemId externalSystemId) { ToolWindowManager manager = ToolWindowManager.getInstance(project); if (!(manager instanceof ToolWindowManagerEx)) { return; } ToolWindowManagerEx managerEx = (ToolWindowManagerEx)manager; String id = externalSystemId.getReadableName(); ToolWindow window = manager.getToolWindow(id); if (window != null) { return; } for (final ToolWindowEP bean : ToolWindowEP.EP_NAME.getExtensionList()) { if (id.equals(bean.id)) { managerEx.initToolWindow(bean); } } }
Example 10
Source File: ShowContentAction.java From consulo with Apache License 2.0 | 6 votes |
@Nullable private ToolWindow getWindow(AnActionEvent event) { if (myWindow != null) return myWindow; Project project = event.getData(CommonDataKeys.PROJECT); if (project == null) return null; ToolWindowManager manager = ToolWindowManager.getInstance(project); final ToolWindow window = manager.getToolWindow(manager.getActiveToolWindowId()); if (window == null) return null; final Component context = event.getData(PlatformDataKeys.CONTEXT_COMPONENT); if (context == null) return null; return SwingUtilities.isDescendingFrom(window.getComponent(), context) ? window : null; }
Example 11
Source File: ExternalToolWindowManager.java From consulo with Apache License 2.0 | 5 votes |
@javax.annotation.Nullable private static ToolWindow getToolWindow(@Nonnull Project project, @Nonnull ProjectSystemId externalSystemId) { final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project); if (toolWindowManager == null) { return null; } ToolWindow result = toolWindowManager.getToolWindow(externalSystemId.getReadableName()); if (result instanceof ToolWindowBase) { ((ToolWindowBase)result).ensureContentInitialized(); } return result; }
Example 12
Source File: ProjectViewSelectInTarget.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull public static ActionCallback select(@Nonnull Project project, final Object toSelect, @Nullable final String viewId, @Nullable final String subviewId, final VirtualFile virtualFile, final boolean requestFocus) { final ActionCallback result = new ActionCallback(); final ProjectView projectView = ProjectView.getInstance(project); if (ApplicationManager.getApplication().isUnitTestMode()) { AbstractProjectViewPane pane = projectView.getProjectViewPaneById(ProjectViewPane.ID); pane.select(toSelect, virtualFile, requestFocus); return result; } ToolWindowManager windowManager = ToolWindowManager.getInstance(project); final ToolWindow projectViewToolWindow = windowManager.getToolWindow(ToolWindowId.PROJECT_VIEW); final Runnable runnable = () -> { Runnable r = () -> projectView.selectCB(toSelect, virtualFile, requestFocus).notify(result); projectView.changeViewCB(ObjectUtils.chooseNotNull(viewId, ProjectViewPane.ID), subviewId).doWhenProcessed(r); }; if (requestFocus) { projectViewToolWindow.activate(runnable, true); } else { projectViewToolWindow.show(runnable); } return result; }
Example 13
Source File: ShowChangesViewAction.java From consulo with Apache License 2.0 | 5 votes |
protected void actionPerformed(VcsContext e) { if (e.getProject() == null) return; final ToolWindowManager manager = ToolWindowManager.getInstance(e.getProject()); if (manager != null) { final ToolWindow window = manager.getToolWindow(ChangesViewContentManager.TOOLWINDOW_ID); if (window != null) { window.show(null); } } }
Example 14
Source File: ToolWindowLayout.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull public List<String> getVisibleIdsOn(@Nonnull ToolWindowAnchor anchor, @Nonnull ToolWindowManager manager) { List<String> ids = new ArrayList<>(); for (WindowInfoImpl each : getAllInfos(anchor)) { final ToolWindow window = manager.getToolWindow(each.getId()); if (window == null) continue; if (window.isAvailable() || UISettings.getInstance().ALWAYS_SHOW_WINDOW_BUTTONS) { ids.add(each.getId()); } } return ids; }
Example 15
Source File: ExternalSystemUtil.java From consulo with Apache License 2.0 | 5 votes |
@Nullable public static ToolWindow ensureToolWindowContentInitialized(@Nonnull Project project, @Nonnull ProjectSystemId externalSystemId) { final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project); if (toolWindowManager == null) return null; final ToolWindow toolWindow = toolWindowManager.getToolWindow(externalSystemId.getReadableName()); if (toolWindow == null) return null; if (toolWindow instanceof ToolWindowBase) { ((ToolWindowBase)toolWindow).ensureContentInitialized(); } return toolWindow; }
Example 16
Source File: ConsoleToolWindow.java From jetbrains-plugin-graph-database-support with Apache License 2.0 | 5 votes |
public static void ensureOpen(Project project) { ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project); ToolWindow toolWindow = toolWindowManager.getToolWindow(GraphConstants.ToolWindow.CONSOLE_TOOL_WINDOW); if (!toolWindow.isActive()) { toolWindow.activate(null, false); return; } if (!toolWindow.isVisible()) { toolWindow.show(null); } }
Example 17
Source File: FlutterPerformanceView.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Activate the tool window. */ private void activateToolWindow() { final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(myProject); final ToolWindow toolWindow = toolWindowManager.getToolWindow(TOOL_WINDOW_ID); if (toolWindow.isVisible()) { return; } toolWindow.show(null); }
Example 18
Source File: FlutterPerformanceView.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Activate the tool window. */ private void activateToolWindow() { final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(myProject); final ToolWindow toolWindow = toolWindowManager.getToolWindow(TOOL_WINDOW_ID); if (toolWindow.isVisible()) { return; } toolWindow.show(null); }
Example 19
Source File: RNUtil.java From react-native-console with BSD 3-Clause "New" or "Revised" License | 4 votes |
private static void processConsole(Project project, ProcessHandler processHandler) { ConsoleView consoleView = TextConsoleBuilderFactory.getInstance().createBuilder(project).getConsole(); consoleView.clear(); consoleView.attachToProcess(processHandler); processHandler.startNotify(); ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project); ToolWindow toolWindow; toolWindow = toolWindowManager.getToolWindow(TOOL_ID); // if already exist tool window then show it if (toolWindow != null) { toolWindow.show(null);// TODO add more tabs here? return; } toolWindow = toolWindowManager.registerToolWindow(TOOL_ID, true, ToolWindowAnchor.BOTTOM); toolWindow.setTitle("Android...."); toolWindow.setStripeTitle("Android Console"); toolWindow.setShowStripeButton(true); toolWindow.setIcon(PluginIcons.ICON_TOOL_WINDOW); JPanel panel = new JPanel((LayoutManager) new BorderLayout()); panel.add((Component) consoleView.getComponent(), "Center"); // Create toolbars DefaultActionGroup toolbarActions = new DefaultActionGroup(); AnAction[] consoleActions = consoleView.createConsoleActions();// 必须在 consoleView.getComponent() 调用后组件真正初始化之后调用 toolbarActions.addAll((AnAction[]) Arrays.copyOf(consoleActions, consoleActions.length)); toolbarActions.add((AnAction) new StopProcessAction("Stop process", "Stop process", processHandler)); // toolbarActions.add((AnAction) new CloseAction(defaultExecutor, runDescriptor, project)); ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("unknown", (ActionGroup) toolbarActions, false); toolbar.setTargetComponent(consoleView.getComponent()); panel.add((Component) toolbar.getComponent(), "West"); ContentImpl consoleContent = new ContentImpl(panel, "Build", false); consoleContent.setManager(toolWindow.getContentManager()); toolbarActions.add(new CloseTabAction(consoleContent)); // addAdditionalConsoleEditorActions(consoleView, consoleContent); // consoleComponent.setActions(); toolWindow.getContentManager().addContent(consoleContent); toolWindow.getContentManager().addContent(new ContentImpl(new JButton("Test"), "Build2", false)); toolWindow.show(null); }
Example 20
Source File: StructureViewWrapperImpl.java From consulo with Apache License 2.0 | 4 votes |
protected boolean isStructureViewShowing() { ToolWindowManager windowManager = ToolWindowManager.getInstance(myProject); ToolWindow toolWindow = windowManager.getToolWindow(ToolWindowId.STRUCTURE_VIEW); // it means that window is registered return toolWindow != null && toolWindow.isVisible(); }