com.intellij.util.ui.MessageCategory Java Examples
The following examples show how to use
com.intellij.util.ui.MessageCategory.
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: BlazeProblemsView.java From intellij with Apache License 2.0 | 6 votes |
private static int translateCategory(IssueOutput.Category category) { switch (category) { case ERROR: return MessageCategory.ERROR; case WARNING: return MessageCategory.WARNING; case NOTE: return MessageCategory.NOTE; case STATISTICS: return MessageCategory.STATISTICS; case INFORMATION: return MessageCategory.INFORMATION; default: logger.error("Unknown message category: " + category); return 0; } }
Example #2
Source File: HaxeDebugRunner.java From intellij-haxe with Apache License 2.0 | 6 votes |
private static void showInfoMessage(final Project project, final String message, final String title) { ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { if (false /* TODO: Get display behavior from the plugin configuration. */) { // Put up a modal dialog. Folks don't like this much, so this should not be the default. Messages.showInfoMessage(project, message, title); } else { // Show the error on the status bar. StatusBarUtil.setStatusBarInfo(project, message); // XXX: Should we log this, too?? } // Add the output to the "Problems" pane. ProblemsView.SERVICE.getInstance(project).addMessage(MessageCategory.INFORMATION, new String[]{message}, null, null, null, null, UUID.randomUUID()); } }); }
Example #3
Source File: CompileContextImpl.java From consulo with Apache License 2.0 | 6 votes |
private static int translateCategory(CompilerMessageCategory category) { if (CompilerMessageCategory.ERROR.equals(category)) { return MessageCategory.ERROR; } if (CompilerMessageCategory.WARNING.equals(category)) { return MessageCategory.WARNING; } if (CompilerMessageCategory.STATISTICS.equals(category)) { return MessageCategory.STATISTICS; } if (CompilerMessageCategory.INFORMATION.equals(category)) { return MessageCategory.INFORMATION; } LOG.error("Unknown message category: " + category); return 0; }
Example #4
Source File: ShowAllProblemsInProjectAction.java From CppTools with Apache License 2.0 | 6 votes |
public void addMessage(final MessageType type, final int start, final int end, final String message, Fix... fixes) { if (type == MessageType.Intention || type == MessageType.Info) return; final VirtualFile analizedFile = currentFile; SwingUtilities.invokeLater(new Runnable() { public void run() { view.addMessage( type == MessageType.Error ? MessageCategory.ERROR : type == MessageType.Warning ? MessageCategory.WARNING: MessageCategory.INFORMATION, new String[] { message }, analizedFile.getPresentableUrl(), new OpenFileDescriptor(project, analizedFile,start), NewErrorTreeViewPanel.createExportPrefix(start), NewErrorTreeViewPanel.createRendererPrefix(start,end), analizedFile ); } }); }
Example #5
Source File: BlazeHotSwapManager.java From intellij with Apache License 2.0 | 5 votes |
private static void processException( Throwable e, DebuggerSession session, HotSwapProgress progress) { if (e.getMessage() != null) { progress.addMessage(session, MessageCategory.ERROR, e.getMessage()); } if (e instanceof ProcessCanceledException) { progress.addMessage( session, MessageCategory.INFORMATION, DebuggerBundle.message("error.operation.canceled")); } else { logger.warn(e); progress.addMessage(session, MessageCategory.ERROR, "Error reloading classes"); } }
Example #6
Source File: Unity3dConsoleToolWindowService.java From consulo-unity3d with Apache License 2.0 | 5 votes |
private void process(Collection<UnityLogPostHandlerRequest> list) { UIUtil.invokeLaterIfNeeded(() -> { NewErrorTreeViewPanel panel = getOrInitPanel(); WolfTheProblemSolver solver = WolfTheProblemSolver.getInstance(myProject); VirtualFileManager virtualFileManager = VirtualFileManager.getInstance(); for(UnityLogPostHandlerRequest request : list) { DotNetCompilerMessage message = UnityLogParser.extractFileInfo(myProject, request.condition); int value = request.getMessageCategory(); if(message != null) { VirtualFile fileByUrl = message.getFileUrl() == null ? null : virtualFileManager.findFileByUrl(message.getFileUrl()); if(fileByUrl != null && value == MessageCategory.ERROR) { Problem problem = solver.convertToProblem(fileByUrl, message.getLine(), message.getColumn(), new String[]{message.getMessage()}); if(problem != null) { solver.reportProblems(fileByUrl, Collections.singletonList(problem)); } } panel.addMessage(value, new String[]{message.getMessage()}, fileByUrl, message.getLine() - 1, message.getColumn(), null); } else { panel.addMessage(value, new String[]{ request.condition, request.stackTrace }, null, -1, -1, null); } } }); }
Example #7
Source File: UnityDebugProcess.java From consulo-unity3d with Apache License 2.0 | 5 votes |
public UnityDebugProcess(XDebugSession session, RunProfile runProfile, DebugConnectionInfo debugConnectionInfo, ConsoleView consoleView, boolean insideEditor) { super(session, runProfile, debugConnectionInfo); myConsoleView = consoleView; if(insideEditor) { myMessageBusConnection = Unity3dConsoleManager.getInstance().registerProcessor(session.getProject(), list -> { ConsoleView view = session.getConsoleView(); if(view == null) { return; } for(UnityLogPostHandlerRequest request : list) { switch(request.getMessageCategory()) { case MessageCategory.ERROR: print(request.condition, request.stackTrace, view, ConsoleViewContentType.ERROR_OUTPUT); break; default: print(request.condition, request.stackTrace, view, ConsoleViewContentType.NORMAL_OUTPUT); break; } } }); } }
Example #8
Source File: AbstractVcsHelperImpl.java From consulo with Apache License 2.0 | 5 votes |
private static int getErrorCategory(VcsException exception) { if (exception.isWarning()) { return MessageCategory.WARNING; } else { return MessageCategory.ERROR; } }
Example #9
Source File: UnityLogPostHandlerRequest.java From consulo-unity3d with Apache License 2.0 | 4 votes |
@MagicConstant(valuesFromClass = MessageCategory.class) public int getMessageCategory() { return ObjectUtil.notNull(ourTypeMap.get(type), MessageCategory.INFORMATION); }
Example #10
Source File: CodeSmellDetectorImpl.java From consulo with Apache License 2.0 | 4 votes |
@Override public void showCodeSmellErrors(@Nonnull final List<CodeSmellInfo> smellList) { Collections.sort(smellList, new Comparator<CodeSmellInfo>() { @Override public int compare(final CodeSmellInfo o1, final CodeSmellInfo o2) { return o1.getTextRange().getStartOffset() - o2.getTextRange().getStartOffset(); } }); ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { if (myProject.isDisposed()) return; if (smellList.isEmpty()) { return; } final VcsErrorViewPanel errorTreeView = new VcsErrorViewPanel(myProject); AbstractVcsHelperImpl helper = (AbstractVcsHelperImpl)AbstractVcsHelper.getInstance(myProject); helper.openMessagesView(errorTreeView, VcsBundle.message("code.smells.error.messages.tab.name")); FileDocumentManager fileManager = FileDocumentManager.getInstance(); for (CodeSmellInfo smellInfo : smellList) { final VirtualFile file = fileManager.getFile(smellInfo.getDocument()); final OpenFileDescriptor navigatable = new OpenFileDescriptor(myProject, file, smellInfo.getStartLine(), smellInfo.getStartColumn()); final String exportPrefix = NewErrorTreeViewPanel.createExportPrefix(smellInfo.getStartLine() + 1); final String rendererPrefix = NewErrorTreeViewPanel.createRendererPrefix(smellInfo.getStartLine() + 1, smellInfo.getStartColumn() + 1); if (smellInfo.getSeverity() == HighlightSeverity.ERROR) { errorTreeView.addMessage(MessageCategory.ERROR, new String[]{smellInfo.getDescription()}, file.getPresentableUrl(), navigatable, exportPrefix, rendererPrefix, null); } else {//if (smellInfo.getSeverity() == HighlightSeverity.WARNING) { errorTreeView.addMessage(MessageCategory.WARNING, new String[]{smellInfo.getDescription()}, file.getPresentableUrl(), navigatable, exportPrefix, rendererPrefix, null); } } } }); }
Example #11
Source File: ExecutionHelper.java From consulo with Apache License 2.0 | 4 votes |
public static void showOutput(@Nonnull final Project myProject, @Nonnull final ProcessOutput output, @Nonnull 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); } 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); } } }); }