private void doAddContent(final @NotNull Content content, final int index) {
    ThreadingAssertions.assertEventDispatchThread();
    if (contents.contains(content)) {
      contents.remove(content);
      contents.add(index < 0 ? contents.size() : index, content);
      return;
    }

    if (!Content.TEMPORARY_REMOVED_KEY.get(content, false) && getContentCount() == 0 && !isEmpty()) {
      ContentManager oldManager = content.getManager();
      for (ContentManagerImpl nestedManager : myNestedManagers) {
        if (!nestedManager.isEmpty()) {
          nestedManager.doAddContent(content, index);
          if (content.getManager() != oldManager) {
            return;
          }
        }
      }
    }

    ((ContentImpl)content).setManager(this);
    final int insertIndex = index < 0 ? contents.size() : index;
    contents.add(insertIndex, content);
    content.addPropertyChangeListener(this);
    fireContentAdded(content, insertIndex);
    if (myUI.isToSelectAddedContent() || mySelection.isEmpty() && !myUI.canBeEmptySelection()) {
      if (myUI.isSingleSelection()) {
        setSelectedContent(content);
      }
      else {
        addSelectedContent(content);
      }
      if (myComponent != null && myComponent.isFocusOwner() && contents.size() == 1) {
        requestFocus(content, true);
      }
    }

    Disposer.register(this, content);
  }
private void doAddContent(final @NotNull Content content, final int index)