private void installContextMenu() {
    invokeLaterIfNeeded(() -> {
      final DefaultActionGroup rerunActionGroup = new DefaultActionGroup();
      List<AnAction> restartActions = myBuildDescriptor.getRestartActions();
      rerunActionGroup.addAll(restartActions);
      if (!restartActions.isEmpty()) {
        rerunActionGroup.addSeparator();
      }

      final DefaultActionGroup sourceActionGroup = new DefaultActionGroup();
      EditSourceAction edit = new EditSourceAction();
      ActionUtil.copyFrom(edit, "EditSource");
      sourceActionGroup.add(edit);
      DefaultActionGroup filteringActionsGroup = BuildTreeFilters.createFilteringActionsGroup(this);
      final DefaultActionGroup navigationActionGroup = new DefaultActionGroup();
      final CommonActionsManager actionsManager = CommonActionsManager.getInstance();
      final AnAction prevAction = actionsManager.createPrevOccurenceAction(this);
      navigationActionGroup.add(prevAction);
      final AnAction nextAction = actionsManager.createNextOccurenceAction(this);
      navigationActionGroup.add(nextAction);

      myTree.addMouseListener(new PopupHandler() {
        @Override
        public void invokePopup(Component comp, int x, int y) {
          final DefaultActionGroup group = new DefaultActionGroup();
          group.addAll(rerunActionGroup);
          group.addAll(sourceActionGroup);
          group.addSeparator();
          ExecutionNode[] selectedNodes = getSelectedNodes();
          if (selectedNodes.length == 1) {
            ExecutionNode selectedNode = selectedNodes[0];
            List<AnAction> contextActions = myBuildDescriptor.getContextActions(selectedNode);
            if (!contextActions.isEmpty()) {
              group.addAll(contextActions);
              group.addSeparator();
            }
          }
          group.addAll(filteringActionsGroup);
          group.addSeparator();
          group.addAll(navigationActionGroup);
          ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu("BuildView", group);
          popupMenu.setTargetComponent(myTree);
          JPopupMenu menu = popupMenu.getComponent();
          menu.show(comp, x, y);
        }
      });
    });
  }
private void installContextMenu()