@Override
  public void setManager(final @NotNull ContentManager manager) {
    assert myManager == null;

    myManager = manager;
    myManager.addContentManagerListener(new ContentManagerListener() {
      @Override
      public void contentAdded(final @NotNull ContentManagerEvent event) {
        initUi();
        if (event.getContent().getUserData(LIGHTWEIGHT_CONTENT_MARKER) == Boolean.TRUE) {
          myLayoutSettings.setLightWeight(event.getContent());
          Disposer.register(event.getContent(), () -> myLayoutSettings.clearStateFor(event.getContent()));
        }


        GridImpl grid = getGridFor(event.getContent(), true);
        if (grid == null) {
          return;
        }

        grid.add(event.getContent());

        if (getSelectedGrid() == grid) {
          grid.processAddToUi(false);
        }

        if (myManager.getComponent().isShowing() && !isStateBeingRestored()) {
          setStateIsBeingRestored(true, RunnerContentUi.this);
          try {
            grid.restoreLastUiState();
          } finally {
            setStateIsBeingRestored(false, RunnerContentUi.this);
          }
        }

        updateTabsUI(false);

        event.getContent().addPropertyChangeListener(RunnerContentUi.this);
        fireContentOpened(event.getContent());
        if (myMinimizeActionEnabled) {
          AnAction[] actions = myViewActions.getChildren(ActionManager.getInstance());
          for (AnAction action : actions) {
            if (action instanceof ViewLayoutModificationAction && ((ViewLayoutModificationAction)action).getContent() == event.getContent()) return;
          }

          CustomContentLayoutSettings layoutOptionsCollection = event.getContent().getUserData(CustomContentLayoutSettings.KEY);
          if (layoutOptionsCollection != null) {
            for (AnAction action: layoutOptionsCollection.getActions(RunnerContentUi.this)) {
              myViewActions.addAction(action).setAsSecondary(true);
            }
          }
          else {
            AnAction viewAction = new RestoreViewAction(RunnerContentUi.this, event.getContent());
            myViewActions.addAction(viewAction).setAsSecondary(true);
          }

          List<AnAction> toAdd = new ArrayList<>();
          for (AnAction anAction : myViewActions.getChildren(ActionManager.getInstance())) {
            if (!(anAction instanceof ViewLayoutModificationAction)) {
              myViewActions.remove(anAction);
              toAdd.add(anAction);
            }
          }
          for (AnAction anAction : toAdd) {
            myViewActions.addAction(anAction).setAsSecondary(true);
          }
        }
      }

      @Override
      public void contentRemoved(final @NotNull ContentManagerEvent event) {
        final Content content = event.getContent();
        content.removePropertyChangeListener(RunnerContentUi.this);

        GridImpl grid = (GridImpl)findGridFor(content);
        if (grid != null) {
          grid.remove(content);
          if (grid.isEmpty()) {
            grid.processRemoveFromUi();
          }
          removeGridIfNeeded(grid);
        }
        updateTabsUI(false);
        fireContentClosed(content);
        ApplicationManager.getApplication().invokeLater(() -> {
          if (Disposer.isDisposed(content)) {
            AnAction[] actions = myViewActions.getChildren(ActionManager.getInstance());
            for (AnAction action : actions) {
              if (action instanceof ViewLayoutModificationAction && ((ViewLayoutModificationAction)action).getContent() == content) {
                myViewActions.remove(action);
                break;
              }
            }
          }
        });
      }

      @Override
      public void selectionChanged(final @NotNull ContentManagerEvent event) {
        if (isStateBeingRestored()) return;

        if (event.getOperation() == ContentManagerEvent.ContentOperation.add) {
          select(event.getContent(), false);
        }
      }
    });
  }
@Override
  public void setManager(final @NotNull ContentManager manager)