List of usage examples for com.intellij.openapi.wm ToolWindow hide
void hide(@Nullable Runnable runnable);
From source file:com.android.tools.idea.memory.MemoryMonitorView.java
License:Apache License
public void close() { myMemorySampler.stop();/* w w w . j a v a 2 s. c o m*/ ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(myProject); ToolWindow toolWindow = toolWindowManager.getToolWindow(MemoryMonitorToolWindowFactory.ID); toolWindow.hide(null); }
From source file:com.atlassian.theplugin.idea.PluginToolWindow.java
License:Apache License
public static void showHidePluginWindow(AnActionEvent event) { ToolWindow tw = IdeaHelper.getToolWindow(IdeaHelper.getCurrentProject(event.getDataContext())); if (tw != null) { if (tw.isVisible()) { tw.hide(new Runnable() { public void run() { }/*from w w w .java 2 s. co m*/ }); } else { tw.show(new Runnable() { public void run() { } }); } } }
From source file:com.boxysystems.libraryfinder.view.intellij.actions.CloseWindowAction.java
License:Apache License
public void actionPerformed(AnActionEvent event) { Project project = (Project) event.getDataContext().getData(DataConstants.PROJECT); LibraryFinderPlugin plugin = LibraryFinderPlugin.instance(project); ToolWindow toolWindow = plugin.getToolWindow(); if (toolWindow != null) { toolWindow.hide(null); toolWindow.setAvailable(false, null); }/* w w w .j a va2s . com*/ }
From source file:com.eightbitmage.moonscript.util.MoonSystemUtil.java
License:Apache License
public static void clearConsoleToolWindow(@NotNull Project project) { final ToolWindowManager manager = ToolWindowManager.getInstance(project); ToolWindow toolWindow = manager.getToolWindow(toolWindowId); if (toolWindow == null) return;//from w w w . j a v a 2 s . c o m toolWindow.getContentManager().removeAllContents(false); toolWindow.hide(null); }
From source file:com.headwire.aem.tooling.intellij.communication.ContentResourceChangeListener.java
License:Apache License
private void executeMakeInUIThread(final VirtualFileEvent event) { if (project.isInitialized() && !project.isDisposed() && project.isOpen()) { final CompilerManager compilerManager = CompilerManager.getInstance(project); if (!compilerManager.isCompilationActive() && !compilerManager.isExcludedFromCompilation(event.getFile()) // && ) {/* w ww .jav a2s . co m*/ // Check first if there are no errors in the code CodeSmellDetector codeSmellDetector = CodeSmellDetector.getInstance(project); boolean isOk = true; if (codeSmellDetector != null) { List<CodeSmellInfo> codeSmellInfoList = codeSmellDetector .findCodeSmells(Arrays.asList(event.getFile())); for (CodeSmellInfo codeSmellInfo : codeSmellInfoList) { if (codeSmellInfo.getSeverity() == HighlightSeverity.ERROR) { isOk = false; break; } } } if (isOk) { // Changed file found in module. Make it. final ToolWindow tw = ToolWindowManager.getInstance(project) .getToolWindow(ToolWindowId.MESSAGES_WINDOW); final boolean isShown = tw != null && tw.isVisible(); compilerManager.compile(new VirtualFile[] { event.getFile() }, new CompileStatusNotification() { @Override public void finished(boolean b, int i, int i1, CompileContext compileContext) { if (tw != null && tw.isVisible()) { // Close / Hide the Build Message Window after we did the build if it wasn't shown if (!isShown) { tw.hide(null); } } } }); } else { MessageManager messageManager = ComponentProvider.getComponent(project, MessageManager.class); if (messageManager != null) { messageManager.sendErrorNotification("server.update.file.change.with.error", event.getFile()); } } } } }
From source file:com.headwire.aem.tooling.intellij.communication.ServerConnectionManager.java
License:Apache License
public void publishBundle(@NotNull final DataContext dataContext, final @NotNull Module module) { messageManager.sendInfoNotification("deploy.module.prepare", module); InputStream contents = null;// w w w .j a va2s .co m // Check if this is a OSGi Bundle final UnifiedModule unifiedModule = module.getUnifiedModule(); if (unifiedModule.isOSGiBundle()) { try { updateModuleStatus(module, ServerConfiguration.SynchronizationStatus.updating); boolean localBuildDoneSuccessfully = true; //AS TODO: This should be isBuildLocally instead as we can now build both with Maven or Locally if Facet is specified if (module.getParent().isBuildWithMaven() && module.getUnifiedModule().isMavenBased()) { localBuildDoneSuccessfully = false; List<String> goals = MavenDataKeys.MAVEN_GOALS.getData(dataContext); if (goals == null) { goals = new ArrayList<String>(); } if (goals.isEmpty()) { // goals.add("package"); // If a module depends on anoher Maven module then we need to have it installed into the local repo goals.add("install"); } messageManager.sendInfoNotification("deploy.module.maven.goals", goals); final MavenProjectsManager projectsManager = MavenActionUtil.getProjectsManager(dataContext); if (projectsManager == null) { messageManager.showAlert("Maven Failure", "Could not find Maven Project Manager, need to build manually"); } else { final ToolWindow tw = ToolWindowManager.getInstance(module.getProject()) .getToolWindow(ToolWindowId.RUN); final boolean isShown = tw != null && tw.isVisible(); String workingDirectory = unifiedModule.getModuleDirectory(); MavenExplicitProfiles explicitProfiles = projectsManager.getExplicitProfiles(); final MavenRunnerParameters params = new MavenRunnerParameters(true, workingDirectory, goals, explicitProfiles.getEnabledProfiles(), explicitProfiles.getDisabledProfiles()); // This Monitor is used to know when the Maven build is done RunExecutionMonitor rem = RunExecutionMonitor.getInstance(myProject); // We need to tell the Monitor that we are going to start a Maven Build so that the Countdown Latch // is ready rem.startMavenBuild(); try { ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { try { MavenRunConfigurationType.runConfiguration(module.getProject(), params, null); } catch (RuntimeException e) { // Ignore it String message = e.getMessage(); } if (isShown) { tw.hide(null); } } }, ModalityState.NON_MODAL); } catch (IllegalStateException e) { if (firstRun) { firstRun = false; messageManager.showAlert("deploy.module.maven.first.run.failure"); } } catch (RuntimeException e) { messageManager.sendDebugNotification("debug.maven.build.failed.unexpected", e); } // Now we can wait for the process to end switch (RunExecutionMonitor.getInstance(myProject).waitFor()) { case done: messageManager.sendInfoNotification("deploy.module.maven.done"); localBuildDoneSuccessfully = true; break; case timedOut: messageManager.sendInfoNotification("deploy.module.maven.timedout"); messageManager.showAlert("deploy.module.maven.timedout"); break; case interrupted: messageManager.sendInfoNotification("deploy.module.maven.interrupted"); messageManager.showAlert("deploy.module.maven.interrupted"); break; } } } else if (!module.getUnifiedModule().isMavenBased()) { // Compile the IntelliJ way final CompilerManager compilerManager = CompilerManager.getInstance(myProject); final CompileScope moduleScope = compilerManager .createModuleCompileScope(module.getUnifiedModule().getModule(), true); WaitableRunner<AtomicBoolean> runner = new WaitableRunner<AtomicBoolean>( new AtomicBoolean(false)) { @Override public void run() { compilerManager.make(moduleScope, new CompileStatusNotification() { public void finished(boolean aborted, int errors, int warnings, CompileContext compileContext) { getResponse().set(!aborted && errors == 0); } }); } }; runAndWait(runner); // final CountDownLatch waiter = new CountDownLatch(1); // final AtomicBoolean checker = new AtomicBoolean(false); // ApplicationManager.getApplication().invokeLater( // new Runnable() { // public void run() { // } // } // ); // try { // waiter.await(); // } catch(InterruptedException e) { // //AS TODO: Show Info Notification and Alert // } localBuildDoneSuccessfully = runner.getResponse().get(); } if (localBuildDoneSuccessfully) { File buildDirectory = new File(module.getUnifiedModule().getBuildDirectoryPath()); if (buildDirectory.exists() && buildDirectory.isDirectory()) { File buildFile = new File(buildDirectory, module.getUnifiedModule().getBuildFileName()); messageManager.sendDebugNotification("debug.build.file.name", buildFile.toURL()); if (buildFile.exists()) { //AS TODO: This looks like OSGi Symbolic Name to be used here EmbeddedArtifact bundle = new EmbeddedArtifact(module.getSymbolicName(), module.getVersion(), buildFile.toURL()); contents = bundle.openInputStream(); obtainSGiClient().installBundle(contents, bundle.getName()); module.setStatus(ServerConfiguration.SynchronizationStatus.upToDate); } else { messageManager.showAlertWithArguments("deploy.module.maven.missing.build.file", buildFile.getAbsolutePath()); } } updateModuleStatus(module, ServerConfiguration.SynchronizationStatus.upToDate); messageManager.sendInfoNotification("deploy.module.success", module); } } catch (MalformedURLException e) { module.setStatus(ServerConfiguration.SynchronizationStatus.failed); messageManager.sendErrorNotification("deploy.module.failed.bad.url", e); updateModuleStatus(module, ServerConfiguration.SynchronizationStatus.failed); } catch (OsgiClientException e) { module.setStatus(ServerConfiguration.SynchronizationStatus.failed); messageManager.sendErrorNotification("deploy.module.failed.client", e); updateModuleStatus(module, ServerConfiguration.SynchronizationStatus.failed); } catch (IOException e) { module.setStatus(ServerConfiguration.SynchronizationStatus.failed); messageManager.sendErrorNotification("deploy.module.failed.io", e); updateModuleStatus(module, ServerConfiguration.SynchronizationStatus.failed); } finally { IOUtils.closeQuietly(contents); } } else { messageManager.sendNotification("deploy.module.unsupported.maven.packaging", NotificationType.WARNING); } }
From source file:com.headwire.aem.tooling.intellij.console.ConsoleLog.java
License:Apache License
public static void toggleLog(@Nullable final Project project, @Nullable final Notification notification) { final ToolWindow eventLog = getLogWindow(project); if (eventLog != null) { if (!eventLog.isVisible()) { eventLog.activate(new Runnable() { @Override/*from w w w . j a v a2s . c o m*/ public void run() { if (notification == null) { return; } String contentName = getContentName(notification); Content content = eventLog.getContentManager().findContent(contentName); if (content != null) { eventLog.getContentManager().setSelectedContent(content); } } }, true); } else { eventLog.hide(null); } } }
From source file:com.intellij.execution.ui.RunContentManagerImpl.java
License:Apache License
@Override public void hideRunContent(@NotNull final Executor executor, final RunContentDescriptor descriptor) { ApplicationManager.getApplication().invokeLater(new Runnable() { @Override/* w ww .j a v a2 s. c o m*/ public void run() { ToolWindow toolWindow = ToolWindowManager.getInstance(myProject) .getToolWindow(executor.getToolWindowId()); if (toolWindow != null) { toolWindow.hide(null); } } }, myProject.getDisposed()); }
From source file:com.intellij.ide.actions.CloseActiveTabAction.java
License:Apache License
public void actionPerformed(AnActionEvent e) { ContentManager contentManager = ContentManagerUtil.getContentManagerFromContext(e.getDataContext(), true); boolean processed = false; if (contentManager != null && contentManager.canCloseContents()) { final Content selectedContent = contentManager.getSelectedContent(); if (selectedContent != null && selectedContent.isCloseable()) { contentManager.removeContent(selectedContent, true); processed = true;/* www . j a v a 2 s.co m*/ } } if (!processed && contentManager != null) { final DataContext context = DataManager.getInstance().getDataContext(contentManager.getComponent()); final ToolWindow tw = PlatformDataKeys.TOOL_WINDOW.getData(context); if (tw != null) { tw.hide(null); } } }
From source file:com.intellij.ide.actions.HideAllToolWindowsAction.java
License:Apache License
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();/*from w w w . j a v a2 s . co m*/ //toolWindowManager.activateEditorComponent(); String[] ids = toolWindowManager.getToolWindowIds(); boolean hasVisible = false; for (String id : ids) { ToolWindow toolWindow = toolWindowManager.getToolWindow(id); if (toolWindow.isVisible()) { toolWindow.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); } } }