private void initInEDT() {
    ThreadingAssertions.assertEventDispatchThread();
    if (isDisposed()) return;
    myTree = new Tree(myModel) {
      {
        ToolTipManager.sharedInstance().registerComponent(this);
      }

      @Override
      public boolean isRootVisible() {
        return false;  // to avoid re-building model when it calls setRootVisible(true)
      }

      @Override
      public String getToolTipText(MouseEvent e) {
        TreePath path = getPathForLocation(e.getX(), e.getY());
        if (path != null) {
          if (getCellRenderer() instanceof UsageViewTreeCellRenderer) {
            return UsageViewTreeCellRenderer.getTooltipFromPresentation(path.getLastPathComponent());
          }
        }
        return null;
      }

      @Override
      public boolean isPathEditable(@NotNull TreePath path) {
        return path.getLastPathComponent() instanceof UsageViewTreeModelBuilder.TargetsRootNode;
      }

      // hack to avoid quadratic expandAll()
      @Override
      public Enumeration<TreePath> getExpandedDescendants(TreePath parent) {
        return myExpandingCollapsing ? Collections.emptyEnumeration() : super.getExpandedDescendants(parent);
      }
    };
    myTree.setName("UsageViewTree");

    myRootPanel = new MyPanel(myTree);
    Disposer.register(this, myRootPanel);
    myTree.setModel(myModel);

    myRootPanel.setLayout(new BorderLayout());

    SimpleToolWindowPanel toolWindowPanel = new SimpleToolWindowPanel(false, true);
    myRootPanel.add(toolWindowPanel, BorderLayout.CENTER);

    toolWindowPanel.setToolbar(createActionsToolbar());

    myCentralPanel = new JPanel(new BorderLayout());
    setupCentralPanel();

    initTree();
    toolWindowPanel.setContent(myCentralPanel);

    myTree.setCellRenderer(myUsageViewTreeCellRenderer);
    //noinspection SSBasedInspection
    SwingUtilities.invokeLater(() -> {
      if (!isDisposed()) {
        collapseAll();
      }
    });

    UsageModelTracker myModelTracker = new UsageModelTracker(getProject());
    Disposer.register(this, myModelTracker);

    myModelTracker.addListener(isPropertyChange -> {
      if (!isPropertyChange) {
        myChangesDetected = true;
      }
      updateLater();
    }, this);

    if (myPresentation.isShowCancelButton()) {
      addButtonToLowerPane(this::close, UsageViewBundle.message("usage.view.cancel.button"));
    }

    myTree.getSelectionModel().addTreeSelectionListener(__ -> {
      //noinspection SSBasedInspection
      ApplicationManager.getApplication().invokeLater(() -> {
        if (!isDisposed()) {
          updateOnSelectionChanged(myProject);
          myNeedUpdateButtons = true;
        }
      });
    });
    myModel.addTreeModelListener(new TreeModelAdapter() {
      @Override
      protected void process(@NotNull TreeModelEvent event, @NotNull EventType type) {
        myNeedUpdateButtons = true;
      }
    });

    myTree.addFocusListener(new FocusAdapter() {
      @Override
      public void focusGained(FocusEvent e) {
        if (rulesChanged) {
          rulesChanged = false;
          rulesChanged();
        }
      }
    });
  }
private void initInEDT()