private void registerToolWindow(@NotNull ServiceViewToolWindowDescriptor descriptor, boolean active) {
    if (myProject.isDefault()) {
      return;
    }

    ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(myProject);
    toolWindowManager.invokeLater(() -> {
      String toolWindowId = descriptor.getToolWindowId();
      if (toolWindowManager.getToolWindow(toolWindowId) != null) return;

      if (!myActivationActionsRegistered && ToolWindowId.SERVICES.equals(toolWindowId)) {
        myActivationActionsRegistered = true;
        Collection<ServiceViewContributor<?>> contributors = myGroups.get(ToolWindowId.SERVICES);
        if (contributors != null) {
          registerActivateByContributorActions(myProject, contributors);
        }
      }

      myRegisteringToolWindowAvailable = active;
      try {
        ToolWindow toolWindow = toolWindowManager.registerToolWindow(toolWindowId, builder -> {
          builder.contentFactory = new ServiceViewToolWindowFactory();
          builder.icon = descriptor.getToolWindowIcon();
          builder.hideOnEmptyContent = false;
          builder.stripeTitle = () -> {
            return descriptor.getStripeTitle();
          };
          return Unit.INSTANCE;
        });
        if (active) {
          myActiveToolWindowIds.add(toolWindowId);
        }
        restoreBrokenToolWindowIfNeeded(toolWindow);
      }
      finally {
        myRegisteringToolWindowAvailable = false;
      }
    });
  }
private void registerToolWindow(@NotNull ServiceViewToolWindowDescriptor descriptor, boolean active)