Java 类com.intellij.util.ui.MessageCategory 实例源码

项目:intellij-ce-playground    文件:HotSwapProgressImpl.java   
public void finished() {
  super.finished();

  final List<String> errors = getMessages(MessageCategory.ERROR);
  final List<String> warnings = getMessages(MessageCategory.WARNING);
  if (!errors.isEmpty()) {
    NOTIFICATION_GROUP.createNotification(DebuggerBundle.message("status.hot.swap.completed.with.errors"), buildMessage(errors),
                                                            NotificationType.ERROR, null).notify(getProject());
  }
  else if (!warnings.isEmpty()){
    NOTIFICATION_GROUP.createNotification(DebuggerBundle.message("status.hot.swap.completed.with.warnings"),
                                          buildMessage(warnings), NotificationType.WARNING, null).notify(getProject());
  }
  else if (!myMessages.isEmpty()){
    List<String> messages = new ArrayList<String>();
    for (int category : myMessages.keys()) {
      messages.addAll(getMessages(category));
    }
    NOTIFICATION_GROUP.createNotification(buildMessage(messages), NotificationType.INFORMATION).notify(getProject());
  }
}
项目:intellij-ce-playground    文件:ReloadClassesWorker.java   
private void reportProblem(final String qualifiedName, @Nullable Exception ex) {
  String reason = null;
  if (ex != null)  {
    reason = ex.getLocalizedMessage();
  }
  if (reason == null || reason.length() == 0) {
    reason = DebuggerBundle.message("error.io.error");
  }
  final StringBuilder buf = StringBuilderSpinAllocator.alloc();
  try {
    buf.append(qualifiedName).append(" : ").append(reason);
    myProgress.addMessage(myDebuggerSession, MessageCategory.ERROR, buf.toString());
  }
  finally {
    StringBuilderSpinAllocator.dispose(buf);
  }
}
项目:intellij-ce-playground    文件:CompilerTask.java   
public 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;
}
项目:intellij-ce-playground    文件:GradleTasksExecutor.java   
private static int translateMessageKind(@NotNull Message.Kind kind) {
  switch (kind) {
    case INFO:
      return MessageCategory.INFORMATION;
    case WARNING:
      return MessageCategory.WARNING;
    case ERROR:
      return MessageCategory.ERROR;
    case STATISTICS:
      return MessageCategory.STATISTICS;
    case SIMPLE:
      return MessageCategory.SIMPLE;
    default:
      LOG.info("Unknown message kind: " + kind);
      return 0;
  }
}
项目:tools-idea    文件:HotSwapProgressImpl.java   
public void finished() {
  super.finished();

  final List<String> errors = getMessages(MessageCategory.ERROR);
  final List<String> warnings = getMessages(MessageCategory.WARNING);
  if (!errors.isEmpty()) {
    NOTIFICATION_GROUP.createNotification(DebuggerBundle.message("status.hot.swap.completed.with.errors"), buildMessage(errors),
                                                            NotificationType.ERROR, null).notify(getProject());
  }
  else if (!warnings.isEmpty()){
    NOTIFICATION_GROUP.createNotification(DebuggerBundle.message("status.hot.swap.completed.with.warnings"),
                                          buildMessage(warnings), NotificationType.WARNING, null).notify(getProject());
  }
  else if (!myMessages.isEmpty()){
    List<String> messages = new ArrayList<String>();
    for (int category : myMessages.keys()) {
      messages.addAll(getMessages(category));
    }
    NOTIFICATION_GROUP.createNotification(buildMessage(messages), NotificationType.INFORMATION).notify(getProject());
  }
}
项目:tools-idea    文件:ReloadClassesWorker.java   
private void reportProblem(final String qualifiedName, @Nullable Exception ex) {
  String reason = null;
  if (ex != null)  {
    reason = ex.getLocalizedMessage();
  }
  if (reason == null || reason.length() == 0) {
    reason = DebuggerBundle.message("error.io.error");
  }
  final StringBuilder buf = StringBuilderSpinAllocator.alloc();
  try {
    buf.append(qualifiedName).append(" : ").append(reason);
    myProgress.addMessage(myDebuggerSession, MessageCategory.ERROR, buf.toString());
  }
  finally {
    StringBuilderSpinAllocator.dispose(buf);
  }
}
项目:tools-idea    文件:CompilerTask.java   
public 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;
}
项目:tools-idea    文件:StdErrorReporter.java   
public void processError(final SAXParseException ex, final ValidateXmlActionHandler.ProblemType problemType) {
  if (LOG.isDebugEnabled()) {
    String error = myHandler.buildMessageString(ex);
    LOG.debug("enter: processError(error='" + error + "')");
  }

  myErrorsDetected = true;

  if (!ApplicationManager.getApplication().isUnitTestMode()) {
    SwingUtilities.invokeLater(
        new Runnable() {
          public void run() {
            final VirtualFile file = myHandler.getFile(ex.getPublicId(), ex.getSystemId());
            myErrorsView.addMessage(
                problemType == ValidateXmlActionHandler.ProblemType.WARNING ? MessageCategory.WARNING : MessageCategory.ERROR,
                new String[]{ex.getLocalizedMessage()},
                file,
                ex.getLineNumber() - 1,
                ex.getColumnNumber() - 1,
                null
            );
          }
        }
    );
  }
}
项目:intellij-haxe    文件:HaxeDebugRunner.java   
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());
        }
    });
}
项目:consulo    文件:CompilerTask.java   
public 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;
}
项目:consulo-xml    文件:StdErrorReporter.java   
public void processError(final SAXParseException ex, final ValidateXmlActionHandler.ProblemType problemType) {
  if (LOG.isDebugEnabled()) {
    String error = myHandler.buildMessageString(ex);
    LOG.debug("enter: processError(error='" + error + "')");
  }

  myErrorsDetected = true;

  if (!ApplicationManager.getApplication().isUnitTestMode()) {
    SwingUtilities.invokeLater(
      new Runnable() {
        public void run() {
          final VirtualFile file = myHandler.getFile(ex.getPublicId(), ex.getSystemId());
          myErrorsView.addMessage(
            problemType == ValidateXmlActionHandler.ProblemType.WARNING ? MessageCategory.WARNING : MessageCategory.ERROR,
            new String[]{ex.getLocalizedMessage()},
            file,
            ex.getLineNumber() - 1,
            ex.getColumnNumber() - 1,
            null
          );
        }
      }
    );
  }
}
项目:intellij-ce-playground    文件:ReloadClassesWorker.java   
private void processException(Throwable e) {
  if (e.getMessage() != null) {
    myProgress.addMessage(myDebuggerSession, MessageCategory.ERROR, e.getMessage());
  }

  if (e instanceof ProcessCanceledException) {
    myProgress.addMessage(myDebuggerSession, MessageCategory.INFORMATION, DebuggerBundle.message("error.operation.canceled"));
    return;
  }

  if (e instanceof UnsupportedOperationException) {
    myProgress.addMessage(myDebuggerSession, MessageCategory.ERROR, DebuggerBundle.message("error.operation.not.supported.by.vm"));
  }
  else if (e instanceof NoClassDefFoundError) {
    myProgress.addMessage(myDebuggerSession, MessageCategory.ERROR, DebuggerBundle.message("error.class.def.not.found", e.getLocalizedMessage()));
  }
  else if (e instanceof VerifyError) {
    myProgress.addMessage(myDebuggerSession, MessageCategory.ERROR, DebuggerBundle.message("error.verification.error", e.getLocalizedMessage()));
  }
  else if (e instanceof UnsupportedClassVersionError) {
    myProgress.addMessage(myDebuggerSession, MessageCategory.ERROR, DebuggerBundle.message("error.unsupported.class.version", e.getLocalizedMessage()));
  }
  else if (e instanceof ClassFormatError) {
    myProgress.addMessage(myDebuggerSession, MessageCategory.ERROR, DebuggerBundle.message("error.class.format.error", e.getLocalizedMessage()));
  }
  else if (e instanceof ClassCircularityError) {
    myProgress.addMessage(myDebuggerSession, MessageCategory.ERROR, DebuggerBundle.message("error.class.circularity.error", e.getLocalizedMessage()));
  }
  else {
    myProgress.addMessage(
      myDebuggerSession, MessageCategory.ERROR,
      DebuggerBundle.message("error.exception.while.reloading", e.getClass().getName(), e.getLocalizedMessage())
    );
  }
}
项目:intellij-ce-playground    文件:AbstractVcsHelperImpl.java   
private static int getErrorCategory(VcsException exception) {
  if (exception.isWarning()) {
    return MessageCategory.WARNING;
  }
  else {
    return MessageCategory.ERROR;
  }
}
项目:intellij-ce-playground    文件:StdErrorReporter.java   
@Override
public void processError(final SAXParseException ex, final ValidateXmlActionHandler.ProblemType problemType) {
  if (LOG.isDebugEnabled()) {
    String error = myHandler.buildMessageString(ex);
    LOG.debug("enter: processError(error='" + error + "')");
  }

  myErrorsDetected = true;

  if (!ApplicationManager.getApplication().isUnitTestMode()) {
    SwingUtilities.invokeLater(
        new Runnable() {
          @Override
          public void run() {
            final VirtualFile file = myHandler.getProblemFile(ex);
            myErrorsView.addMessage(
                problemType == ValidateXmlActionHandler.ProblemType.WARNING ? MessageCategory.WARNING : MessageCategory.ERROR,
                new String[]{ex.getLocalizedMessage()},
                file,
                ex.getLineNumber() - 1,
                ex.getColumnNumber() - 1,
                null
            );
          }
        }
    );
  }
}
项目:intellij-ce-playground    文件:GradleTasksExecutor.java   
private void add(@NotNull Message message, @Nullable Navigatable navigatable) {
  synchronized (myMessageViewLock) {
    if (myErrorTreeView != null && !getNotNullProject().isDisposed()) {
      Message.Kind messageKind = message.getKind();
      int type = translateMessageKind(messageKind);
      LinkAwareMessageData messageData = prepareMessage(message);
      if (navigatable == null) {
        VirtualFile file = findFileFrom(message);
        myErrorTreeView.addMessage(type,
                                   messageData.textLines,
                                   file,
                                   message.getLineNumber() - 1,
                                   message.getColumn() - 1,
                                   messageData.hyperlinkListener);
      }
      else {
        myErrorTreeView.addMessage(type, messageData.textLines, null, navigatable, null, null, messageData.hyperlinkListener);
      }

      boolean autoActivate = !myMessagesAutoActivated && type == MessageCategory.ERROR;
      if (autoActivate) {
        myMessagesAutoActivated = true;
        activateMessageView();
      }
    }
  }
}
项目:intellij-ce-playground    文件:CvsOperationExecutor.java   
protected void showErrors(final CvsHandler handler, final CvsTabbedWindow tabbedWindow) {
  final List<VcsException> errors = handler.getErrorsExceptAborted();
  if (!myShowErrors || myIsQuietOperation) return;
  if (tabbedWindow == null) {
    if (errors.isEmpty()) return;
    final List<String> messages = new ArrayList<String>();
    for (VcsException error : errors) {
      if (! StringUtil.isEmptyOrSpaces(error.getMessage())) {
        messages.add(error.getMessage());
      }
    }
    final String errorMessage = StringUtil.join(messages, "\n");
    Messages.showErrorDialog(errorMessage, "CVS Error");
    return;
  }
  if (!errors.isEmpty()) {
    ErrorTreeView errorTreeView = tabbedWindow.getErrorsTreeView();
    for (final VcsException exception : errors) {
      final String groupName = DateFormatUtil.formatDateTime(System.currentTimeMillis()) + ' ' + handler.getTitle();
      if (exception.isWarning()) {
        errorTreeView.addMessage(MessageCategory.WARNING, exception.getMessages(), groupName, NonNavigatable.INSTANCE,
                                 null, null, exception);
      } else {
        errorTreeView.addMessage(MessageCategory.ERROR, exception.getMessages(), groupName, NonNavigatable.INSTANCE,
                                 null, null, exception);
      }
    }
  }
}
项目:intellij    文件:BlazeProblemsView.java   
private static int translateCategory(IssueOutput.Category category) {
  switch (category) {
    case ERROR:
      return MessageCategory.ERROR;
    case WARNING:
      return MessageCategory.WARNING;
    case STATISTICS:
      return MessageCategory.STATISTICS;
    case INFORMATION:
      return MessageCategory.INFORMATION;
    default:
      logger.error("Unknown message category: " + category);
      return 0;
  }
}
项目:intellij    文件:BlazeHotSwapManager.java   
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");
  }
}
项目:js-graphql-intellij-plugin    文件:JSGraphQLLanguageToolWindowManager.java   
private static void logErrorsImpl(NewErrorTreeViewPanel errorTreeViewPanel, List<JSGraphQLErrorResult> list) {
    errorTreeViewPanel.getErrorViewStructure().clear();
    for (JSGraphQLErrorResult compilerResult : list) {
        String path = compilerResult.myFileAbsoluteSystemDependPath;
        VirtualFile file = null;
        if (path != null) {
            file = LocalFileSystem.getInstance().findFileByPath(FileUtil.toSystemIndependentName(path));
        }
        int category = "warning".equalsIgnoreCase(compilerResult.myCategory) ? MessageCategory.WARNING : MessageCategory.ERROR;
        errorTreeViewPanel.addMessage(category, new String[]{compilerResult.myErrorText}, file, compilerResult.myLine, compilerResult.myColumn, null);
    }
    errorTreeViewPanel.updateTree();
}
项目:consulo-unity3d    文件:Unity3dConsoleToolWindowService.java   
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);
            }
        }
    });
}
项目:consulo-unity3d    文件:UnityDebugProcess.java   
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;
                }
            }
        });
    }
}
项目:tools-idea    文件:ReloadClassesWorker.java   
private void processException(Throwable e) {
  if (e.getMessage() != null) {
    myProgress.addMessage(myDebuggerSession, MessageCategory.ERROR, e.getMessage());
  }

  if (e instanceof ProcessCanceledException) {
    myProgress.addMessage(myDebuggerSession, MessageCategory.INFORMATION, DebuggerBundle.message("error.operation.canceled"));
    return;
  }

  if (e instanceof UnsupportedOperationException) {
    myProgress.addMessage(myDebuggerSession, MessageCategory.ERROR, DebuggerBundle.message("error.operation.not.supported.by.vm"));
  }
  else if (e instanceof NoClassDefFoundError) {
    myProgress.addMessage(myDebuggerSession, MessageCategory.ERROR, DebuggerBundle.message("error.class.def.not.found", e.getLocalizedMessage()));
  }
  else if (e instanceof VerifyError) {
    myProgress.addMessage(myDebuggerSession, MessageCategory.ERROR, DebuggerBundle.message("error.verification.error", e.getLocalizedMessage()));
  }
  else if (e instanceof UnsupportedClassVersionError) {
    myProgress.addMessage(myDebuggerSession, MessageCategory.ERROR, DebuggerBundle.message("error.unsupported.class.version", e.getLocalizedMessage()));
  }
  else if (e instanceof ClassFormatError) {
    myProgress.addMessage(myDebuggerSession, MessageCategory.ERROR, DebuggerBundle.message("error.class.format.error", e.getLocalizedMessage()));
  }
  else if (e instanceof ClassCircularityError) {
    myProgress.addMessage(myDebuggerSession, MessageCategory.ERROR, DebuggerBundle.message("error.class.circularity.error", e.getLocalizedMessage()));
  }
  else {
    myProgress.addMessage(
      myDebuggerSession, MessageCategory.ERROR,
      DebuggerBundle.message("error.exception.while.reloading", e.getClass().getName(), e.getLocalizedMessage())
    );
  }
}
项目:tools-idea    文件:AbstractVcsHelperImpl.java   
private static int getErrorCategory(VcsException exception) {
  if (exception.isWarning()) {
    return MessageCategory.WARNING;
  }
  else {
    return MessageCategory.ERROR;
  }
}
项目:tools-idea    文件:CvsOperationExecutor.java   
protected void showErrors(final CvsHandler handler, final CvsTabbedWindow tabbedWindow) {
  final List<VcsException> errors = handler.getErrorsExceptAborted();
  if (!myShowErrors || myIsQuietOperation) return;
  if (tabbedWindow == null) {
    if (errors.isEmpty()) return;
    final List<String> messages = new ArrayList<String>();
    for (VcsException error : errors) {
      if (! StringUtil.isEmptyOrSpaces(error.getMessage())) {
        messages.add(error.getMessage());
      }
    }
    final String errorMessage = StringUtil.join(messages, "\n");
    Messages.showErrorDialog(errorMessage, "CVS Error");
    return;
  }
  if (errors.isEmpty()) {
    tabbedWindow.hideErrors();
  }
  else {
    ErrorTreeView errorTreeView = tabbedWindow.getErrorsTreeView();
    for (final VcsException exception : errors) {
      final String groupName = DateFormatUtil.formatDateTime(System.currentTimeMillis()) + ' ' + handler.getTitle();
      if (exception.isWarning()) {
        errorTreeView.addMessage(MessageCategory.WARNING, exception.getMessages(), groupName, DummyNavigatable.INSTANCE,
                                 null, null, exception);
      } else {
        errorTreeView.addMessage(MessageCategory.ERROR, exception.getMessages(), groupName, DummyNavigatable.INSTANCE,
                                 null, null, exception);
      }
    }
    tabbedWindow.ensureVisible(myProject);
  }
}
项目:consulo    文件:AbstractVcsHelperImpl.java   
private static int getErrorCategory(VcsException exception) {
  if (exception.isWarning()) {
    return MessageCategory.WARNING;
  }
  else {
    return MessageCategory.ERROR;
  }
}
项目:consulo-java    文件:HotSwapProgressImpl.java   
@Override
public void finished()
{
    super.finished();

    final List<String> errors = getMessages(MessageCategory.ERROR);
    final List<String> warnings = getMessages(MessageCategory.WARNING);
    if(!errors.isEmpty())
    {
        NOTIFICATION_GROUP.createNotification(DebuggerBundle.message("status.hot.swap.completed.with.errors"), buildMessage(errors),
                NotificationType.ERROR, null).notify(getProject());
    }
    else if(!warnings.isEmpty())
    {
        NOTIFICATION_GROUP.createNotification(DebuggerBundle.message("status.hot.swap.completed.with.warnings"), buildMessage(warnings),
                NotificationType.WARNING, null).notify(getProject());
    }
    else if(!myMessages.isEmpty())
    {
        List<String> messages = new ArrayList<>();
        for(int category : myMessages.keys())
        {
            messages.addAll(getMessages(category));
        }
        NOTIFICATION_GROUP.createNotification(buildMessage(messages), NotificationType.INFORMATION).notify(getProject());
    }
}
项目:consulo-java    文件:ReloadClassesWorker.java   
private void reportProblem(final String qualifiedName, @Nullable Exception ex)
{
    String reason = null;
    if(ex != null)
    {
        reason = ex.getLocalizedMessage();
    }
    if(reason == null || reason.length() == 0)
    {
        reason = DebuggerBundle.message("error.io.error");
    }
    final StringBuilder buf = new StringBuilder();
    buf.append(qualifiedName).append(" : ").append(reason);
    myProgress.addMessage(myDebuggerSession, MessageCategory.ERROR, buf.toString());
}
项目:intellij-ce-playground    文件:CodeSmellDetectorImpl.java   
@Override
public void showCodeSmellErrors(@NotNull 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);
        }

      }
    }
  });

}
项目:intellij-ce-playground    文件:ExecutionHelper.java   
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);
  }

  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) {
        Messages.showErrorDialog(stdOutTitle + "\n" + (stdout != null ? stdout : "<empty>") + "\n" + stderrTitle + "\n"
                                 + (stderr != null ? stderr : "<empty>"), "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, NonNavigatable.INSTANCE, 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, NonNavigatable.INSTANCE, 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);
      }
    }
  });
}
项目:consulo-unity3d    文件:UnityLogPostHandlerRequest.java   
@MagicConstant(valuesFromClass = MessageCategory.class)
public int getMessageCategory()
{
    return ObjectUtil.notNull(ourTypeMap.get(type), MessageCategory.INFORMATION);
}
项目:tools-idea    文件:CodeSmellDetectorImpl.java   
@Override
public void showCodeSmellErrors(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);
        }

      }
    }
  });

}
项目:tools-idea    文件:ExecutionHelper.java   
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);
  }

  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);
      }
    }
  });
}
项目:consulo    文件:CodeSmellDetectorImpl.java   
@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);
        }

      }
    }
  });

}
项目:consulo    文件:ExecutionHelper.java   
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);
      }
    }
  });
}
项目:consulo-java    文件:ReloadClassesWorker.java   
private void processException(Throwable e)
{
    if(e.getMessage() != null)
    {
        myProgress.addMessage(myDebuggerSession, MessageCategory.ERROR, e.getMessage());
    }

    if(e instanceof ProcessCanceledException)
    {
        myProgress.addMessage(myDebuggerSession, MessageCategory.INFORMATION, DebuggerBundle.message("error.operation.canceled"));
        return;
    }

    if(e instanceof UnsupportedOperationException)
    {
        myProgress.addMessage(myDebuggerSession, MessageCategory.ERROR, DebuggerBundle.message("error.operation.not.supported.by.vm"));
    }
    else if(e instanceof NoClassDefFoundError)
    {
        myProgress.addMessage(myDebuggerSession, MessageCategory.ERROR, DebuggerBundle.message("error.class.def.not.found", e.getLocalizedMessage()));
    }
    else if(e instanceof VerifyError)
    {
        myProgress.addMessage(myDebuggerSession, MessageCategory.ERROR, DebuggerBundle.message("error.verification.error", e.getLocalizedMessage()));
    }
    else if(e instanceof UnsupportedClassVersionError)
    {
        myProgress.addMessage(myDebuggerSession, MessageCategory.ERROR, DebuggerBundle.message("error.unsupported.class.version", e.getLocalizedMessage()));
    }
    else if(e instanceof ClassFormatError)
    {
        myProgress.addMessage(myDebuggerSession, MessageCategory.ERROR, DebuggerBundle.message("error.class.format.error", e.getLocalizedMessage()));
    }
    else if(e instanceof ClassCircularityError)
    {
        myProgress.addMessage(myDebuggerSession, MessageCategory.ERROR, DebuggerBundle.message("error.class.circularity.error", e.getLocalizedMessage()));
    }
    else
    {
        myProgress.addMessage(myDebuggerSession, MessageCategory.ERROR, DebuggerBundle.message("error.exception.while.reloading", e.getClass().getName(), e.getLocalizedMessage()));
    }
}