Java 类com.intellij.ui.content.MessageView 实例源码

项目:intellij-ce-playground    文件:AbstractVcsHelperImpl.java   
public void openMessagesView(final VcsErrorViewPanel errorTreeView, final String tabDisplayName) {
  CommandProcessor commandProcessor = CommandProcessor.getInstance();
  commandProcessor.executeCommand(myProject, new Runnable() {
    public void run() {
      final MessageView messageView = MessageView.SERVICE.getInstance(myProject);
      messageView.runWhenInitialized(new Runnable() {
        public void run() {
          final Content content =
            ContentFactory.SERVICE.getInstance().createContent(errorTreeView, tabDisplayName, true);
          messageView.getContentManager().addContent(content);
          Disposer.register(content, errorTreeView);
          messageView.getContentManager().setSelectedContent(content);
          removeContents(content, tabDisplayName);

          ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.MESSAGES_WINDOW).activate(null);
        }
      });
    }
  }, VcsBundle.message("command.name.open.error.message.view"), null);
}
项目:intellij-ce-playground    文件:AbstractVcsHelperImpl.java   
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();
        }
      }
    }
  }
}
项目:intellij-ce-playground    文件:ExecutionHelper.java   
private static void openMessagesView(@NotNull final ErrorViewPanel errorTreeView,
                                     @NotNull final Project myProject,
                                     @NotNull final String tabDisplayName) {
  CommandProcessor commandProcessor = CommandProcessor.getInstance();
  commandProcessor.executeCommand(myProject, new Runnable() {
    @Override
    public void run() {
      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);
}
项目:intellij-ce-playground    文件:ExecutionHelper.java   
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();
        }
      }
    }
  }
}
项目:tools-idea    文件:AbstractVcsHelperImpl.java   
public void openMessagesView(final VcsErrorViewPanel errorTreeView, final String tabDisplayName) {
  CommandProcessor commandProcessor = CommandProcessor.getInstance();
  commandProcessor.executeCommand(myProject, new Runnable() {
    public void run() {
      final MessageView messageView = MessageView.SERVICE.getInstance(myProject);
      messageView.runWhenInitialized(new Runnable() {
        public void run() {
          final Content content =
            ContentFactory.SERVICE.getInstance().createContent(errorTreeView, tabDisplayName, true);
          messageView.getContentManager().addContent(content);
          Disposer.register(content, errorTreeView);
          messageView.getContentManager().setSelectedContent(content);
          removeContents(content, tabDisplayName);

          ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.MESSAGES_WINDOW).activate(null);
        }
      });
    }
  }, VcsBundle.message("command.name.open.error.message.view"), null);
}
项目:tools-idea    文件:AbstractVcsHelperImpl.java   
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();
        }
      }
    }
  }
}
项目:tools-idea    文件:ExecutionHelper.java   
private static void openMessagesView(@NotNull final ErrorViewPanel errorTreeView,
                                     @NotNull final Project myProject,
                                     @NotNull final String tabDisplayName) {
  CommandProcessor commandProcessor = CommandProcessor.getInstance();
  commandProcessor.executeCommand(myProject, new Runnable() {
    @Override
    public void run() {
      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);
}
项目:tools-idea    文件:ExecutionHelper.java   
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();
        }
      }
    }
  }
}
项目:consulo    文件:AbstractVcsHelperImpl.java   
public void openMessagesView(final VcsErrorViewPanel errorTreeView, final String tabDisplayName) {
  CommandProcessor commandProcessor = CommandProcessor.getInstance();
  commandProcessor.executeCommand(myProject, new Runnable() {
    public void run() {
      final MessageView messageView = MessageView.SERVICE.getInstance(myProject);
      messageView.runWhenInitialized(new Runnable() {
        public void run() {
          final Content content =
                  ContentFactory.getInstance().createContent(errorTreeView, tabDisplayName, true);
          messageView.getContentManager().addContent(content);
          Disposer.register(content, errorTreeView);
          messageView.getContentManager().setSelectedContent(content);
          removeContents(content, tabDisplayName);

          ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.MESSAGES_WINDOW).activate(null);
        }
      });
    }
  }, VcsBundle.message("command.name.open.error.message.view"), null);
}
项目:consulo    文件:AbstractVcsHelperImpl.java   
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();
        }
      }
    }
  }
}
项目:consulo    文件:ExecutionHelper.java   
private static void removeContents(@Nullable final Content notToRemove, @Nonnull final Project myProject, @Nonnull 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();
        }
      }
    }
  }
}
项目:intellij-ce-playground    文件:ExternalSystemNotificationManager.java   
@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;
}
项目:intellij-ce-playground    文件:TestErrorViewAction.java   
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);
  }
}
项目:intellij-ce-playground    文件:NewErrorTreeViewPanel.java   
public void close() {
  MessageView messageView = MessageView.SERVICE.getInstance(myProject);
  Content content = messageView.getContentManager().getContent(this);
  if (content != null) {
    messageView.getContentManager().removeContent(content, true);
  }
}
项目:intellij-ce-playground    文件:MavenConsoleImpl.java   
private void ensureAttachedToToolWindow() {
  if (!isOpen.compareAndSet(false, true)) return;

  MavenUtil.invokeLater(myProject, new Runnable() {
    public void run() {
      MessageView messageView = MessageView.SERVICE.getInstance(myProject);

      Content content = ContentFactory.SERVICE.getInstance().createContent(
        myConsoleView.getComponent(), myTitle, true);
      content.putUserData(CONSOLE_KEY, MavenConsoleImpl.this);
      messageView.getContentManager().addContent(content);
      messageView.getContentManager().setSelectedContent(content);

      // remove unused tabs
      for (Content each : messageView.getContentManager().getContents()) {
        if (each.isPinned()) continue;
        if (each == content) continue;

        MavenConsoleImpl console = each.getUserData(CONSOLE_KEY);
        if (console == null) continue;

        if (!myTitle.equals(console.myTitle)) continue;

        if (console.isFinished()) {
          messageView.getContentManager().removeContent(each, true);
        }
      }

      ToolWindow toolWindow = ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.MESSAGES_WINDOW);
      if (!toolWindow.isActive()) {
        toolWindow.activate(null, false);
      }
    }
  });
}
项目:intellij-ce-playground    文件:MavenConsoleImpl.java   
public void close() {
  MessageView messageView = MessageView.SERVICE.getInstance(myProject);
  for (Content each : messageView.getContentManager().getContents()) {
    MavenConsoleImpl console = each.getUserData(CONSOLE_KEY);
    if (console != null) {
      messageView.getContentManager().removeContent(each, true);
      return;
    }
  }
}
项目:tools-idea    文件:TestErrorViewAction.java   
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);
  }
}
项目:tools-idea    文件:NewErrorTreeViewPanel.java   
public void close() {
  MessageView messageView = MessageView.SERVICE.getInstance(myProject);
  Content content = messageView.getContentManager().getContent(this);
  if (content != null) {
    messageView.getContentManager().removeContent(content, true);
  }
}
项目:tools-idea    文件:MavenConsoleImpl.java   
private void ensureAttachedToToolWindow() {
  if (!isOpen.compareAndSet(false, true)) return;

  MavenUtil.invokeLater(myProject, new Runnable() {
    public void run() {
      MessageView messageView = MessageView.SERVICE.getInstance(myProject);

      Content content = ContentFactory.SERVICE.getInstance().createContent(
        myConsoleView.getComponent(), myTitle, true);
      content.putUserData(CONSOLE_KEY, MavenConsoleImpl.this);
      messageView.getContentManager().addContent(content);
      messageView.getContentManager().setSelectedContent(content);

      // remove unused tabs
      for (Content each : messageView.getContentManager().getContents()) {
        if (each.isPinned()) continue;
        if (each == content) continue;

        MavenConsoleImpl console = each.getUserData(CONSOLE_KEY);
        if (console == null) continue;

        if (!myTitle.equals(console.myTitle)) continue;

        if (console.isFinished()) {
          messageView.getContentManager().removeContent(each, false);
        }
      }

      ToolWindow toolWindow = ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.MESSAGES_WINDOW);
      if (!toolWindow.isActive()) {
        toolWindow.activate(null, false);
      }
    }
  });
}
项目:tools-idea    文件:MavenConsoleImpl.java   
public void close() {
  MessageView messageView = MessageView.SERVICE.getInstance(myProject);
  for (Content each : messageView.getContentManager().getContents()) {
    MavenConsoleImpl console = each.getUserData(CONSOLE_KEY);
    if (console != null) {
      messageView.getContentManager().removeContent(each, true);
      return;
    }
  }
}
项目:consulo-apache-ant    文件:AntBuildMessageView.java   
private void close() {
  MessageView messageView = MessageView.SERVICE.getInstance(myProject);
  Content[] contents = messageView.getContentManager().getContents();
  for (Content content : contents) {
    if (content.getComponent() == this) {
      messageView.getContentManager().removeContent(content, true);
      return;
    }
  }
}
项目:consulo    文件:ExternalSystemNotificationManager.java   
@javax.annotation.Nullable
private Content findContent(@Nonnull Pair<NotificationSource, ProjectSystemId> contentIdPair, @Nonnull 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;
}
项目:consulo    文件:TestErrorViewAction.java   
protected void openView(Project project, JComponent component) {
  final MessageView messageView = MessageView.SERVICE.getInstance(project);
  final Content content = ContentFactory.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);
  }
}
项目:consulo    文件:NewErrorTreeViewPanel.java   
public void close() {
  MessageView messageView = MessageView.SERVICE.getInstance(myProject);
  Content content = messageView.getContentManager().getContent(this);
  if (content != null) {
    messageView.getContentManager().removeContent(content, true);
  }
}
项目:consulo    文件:ExecutionHelper.java   
private static void openMessagesView(@Nonnull final ErrorViewPanel errorTreeView, @Nonnull final Project myProject, @Nonnull final String tabDisplayName) {
  CommandProcessor commandProcessor = CommandProcessor.getInstance();
  commandProcessor.executeCommand(myProject, new Runnable() {
    @Override
    public void run() {
      final MessageView messageView = ServiceManager.getService(myProject, MessageView.class);
      final Content content = ContentFactory.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);
}
项目:consulo-unity3d    文件:Unity3dConsoleToolWindowService.java   
@RequiredDispatchThread
@NotNull
private NewErrorTreeViewPanel getOrInitPanel()
{
    if(myErrorPanel != null)
    {
        return myErrorPanel;
    }

    if(myToolwindowInit.compareAndSet(false, true))
    {
        MessageView messageView = MessageView.SERVICE.getInstance(myProject);
        messageView.runWhenInitialized(() ->
        {
            final ContentManager contentManager = messageView.getContentManager();
            Content[] contents = contentManager.getContents();
            Content content = ContainerUtil.find(contents, content1 -> content1.getUserData(ourViewKey) != null);

            MyErrorPanel errorTreeViewPanel = null;
            if(content == null)
            {
                errorTreeViewPanel = new MyErrorPanel(myProject);

                content = ContentFactory.getInstance().createContent(errorTreeViewPanel, "Editor", false);
                content.putUserData(ourViewKey, Boolean.TRUE);

                contentManager.addContent(content);
            }
            else
            {
                errorTreeViewPanel = (MyErrorPanel) content.getComponent();
            }

            contentManager.setSelectedContent(content, true);

            myErrorPanel = errorTreeViewPanel;
        });
    }

    return myErrorPanel;
}