private void registerToolWindow(@NotNull final ToolWindowManager toolWindowManager) {
   try {
     Method method =
         toolWindowManager
             .getClass()
             .getDeclaredMethod(
                 "registerToolWindow",
                 String.class,
                 JComponent.class,
                 ToolWindowAnchor.class,
                 boolean.class,
                 boolean.class,
                 boolean.class);
     method.setAccessible(true);
     method.invoke(
         toolWindowManager,
         StudyToolWindowFactory.STUDY_TOOL_WINDOW,
         null,
         ToolWindowAnchor.LEFT,
         true,
         true,
         true);
   } catch (Exception e) {
     final ToolWindow toolWindow =
         toolWindowManager.getToolWindow(StudyToolWindowFactory.STUDY_TOOL_WINDOW);
     if (toolWindow == null) {
       toolWindowManager.registerToolWindow(
           StudyToolWindowFactory.STUDY_TOOL_WINDOW,
           true,
           ToolWindowAnchor.RIGHT,
           myProject,
           true);
     }
   }
 }
  public static void showTestResultsToolWindow(
      @NotNull final Project project, @NotNull final String message, boolean solved) {
    final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
    ToolWindow window = toolWindowManager.getToolWindow(StudyTestResultsToolWindowFactoryKt.ID);
    if (window == null) {
      toolWindowManager.registerToolWindow(
          StudyTestResultsToolWindowFactoryKt.ID, true, ToolWindowAnchor.BOTTOM);
      window = toolWindowManager.getToolWindow(StudyTestResultsToolWindowFactoryKt.ID);
      new StudyTestResultsToolWindowFactory().createToolWindowContent(project, window);
    }

    final Content[] contents = window.getContentManager().getContents();
    for (Content content : contents) {
      final JComponent component = content.getComponent();
      if (component instanceof ConsoleViewImpl) {
        ((ConsoleViewImpl) component).clear();
        if (!solved) {
          ((ConsoleViewImpl) component).print(message, ConsoleViewContentType.ERROR_OUTPUT);
        } else {
          ((ConsoleViewImpl) component).print(message, ConsoleViewContentType.NORMAL_OUTPUT);
        }
        window.setAvailable(true, () -> {});
        window.show(() -> {});
        return;
      }
    }
  }
 private void initialize() {
   if (!_isInitialized) {
     _isInitialized = true;
     _isDisposed = false;
     ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(_project);
     ToolWindow toolWindow =
         toolWindowManager.registerToolWindow(
             COMMIT_LOGS_TOOLWINDOW_ID, true, ToolWindowAnchor.BOTTOM);
     toolWindow.setIcon(COMMIT_LOGS_SMALL_ICON);
     _contentManager = toolWindow.getContentManager();
     toolWindow.installWatcher(_contentManager);
     //      _contentManager =
     // PeerFactory.getInstance().getContentFactory().createContentManager(true, _project);
     _contentManager.addContentManagerListener(
         new ContentManagerAdapter() {
           @Override
           public void contentRemoved(ContentManagerEvent event) {
             JComponent component = event.getContent().getComponent();
             JComponent removedComponent =
                 (component instanceof CommitLogWindowComponent)
                     ? ((CommitLogWindowComponent) component).getComponent()
                     : component;
             //                    if (removedComponent == myErrorsView) {
             //                        myErrorsView.dispose();
             //                        myErrorsView = null;
             //                    } else
             for (Iterator iterator = _commitLogs.iterator(); iterator.hasNext(); ) {
               Editor editor = (Editor) iterator.next();
               if (removedComponent == editor.getComponent()) {
                 EditorFactory.getInstance().releaseEditor(editor);
                 iterator.remove();
               }
             }
           }
         });
     //      final JComponent component = _contentManager.getComponent();
   }
 }