Search in sources :

Example 1 with ErrorTreeView

use of com.intellij.util.ui.ErrorTreeView in project intellij-community by JetBrains.

the class ExecutionHelper method removeContents.

private static void removeContents(@Nullable final Content notToRemove, @NotNull final Project myProject, @NotNull final String tabDisplayName) {
    MessageView messageView = ServiceManager.getService(myProject, MessageView.class);
    Content[] contents = messageView.getContentManager().getContents();
    for (Content content : contents) {
        LOG.assertTrue(content != null);
        if (content.isPinned())
            continue;
        if (tabDisplayName.equals(content.getDisplayName()) && content != notToRemove) {
            ErrorTreeView listErrorView = (ErrorTreeView) content.getComponent();
            if (listErrorView != null) {
                if (messageView.getContentManager().removeContent(content, true)) {
                    content.release();
                }
            }
        }
    }
}
Also used : MessageView(com.intellij.ui.content.MessageView) Content(com.intellij.ui.content.Content) ErrorTreeView(com.intellij.util.ui.ErrorTreeView)

Example 2 with ErrorTreeView

use of com.intellij.util.ui.ErrorTreeView in project intellij-community by JetBrains.

the class CvsOperationExecutor method showErrors.

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<>();
        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);
            }
        }
    }
}
Also used : VcsException(com.intellij.openapi.vcs.VcsException) ArrayList(java.util.ArrayList) ErrorTreeView(com.intellij.util.ui.ErrorTreeView)

Example 3 with ErrorTreeView

use of com.intellij.util.ui.ErrorTreeView in project intellij-community by JetBrains.

the class TestErrorViewAction method actionPerformed.

public void actionPerformed(AnActionEvent e) {
    Project project = e.getProject();
    if (project == null) {
        return;
    }
    final ErrorTreeView view = createView(project);
    openView(project, view.getComponent());
    myMillis = 0L;
    myMessageCount = 0;
    new Thread("test error view") {

        public void run() {
            for (int idx = 0; idx < MESSAGE_COUNT; idx++) {
                addMessage(view, new String[] { "This is a warning test message" + idx + " line1", "This is a warning test message" + idx + " line2" }, MessageCategory.WARNING);
            }
            while (getMessageCount() < MESSAGE_COUNT) {
                try {
                    Thread.sleep(100);
                } catch (InterruptedException e1) {
                    e1.printStackTrace();
                }
            }
            String statistics = "Duration = " + myMillis;
            addMessage(view, new String[] { statistics }, MessageCategory.STATISTICS);
            System.out.println(statistics);
            while (getMessageCount() < MESSAGE_COUNT + 1) {
                try {
                    Thread.sleep(100);
                } catch (InterruptedException e1) {
                    e1.printStackTrace();
                }
            }
            System.out.println("Expected " + (MESSAGE_COUNT + 1) + " messages;");
            view.dispose();
        }
    }.start();
}
Also used : Project(com.intellij.openapi.project.Project) ErrorTreeView(com.intellij.util.ui.ErrorTreeView)

Example 4 with ErrorTreeView

use of com.intellij.util.ui.ErrorTreeView in project intellij-community by JetBrains.

the class AbstractVcsHelperImpl method removeContents.

protected void removeContents(Content notToRemove, final String tabDisplayName) {
    MessageView messageView = MessageView.SERVICE.getInstance(myProject);
    Content[] contents = messageView.getContentManager().getContents();
    for (Content content : contents) {
        LOG.assertTrue(content != null);
        if (content.isPinned())
            continue;
        if (tabDisplayName.equals(content.getDisplayName()) && content != notToRemove) {
            ErrorTreeView listErrorView = (ErrorTreeView) content.getComponent();
            if (listErrorView != null) {
                if (messageView.getContentManager().removeContent(content, true)) {
                    content.release();
                }
            }
        }
    }
}
Also used : MessageView(com.intellij.ui.content.MessageView) Content(com.intellij.ui.content.Content) ErrorTreeView(com.intellij.util.ui.ErrorTreeView)

Aggregations

ErrorTreeView (com.intellij.util.ui.ErrorTreeView)4 Content (com.intellij.ui.content.Content)2 MessageView (com.intellij.ui.content.MessageView)2 Project (com.intellij.openapi.project.Project)1 VcsException (com.intellij.openapi.vcs.VcsException)1 ArrayList (java.util.ArrayList)1