List of usage examples for com.intellij.openapi.wm ToolWindow isActive
boolean isActive();
From source file:com.boxysystems.libraryfinder.view.intellij.IntelliJLibraryFinderView.java
License:Apache License
private void showResultsPanelInToolWindow() { ToolWindow toolWindow = ToolWindowManager.getInstance(plugin.getProject()) .getToolWindow(Constants.PLUGIN_ID); toolWindow.setAvailable(true, null); if (toolWindow.isActive()) { toolWindow.show(resultsPanel);/*from ww w. j av a2s .c om*/ } else { toolWindow.activate(resultsPanel); } }
From source file:com.intellij.ide.actions.ResizeToolWindowAction.java
License:Apache License
@Override public final void update(AnActionEvent e) { Project project = CommonDataKeys.PROJECT.getData(e.getDataContext()); if (project == null) { setDisabled(e);/*from ww w. j a v a2 s .c o m*/ return; } if (!myListenerInstalled) { myListenerInstalled = true; ProjectManager.getInstance().addProjectManagerListener(new ProjectManagerAdapter() { @Override public void projectClosed(Project project) { setDisabled(null); } }); } Component owner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); if (owner == null) { setDisabled(e); return; } final Window windowAncestor = SwingUtilities.getWindowAncestor(owner); if (!(windowAncestor instanceof IdeFrame) || windowAncestor instanceof IdeFrame.Child) { setDisabled(e); return; } ToolWindowManager mgr = ToolWindowManager.getInstance(project); ToolWindow window = myToolWindow; if (window != null || mgr.getActiveToolWindowId() != null) { if (window == null) { window = mgr.getToolWindow(mgr.getActiveToolWindowId()); } if (window == null || !window.isAvailable() || !window.isVisible() || window.getType() == ToolWindowType.FLOATING || !window.isActive()) { setDisabled(e); return; } update(e, window, mgr); if (e.getPresentation().isEnabled()) { myLastWindow = window; myLastManager = mgr; } else { setDisabled(e); } } else { setDisabled(e); } }
From source file:com.intellij.usages.impl.UsageViewManagerImpl.java
License:Apache License
void showToolWindow(boolean activateWindow) { ToolWindow toolWindow = ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.FIND); toolWindow.show(null);//from ww w. j a v a2 s. co m if (activateWindow && !toolWindow.isActive()) { toolWindow.activate(null); } }
From source file:gradleplug.messages.MessagesProjectComponent.java
License:Apache License
public void addToTab(final String tabTitle, final Message... messages) { UIUtil.invokeLaterIfNeeded(new Runnable() { public void run() { ContentManager contentManager = messageView.getContentManager(); Content content = contentManager.findContent(tabTitle); if (content == null) { MessagesPanel result = new MessagesPanel(project); content = contentFactory.createContent(result, tabTitle, true); contentManager.addContent(content); }// w w w . j a va 2 s . c o m MessagesPanel messagesPanel = (MessagesPanel) content.getComponent(); for (Message message : messages) { messagesPanel.addMessage(message.getType().getInternalType(), message.getMessage()); } if (!contentManager.isSelected(content)) { contentManager.setSelectedContent(content); } ToolWindow toolWindow = toolWindowManager.getToolWindow(ToolWindowId.MESSAGES_WINDOW); if (toolWindow != null && !toolWindow.isActive()) { toolWindow.activate(null); } } }); }
From source file:gradleplug.messages.MessagesProjectComponent.java
License:Apache License
private void showTab(String tabTitle, Message... messages) { MessagesPanel result = new MessagesPanel(project); for (Message message : messages) { result.addMessage(message.getType().getInternalType(), message.getMessage()); }//from w w w. j a va2 s . c o m Content content = contentFactory.createContent(result, tabTitle, true); ContentManager contentManager = messageView.getContentManager(); contentManager.addContent(content); contentManager.setSelectedContent(content); ToolWindow toolWindow = toolWindowManager.getToolWindow(ToolWindowId.MESSAGES_WINDOW); if (toolWindow != null && !toolWindow.isActive()) { toolWindow.activate(null); } }
From source file:ivyplug.ui.messages.MessagesProjectComponent.java
License:Apache License
public void addToTab(final String tabTitle, final Message... messages) { SwingUtilities.invokeLater(new Runnable() { public void run() { ContentManager contentManager = messageView.getContentManager(); Content content = contentManager.findContent(tabTitle); if (content == null) { MessagesPanel result = new MessagesPanel(project); content = contentFactory.createContent(result, tabTitle, true); contentManager.addContent(content); }/* w ww . j av a 2 s . c o m*/ MessagesPanel messagesPanel = (MessagesPanel) content.getComponent(); for (Message message : messages) { messagesPanel.addMessage(message.getType().getInternalType(), message.getMessage()); } if (!contentManager.isSelected(content)) contentManager.setSelectedContent(content); ToolWindow toolWindow = toolWindowManager.getToolWindow(ToolWindowId.MESSAGES_WINDOW); if (toolWindow != null && !toolWindow.isActive()) { toolWindow.activate(null); } } }); }
From source file:me.adaptive.ide.codewok.project.generator.CodewokProjectGenerator.java
License:Apache License
@Override public void generateProject(@NotNull final Project project, @NotNull final VirtualFile baseDir, @Nullable Object settings, @NotNull final Module module) { if (ApplicationManager.getApplication().isDispatchThread()) { final ConsoleView consoleView = TextConsoleBuilderFactory.getInstance().createBuilder(project) .getConsole();//from w ww .j a v a2s. co m final MessageView messageView = MessageView.SERVICE.getInstance(project); messageView.runWhenInitialized(new Runnable() { @Override public void run() { Content messageContent = ContentFactory.SERVICE.getInstance() .createContent(consoleView.getComponent(), "CodeWok Generator", false); messageView.getContentManager().addContent(messageContent); messageView.getContentManager().requestFocus(messageContent, true); ToolWindow messageToolWindow = ToolWindowManager.getInstance(project) .getToolWindow(ToolWindowId.MESSAGES_WINDOW); if (!messageToolWindow.isActive() || !messageToolWindow.isVisible()) { messageToolWindow.activate(null, true); } } }); ProgressManager.getInstance() .run(new Task.Backgroundable(project, "Generating CodeWok project", false) { @Override public NotificationInfo getNotificationInfo() { return new NotificationInfo("CodeWokGenerator", "CodeWok Project", "Generation Finished"); } @Override public void run(@NotNull final ProgressIndicator progressIndicator) { progressIndicator.setIndeterminate(true); progressIndicator.setText("Creating the project files"); progressIndicator.pushState(); GeneratorRunner runner = new GeneratorRunner(project.getName(), getAdaptiveVersion(), typescriptSupport, getBoilerplate(), platforms); runner.setSkipInstall(true); runner.setSkipServer(true); runner.generate(project, consoleView); progressIndicator.setText("Running NPM install"); NpmCommandExecutor npmCommandExecutor = new NpmCommandExecutor(project.getBasePath()); processSentToBackground(); npmCommandExecutor.runInstall(consoleView); baseDir.refresh(true, true); progressIndicator.setText("Running Bower Install"); BowerCommandExecutor bowerCommandExecutor = new BowerCommandExecutor(); bowerCommandExecutor.runInstall(project.getBasePath(), consoleView); if (launchEmulator) { BaseComponent component = project.getComponent("Adaptive Nibble"); if (component instanceof ProjectComponent) { ((ProjectComponent) component).projectOpened(); } } } }); } }
From source file:net.orfjackal.sbt.plugin.SbtConsole.java
License:Open Source License
public final void ensureAttachedToToolWindow(ToolWindow window, boolean activate) { if (!isOpen.compareAndSet(false, true)) { return;/* w w w . j a v a2s . c o m*/ } attachToToolWindow(window); if (activate) { if (!window.isActive()) { window.activate(null, false); } } }
From source file:org.jetbrains.idea.maven.project.MavenConsoleImpl.java
License:Apache License
private void ensureAttachedToToolWindow() { if (!isOpen.compareAndSet(false, true)) return;/*from w w w . j a v a2 s .c o m*/ MavenUtil.invokeLater(myProject, new Runnable() { public void run() { MessageView messageView = MessageView.SERVICE.getInstance(myProject); Content content = ContentFactory.SERVICE.getInstance().createContent(myConsoleView.getComponent(), myTitle, true); content.putUserData(CONSOLE_KEY, MavenConsoleImpl.this); messageView.getContentManager().addContent(content); messageView.getContentManager().setSelectedContent(content); // remove unused tabs for (Content each : messageView.getContentManager().getContents()) { if (each.isPinned()) continue; if (each == content) continue; MavenConsoleImpl console = each.getUserData(CONSOLE_KEY); if (console == null) continue; if (!myTitle.equals(console.myTitle)) continue; if (console.isFinished()) { messageView.getContentManager().removeContent(each, false); } } ToolWindow toolWindow = ToolWindowManager.getInstance(myProject) .getToolWindow(ToolWindowId.MESSAGES_WINDOW); if (!toolWindow.isActive()) { toolWindow.activate(null, false); } } }); }
From source file:org.twodividedbyzero.idea.findbugs.common.util.IdeaUtilImpl.java
License:Open Source License
public static void activateToolWindow(@NotNull final ToolWindow toolWindow) { if (!toolWindow.isActive() && toolWindow.isAvailable()) { toolWindow.show(null);//from ww w . jav a 2 s . c o m } }