List of usage examples for com.intellij.openapi.wm ToolWindowId MESSAGES_WINDOW
String MESSAGES_WINDOW
To view the source code for com.intellij.openapi.wm ToolWindowId MESSAGES_WINDOW.
Click Source Link
From source file:com.android.tools.idea.gradle.invoker.GradleTasksExecutor.java
License:Apache License
private void activateMessageView() { synchronized (myMessageViewLock) { if (myErrorTreeView != null) { ToolWindow window = getToolWindowManager().getToolWindow(ToolWindowId.MESSAGES_WINDOW); if (window != null) { window.activate(null, false); }/* www . j ava 2 s . c o m*/ } } }
From source file:com.android.tools.idea.tests.gui.framework.fixture.MessagesToolWindowFixture.java
License:Apache License
MessagesToolWindowFixture(@NotNull Project project, @NotNull Robot robot) {
super(ToolWindowId.MESSAGES_WINDOW, project, robot);
}
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()) // && ) {//from w ww . j ava2 s .c o 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.intellij.execution.ExecutionHelper.java
License:Apache License
public static void showExceptions(@NotNull final Project myProject, @NotNull final List<? extends Exception> errors, @NotNull final List<? extends Exception> warnings, @NotNull final String tabDisplayName, @Nullable final VirtualFile file) { if (ApplicationManager.getApplication().isUnitTestMode() && !errors.isEmpty()) { throw new RuntimeException(errors.get(0)); }/* w w w. ja v a 2s . c om*/ ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { if (myProject.isDisposed()) return; if (errors.isEmpty() && warnings.isEmpty()) { removeContents(null, myProject, tabDisplayName); return; } final ErrorViewPanel errorTreeView = new ErrorViewPanel(myProject); try { openMessagesView(errorTreeView, myProject, tabDisplayName); } catch (NullPointerException e) { final StringBuilder builder = new StringBuilder(); builder.append("Exceptions occurred:"); for (final Exception exception : errors) { builder.append("\n"); builder.append(exception.getMessage()); } builder.append("Warnings occurred:"); for (final Exception exception : warnings) { builder.append("\n"); builder.append(exception.getMessage()); } Messages.showErrorDialog(builder.toString(), "Execution Error"); return; } addMessages(MessageCategory.ERROR, errors, errorTreeView, file, "Unknown Error"); addMessages(MessageCategory.WARNING, warnings, errorTreeView, file, "Unknown Warning"); ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.MESSAGES_WINDOW).activate(null); } }); }
From source file:com.intellij.execution.ExecutionHelper.java
License:Apache License
public static void showOutput(@NotNull final Project myProject, @NotNull final ProcessOutput output, @NotNull final String tabDisplayName, @Nullable final VirtualFile file, final boolean activateWindow) { final String stdout = output.getStdout(); final String stderr = output.getStderr(); if (ApplicationManager.getApplication().isUnitTestMode() && !(stdout.isEmpty() || stderr.isEmpty())) { throw new RuntimeException("STDOUT:\n" + stdout + "\nSTDERR:\n" + stderr); }// ww w .j a v a2 s . c o m ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { if (myProject.isDisposed()) return; final String stdOutTitle = "[Stdout]:"; final String stderrTitle = "[Stderr]:"; final ErrorViewPanel errorTreeView = new ErrorViewPanel(myProject); try { openMessagesView(errorTreeView, myProject, tabDisplayName); } catch (NullPointerException e) { final StringBuilder builder = new StringBuilder(); builder.append(stdOutTitle).append("\n").append(stdout != null ? stdout : "<empty>") .append("\n"); builder.append(stderrTitle).append("\n").append(stderr != null ? stderr : "<empty>"); Messages.showErrorDialog(builder.toString(), "Process Output"); return; } if (!StringUtil.isEmpty(stdout)) { final String[] stdoutLines = StringUtil.splitByLines(stdout); if (stdoutLines.length > 0) { if (StringUtil.isEmpty(stderr)) { // Only stdout available errorTreeView.addMessage(MessageCategory.SIMPLE, stdoutLines, file, -1, -1, null); } else { // both stdout and stderr available, show as groups if (file == null) { errorTreeView.addMessage(MessageCategory.SIMPLE, stdoutLines, stdOutTitle, new FakeNavigatable(), null, null, null); } else { errorTreeView.addMessage(MessageCategory.SIMPLE, new String[] { stdOutTitle }, file, -1, -1, null); errorTreeView.addMessage(MessageCategory.SIMPLE, new String[] { "" }, file, -1, -1, null); errorTreeView.addMessage(MessageCategory.SIMPLE, stdoutLines, file, -1, -1, null); } } } } if (!StringUtil.isEmpty(stderr)) { final String[] stderrLines = StringUtil.splitByLines(stderr); if (stderrLines.length > 0) { if (file == null) { errorTreeView.addMessage(MessageCategory.SIMPLE, stderrLines, stderrTitle, new FakeNavigatable(), null, null, null); } else { errorTreeView.addMessage(MessageCategory.SIMPLE, new String[] { stderrTitle }, file, -1, -1, null); errorTreeView.addMessage(MessageCategory.SIMPLE, ArrayUtil.EMPTY_STRING_ARRAY, file, -1, -1, null); errorTreeView.addMessage(MessageCategory.SIMPLE, stderrLines, file, -1, -1, null); } } } errorTreeView.addMessage(MessageCategory.SIMPLE, new String[] { "Process finished with exit code " + output.getExitCode() }, null, -1, -1, null); if (activateWindow) { ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.MESSAGES_WINDOW) .activate(null); } } }); }
From source file:com.intellij.ide.errorTreeView.actions.TestErrorViewAction.java
License:Apache License
protected void openView(Project project, JComponent component) { final MessageView messageView = MessageView.SERVICE.getInstance(project); final Content content = ContentFactory.SERVICE.getInstance().createContent(component, getContentName(), true);// w ww.j ava2 s . c o m messageView.getContentManager().addContent(content); messageView.getContentManager().setSelectedContent(content); ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.MESSAGES_WINDOW); if (toolWindow != null) { toolWindow.activate(null); } }
From source file:com.intellij.lang.ant.config.execution.AntBuildMessageView.java
License:Apache License
/** * @return can be null if user cancelled operation */// ww w . j a v a 2s .com @Nullable public static AntBuildMessageView openBuildMessageView(Project project, AntBuildFileBase buildFile, String[] targets) { final VirtualFile antFile = buildFile.getVirtualFile(); if (!LOG.assertTrue(antFile != null)) { return null; } // check if there are running instances of the same build file MessageView ijMessageView = MessageView.SERVICE.getInstance(project); Content[] contents = ijMessageView.getContentManager().getContents(); for (Content content : contents) { if (content.isPinned()) { continue; } AntBuildMessageView buildMessageView = content.getUserData(KEY); if (buildMessageView == null) { continue; } if (!antFile.equals(buildMessageView.getBuildFile().getVirtualFile())) { continue; } if (buildMessageView.isStopped()) { ijMessageView.getContentManager().removeContent(content, true); continue; } int result = Messages.showYesNoCancelDialog( AntBundle.message("ant.is.active.terminate.confirmation.text"), AntBundle.message("starting.ant.build.dialog.title"), Messages.getQuestionIcon()); switch (result) { case 0: // yes buildMessageView.stopProcess(); ijMessageView.getContentManager().removeContent(content, true); continue; case 1: // no continue; default: // cancel return null; } } final AntBuildMessageView messageView = new AntBuildMessageView(project, buildFile, targets); String contentName = buildFile.getPresentableName(); contentName = BUILD_CONTENT_NAME + " (" + contentName + ")"; final Content content = ContentFactory.SERVICE.getInstance().createContent(messageView.getComponent(), contentName, true); content.putUserData(KEY, messageView); ijMessageView.getContentManager().addContent(content); ijMessageView.getContentManager().setSelectedContent(content); content.setDisposer(new Disposable() { @Override public void dispose() { Disposer.dispose(messageView.myAlarm); } }); new CloseListener(content, ijMessageView.getContentManager(), project); // Do not inline next two variabled. Seeking for NPE. ToolWindow messageToolWindow = ToolWindowManager.getInstance(project) .getToolWindow(ToolWindowId.MESSAGES_WINDOW); messageToolWindow.activate(null); return messageView; }
From source file:com.intellij.lang.ant.config.execution.ExecutionHandler.java
License:Apache License
private static void processRunningAnt(final ProgressIndicator progress, final AntProcessHandler handler, final AntBuildMessageView errorView, final AntBuildFile buildFile, final long startTime, final AntBuildListener antBuildListener) { final Project project = buildFile.getProject(); final StatusBar statusbar = WindowManager.getInstance().getStatusBar(project); if (statusbar != null) { statusbar.setInfo(AntBundle.message("ant.build.started.status.message")); }/*from w w w. j av a2 s .co m*/ final CheckCancelTask checkCancelTask = new CheckCancelTask(progress, handler); checkCancelTask.start(0); final OutputParser parser = OutputParser2.attachParser(project, handler, errorView, progress, buildFile); handler.addProcessListener(new ProcessAdapter() { public void processTerminated(ProcessEvent event) { final long buildTime = System.currentTimeMillis() - startTime; checkCancelTask.cancel(); parser.setStopped(true); final OutputPacketProcessor dispatcher = handler.getErr().getEventsDispatcher(); errorView.buildFinished(progress != null && progress.isCanceled(), buildTime, antBuildListener, dispatcher); ApplicationManager.getApplication().invokeLater(new Runnable() { public void run() { if (project.isDisposed()) { return; } errorView.removeProgressPanel(); ToolWindow toolWindow = ToolWindowManager.getInstance(project) .getToolWindow(ToolWindowId.MESSAGES_WINDOW); if (toolWindow != null) { // can be null if project is closed toolWindow.activate(null, false); } } }, ModalityState.NON_MODAL); } }); handler.startNotify(); }
From source file:com.intellij.plugins.haxe.compilation.HaxeCompilerUtil.java
License:Apache License
private static void openCompilerMessagesWindow(final CompileContext context) { // Force the compile window open. We should probably have a configuration button // on the compile gui page to force it open or not. if (!isHeadless()) { ApplicationManager.getApplication().invokeLater(new Runnable() { public void run() { // This was lifted from intellij-community/java/compiler/impl/src/com/intellij/compiler/progress/CompilerTask.java final ToolWindow tw = ToolWindowManager.getInstance(context.getProject()) .getToolWindow(ToolWindowId.MESSAGES_WINDOW); if (tw != null) { tw.activate(null, false); }/*from w w w. j a va2 s .co m*/ } }); } }
From source file:com.intellij.ui.content.impl.MessageViewImpl.java
License:Apache License
public MessageViewImpl(final Project project, final StartupManager startupManager, final ToolWindowManager toolWindowManager) { final Runnable runnable = new Runnable() { public void run() { myToolWindow = toolWindowManager.registerToolWindow(ToolWindowId.MESSAGES_WINDOW, true, ToolWindowAnchor.BOTTOM, project, true); myToolWindow.setIcon(AllIcons.Toolwindows.ToolWindowMessages); new ContentManagerWatcher(myToolWindow, getContentManager()); for (Runnable postponedRunnable : myPostponedRunnables) { postponedRunnable.run(); }//from w w w . j a v a2 s.c o m myPostponedRunnables.clear(); } }; if (project.isInitialized()) { runnable.run(); } else { startupManager.registerPostStartupActivity(new Runnable() { public void run() { runnable.run(); } }); } }