private static void installTreeActions(Tree tree, boolean enableExpandAll) {
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    tree.setCellRenderer(NODE_RENDERER);
    tree.setRootVisible(false);
    tree.setShowsRootHandles(true);

    TreeUtil.installActions(tree);

    TreeSpeedSearch.installOn(tree, true, o -> o.getLastPathComponent().toString());

    DefaultActionGroup group = new DefaultActionGroup();
    CommonActionsManager commonActionManager = CommonActionsManager.getInstance();
    ActionManager globalActionManager = ActionManager.getInstance();

    TreeExpander treeExpander = new MyTreeExpander(tree, enableExpandAll);
    group.add(commonActionManager.createExpandAllAction(treeExpander, tree));
    group.add(commonActionManager.createCollapseAllAction(treeExpander, tree));
    group.add(globalActionManager.getAction(IdeActions.ACTION_EDIT_SOURCE));
    group.add(Separator.getInstance());
    group.add(globalActionManager.getAction(IdeActions.ACTION_ANALYZE_DEPENDENCIES));
    group.add(globalActionManager.getAction(IdeActions.ACTION_ANALYZE_BACK_DEPENDENCIES));
    group.add(globalActionManager.getAction(IdeActions.ACTION_ANALYZE_CYCLIC_DEPENDENCIES));
    group.add(globalActionManager.getAction(IdeActions.ACTION_ANALYZE_MODULE_DEPENDENCIES));

    PopupHandler.installPopupMenu(tree, group, "ModuleDependenciesPopup");
  }
private static void installTreeActions(Tree tree, boolean enableExpandAll)