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 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 void ensureVisible(Project project) {
   if (project == null) {
     return;
   }
   ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
   if (toolWindowManager != null) {
     ToolWindow toolWindow = toolWindowManager.getToolWindow(COMMIT_LOGS_TOOLWINDOW_ID);
     if (toolWindow != null) {
       toolWindow.activate(null);
     }
   }
 }