Search in sources :

Example 1 with MessageView

use of com.intellij.ui.content.MessageView 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 MessageView

use of com.intellij.ui.content.MessageView in project intellij-community by JetBrains.

the class ExecutionHelper method openMessagesView.

private static void openMessagesView(@NotNull final ErrorViewPanel errorTreeView, @NotNull final Project myProject, @NotNull final String tabDisplayName) {
    CommandProcessor commandProcessor = CommandProcessor.getInstance();
    commandProcessor.executeCommand(myProject, () -> {
        final MessageView messageView = ServiceManager.getService(myProject, MessageView.class);
        final Content content = ContentFactory.SERVICE.getInstance().createContent(errorTreeView, tabDisplayName, true);
        messageView.getContentManager().addContent(content);
        Disposer.register(content, errorTreeView);
        messageView.getContentManager().setSelectedContent(content);
        removeContents(content, myProject, tabDisplayName);
    }, "Open message view", null);
}
Also used : MessageView(com.intellij.ui.content.MessageView) Content(com.intellij.ui.content.Content) CommandProcessor(com.intellij.openapi.command.CommandProcessor)

Example 3 with MessageView

use of com.intellij.ui.content.MessageView in project intellij-community by JetBrains.

the class ExternalSystemNotificationManager method findContent.

@Nullable
private Content findContent(@NotNull Pair<NotificationSource, ProjectSystemId> contentIdPair, @NotNull String contentDisplayName) {
    Content targetContent = null;
    final MessageView messageView = ServiceManager.getService(myProject, MessageView.class);
    for (Content content : messageView.getContentManager().getContents()) {
        if (contentIdPair.equals(content.getUserData(CONTENT_ID_KEY)) && StringUtil.equals(content.getDisplayName(), contentDisplayName) && !content.isPinned()) {
            targetContent = content;
        }
    }
    return targetContent;
}
Also used : MessageView(com.intellij.ui.content.MessageView) Content(com.intellij.ui.content.Content) Nullable(org.jetbrains.annotations.Nullable)

Example 4 with MessageView

use of com.intellij.ui.content.MessageView in project intellij-community by JetBrains.

the class NewErrorTreeViewPanel method close.

public void close() {
    MessageView messageView = MessageView.SERVICE.getInstance(myProject);
    Content content = messageView.getContentManager().getContent(this);
    if (content != null) {
        messageView.getContentManager().removeContent(content, true);
    }
}
Also used : MessageView(com.intellij.ui.content.MessageView) Content(com.intellij.ui.content.Content)

Example 5 with MessageView

use of com.intellij.ui.content.MessageView in project intellij-community by JetBrains.

the class TestErrorViewAction method openView.

protected void openView(Project project, JComponent component) {
    final MessageView messageView = MessageView.SERVICE.getInstance(project);
    final Content content = ContentFactory.SERVICE.getInstance().createContent(component, getContentName(), true);
    messageView.getContentManager().addContent(content);
    messageView.getContentManager().setSelectedContent(content);
    ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.MESSAGES_WINDOW);
    if (toolWindow != null) {
        toolWindow.activate(null);
    }
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) MessageView(com.intellij.ui.content.MessageView) Content(com.intellij.ui.content.Content)

Aggregations

Content (com.intellij.ui.content.Content)10 MessageView (com.intellij.ui.content.MessageView)10 ToolWindow (com.intellij.openapi.wm.ToolWindow)4 CommandProcessor (com.intellij.openapi.command.CommandProcessor)2 ProjectSystemId (com.intellij.openapi.externalSystem.model.ProjectSystemId)2 ErrorTreeView (com.intellij.util.ui.ErrorTreeView)2 Notification (com.intellij.notification.Notification)1 NotNull (org.jetbrains.annotations.NotNull)1 Nullable (org.jetbrains.annotations.Nullable)1