private void initUi() {
    if (tabs != null) {
      return;
    }

    tabs = new JBRunnerTabs(myProject, this) {
      @Override
      public void uiDataSnapshot(@NotNull DataSink sink) {
        TabInfo info = tabs.getTargetInfo();
        sink.set(CONTENT_KEY, info == null ? null : getGridFor(info).getContents().toArray(new Content[0]));
        sink.set(CONTEXT_KEY, RunnerContentUi.this);
      }
    };
    tabs.getComponent().setOpaque(false);
    tabs.getPresentation()
      .setTabLabelActionsAutoHide(false).setInnerInsets(JBInsets.emptyInsets())
      .setToDrawBorderIfTabsHidden(false).setTabDraggingEnabled(isMoveToGridActionEnabled()).setUiDecorator(null);
    rebuildTabPopup();

    tabs.setPaintFocus(false);
    tabs.setRequestFocusOnLastFocusedComponent(true);

    NonOpaquePanel wrapper = new MyComponent();
    wrapper.add(myToolbar, BorderLayout.WEST);
    wrapper.add(tabs.getComponent(), BorderLayout.CENTER);

    myComponent = wrapper;

    tabs.addListener(new TabsListener() {

      @Override
      public void beforeSelectionChanged(TabInfo oldSelection, TabInfo newSelection) {
        if (oldSelection != null && !isStateBeingRestored()) {
          GridImpl grid = getGridFor(oldSelection);
          if (getTabFor(grid) != null) {
            grid.saveUiState();
          }
        }
      }

      @Override
      public void tabsMoved() {
        saveUiState();
      }

      @Override
      public void selectionChanged(final TabInfo oldSelection, final TabInfo newSelection) {
        if (!tabs.getComponent().isShowing()) return;

        if (newSelection != null) {
          newSelection.stopAlerting();
          getGridFor(newSelection).processAddToUi(false);
        }

        if (oldSelection != null) {
          getGridFor(oldSelection).processRemoveFromUi();
        }
      }
    });
    tabs.addTabMouseListener(new MouseAdapter() {
      @Override
      public void mousePressed(@NotNull MouseEvent e) {
        if (!UIUtil.isCloseClick(e) || !e.isConsumed()) {
          return;
        }
        TabInfo tabInfo = tabs.findInfo(e);
        GridImpl grid = tabInfo == null ? null : getGridFor(tabInfo);
        Content[] contents = grid != null ? grid.getContents().toArray(new Content[0]) : null;
        if (contents == null) return;
        // see GridCellImpl.closeOrMinimize as well
        if (CloseViewAction.isEnabled(contents)) {
          CloseViewAction.perform(RunnerContentUi.this, contents[0]);
        }
        else if (MinimizeViewAction.isEnabled(RunnerContentUi.this, contents, TAB_TOOLBAR_PLACE)) {
          grid.getCellFor(contents[0]).minimize(contents[0]);
        }
      }
    });

    if (myOriginal != null) {
      final ContentManager manager = ContentFactory.getInstance().createContentManager(this, false, myProject);
      Disposer.register((Disposable)myRunnerUi, manager);
      manager.getComponent();
    }
    else {
      DockManager dockManager = myProject.isDefault() ? null : DockManager.getInstance(myProject);
      if (dockManager != null) {
        dockManager.register(this, this);
      }
    }
    if (UIExperiment.isNewDebuggerUIEnabled()) {
      MouseAdapter adapter = new MouseAdapter() {
        private Point myPressPoint = null;

        @Override
        public void mousePressed(MouseEvent e) {
          InternalDecoratorImpl topLevelDecorator = InternalDecoratorImpl.Companion.findTopLevelDecorator(myComponent);
          if (topLevelDecorator != null) {
            topLevelDecorator.activate(ToolWindowEventSource.ToolWindowHeader);
          }
          myPressPoint = e.getPoint();
        }

        @Override
        public void mouseClicked(MouseEvent e) {
          if (SwingUtilities.isLeftMouseButton(e) && e.getClickCount() == 2) {
            InternalDecoratorImpl topLevelDecorator = InternalDecoratorImpl.Companion.findTopLevelDecorator(myComponent);
            if (topLevelDecorator != null && !topLevelDecorator.isHeaderVisible()) {
              String id = topLevelDecorator.getToolWindowId();
              ToolWindowManagerEx manager = ToolWindowManagerEx.getInstanceEx(myProject);
              ToolWindow window = manager.getToolWindow(id);
              if (window != null) {
                manager.setMaximized(window, !manager.isMaximized(window));
              }
            }
          }
        }

        @Override
        public void mouseDragged(MouseEvent e) {
          InternalDecoratorImpl decorator = InternalDecoratorImpl.Companion.findTopLevelDecorator(myComponent);
          if (decorator == null || decorator.isHeaderVisible()) return;
          ToolWindow window = ToolWindowManager.getInstance(myProject).getToolWindow(decorator.getToolWindowId());
          ToolWindowAnchor anchor = window != null ? window.getAnchor() : null;
          if (anchor == ToolWindowAnchor.BOTTOM && SwingUtilities.isLeftMouseButton(e) && myPressPoint != null) {
            ThreeComponentsSplitter splitter = ComponentUtil.getParentOfType(ThreeComponentsSplitter.class, myComponent);
            if (splitter != null &&
                splitter.getOrientation() &&
                SwingUtilities.isDescendingFrom(getComponent(), splitter.getLastComponent())) {
              int size = splitter.getLastSize();
              int yDiff = myPressPoint.y - e.getPoint().y;
              splitter.setLastSize(size + yDiff);
            }
          }
        }

        @Override
        public void mouseReleased(MouseEvent e) {
          myPressPoint = null;
        }

        @Override
        public void mouseEntered(MouseEvent e) {
          InternalDecoratorImpl decorator = InternalDecoratorImpl.Companion.findTopLevelDecorator(myComponent);
          if (decorator == null || decorator.isHeaderVisible()) {
            e.getComponent().setCursor(Cursor.getDefaultCursor());
            return;
          }
          e.getComponent().setCursor(Cursor.getPredefinedCursor(Cursor.N_RESIZE_CURSOR));
        }

        @Override
        public void mouseExited(MouseEvent e) {
          e.getComponent().setCursor(Cursor.getDefaultCursor());
        }
      };
      wrapper.addMouseListener(adapter);
      tabs.getComponent().addMouseListener(adapter);
      wrapper.addMouseMotionListener(adapter);
      tabs.getComponent().addMouseMotionListener(adapter);
    }
    updateRestoreLayoutActionVisibility();
  }
private void initUi()