private void popupInvoked(Component component, int x, int y) {
    final TreePath path = myTree.getLeadSelectionPath();

    if (path == null) return;

    final DefaultActionGroup actions = new DefaultActionGroup();
    final ActionManager actionManager = ActionManager.getInstance();
    actions.add(actionManager.getAction(IdeActions.ACTION_EDIT_SOURCE));
    actions.add(actionManager.getAction(IdeActions.ACTION_FIND_USAGES));

    actions.add(myIncludeAction);
    actions.add(myExcludeAction);

    actions.addSeparator();

    final InspectionToolWrapper toolWrapper = myTree.getSelectedToolWrapper();
    if (toolWrapper != null) {
      final QuickFixAction[] quickFixes = myProvider.getQuickFixes(toolWrapper, myTree);
      if (quickFixes != null) {
        for (QuickFixAction quickFixe : quickFixes) {
          actions.add(quickFixe);
        }
      }
      final HighlightDisplayKey key = HighlightDisplayKey.find(toolWrapper.getShortName());
      if (key == null) return; // e.g. DummyEntryPointsTool

      // options
      actions.addSeparator();
      actions.add(new EditSettingsAction());
      final List<AnAction> options = new InspectionsOptionsToolbarAction(this).createActions();
      for (AnAction action : options) {
        actions.add(action);
      }
    }

    actions.addSeparator();
    actions.add(actionManager.getAction(IdeActions.GROUP_VERSION_CONTROLS));

    final ActionPopupMenu menu =
        actionManager.createActionPopupMenu(ActionPlaces.CODE_INSPECTION, actions);
    menu.getComponent().show(component, x, y);
  }
 protected void initTree() {
   ((DefaultTreeModel) myTree.getModel()).setRoot(myRoot);
   myTree.setRootVisible(false);
   myTree.setShowsRootHandles(true);
   UIUtil.setLineStyleAngled(myTree);
   TreeUtil.installActions(myTree);
   myTree.setCellRenderer(
       new ColoredTreeCellRenderer() {
         public void customizeCellRenderer(
             JTree tree,
             Object value,
             boolean selected,
             boolean expanded,
             boolean leaf,
             int row,
             boolean hasFocus) {
           if (value instanceof MyNode) {
             final MyNode node = ((MyNode) value);
             setIcon(node.getIcon(expanded));
             final Font font = UIUtil.getTreeFont();
             if (node.isDisplayInBold()) {
               setFont(font.deriveFont(Font.BOLD));
             } else {
               setFont(font.deriveFont(Font.PLAIN));
             }
             append(
                 node.getDisplayName(),
                 node.isDisplayInBold()
                     ? SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES
                     : SimpleTextAttributes.REGULAR_ATTRIBUTES);
           }
         }
       });
   initToolbar();
   ArrayList<AnAction> actions = createActions(true);
   if (actions != null) {
     final DefaultActionGroup group = new DefaultActionGroup();
     for (AnAction action : actions) {
       group.add(action);
     }
     actions = getAdditionalActions();
     if (actions != null) {
       group.addSeparator();
       for (AnAction action : actions) {
         group.add(action);
       }
     }
     PopupHandler.installPopupHandler(
         myTree,
         group,
         ActionPlaces.UNKNOWN,
         ActionManager.getInstance()); // popup should follow the selection
   }
 }
  @Override
  protected JComponent createCenterPanel() {
    JPanel panel = new JPanel(new BorderLayout());

    // Toolbar

    DefaultActionGroup group = new DefaultActionGroup();

    fillToolbarActions(group);

    group.addSeparator();

    ExpandAllAction expandAllAction = new ExpandAllAction();
    expandAllAction.registerCustomShortcutSet(
        new CustomShortcutSet(
            KeymapManager.getInstance()
                .getActiveKeymap()
                .getShortcuts(IdeActions.ACTION_EXPAND_ALL)),
        myTree);
    group.add(expandAllAction);

    CollapseAllAction collapseAllAction = new CollapseAllAction();
    collapseAllAction.registerCustomShortcutSet(
        new CustomShortcutSet(
            KeymapManager.getInstance()
                .getActiveKeymap()
                .getShortcuts(IdeActions.ACTION_COLLAPSE_ALL)),
        myTree);
    group.add(collapseAllAction);

    panel.add(
        ActionManager.getInstance()
            .createActionToolbar(ActionPlaces.UNKNOWN, group, true)
            .getComponent(),
        BorderLayout.NORTH);

    // Tree
    expandFirst();
    defaultExpandTree();
    installSpeedSearch();

    JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTree);
    scrollPane.setPreferredSize(new Dimension(350, 450));
    panel.add(scrollPane, BorderLayout.CENTER);

    return panel;
  }
  @NotNull
  protected JComponent createToolbar() {
    DefaultActionGroup toolbarGroups = new DefaultActionGroup();
    myToolBarGroup = new DefaultActionGroup();
    toolbarGroups.add(myToolBarGroup);
    buildToolBar(myToolBarGroup);

    toolbarGroups.addSeparator();
    DefaultActionGroup treeActionsGroup = new DefaultActionGroup();
    toolbarGroups.add(treeActionsGroup);
    for (AnAction action : myViewer.getTreeActions()) {
      treeActionsGroup.add(action);
    }

    ActionToolbar toolbar =
        ActionManager.getInstance().createActionToolbar(ActionPlaces.TOOLBAR, toolbarGroups, true);
    toolbar.setTargetComponent(this);
    return toolbar.getComponent();
  }