JComponent () { DefaultActionGroup group = new DefaultActionGroup(); group.add(new AnAction(CommonBundle.messagePointer("action.close"), AllIcons.Actions.Cancel) { @Override public void actionPerformed(@NotNull AnActionEvent e) { DependenciesAnalyzeManager.getInstance(myProject).closeContent(myContent); } }); final AnAction analyzeDepsAction = ActionManager.getInstance().getAction(IdeActions.ACTION_ANALYZE_DEPENDENCIES); group.add(new AnAction(analyzeDepsAction.getTemplatePresentation().getText(), null, AllIcons.Toolwindows.ToolWindowInspection) { @Override public void actionPerformed(@NotNull AnActionEvent e) { analyzeDepsAction.actionPerformed(e); } @Override public void update(@NotNull AnActionEvent e) { analyzeDepsAction.update(e); } @Override public @NotNull ActionUpdateThread getActionUpdateThread() { return analyzeDepsAction.getActionUpdateThread(); } }); group.add(new ToggleAction(CodeInsightBundle.message("action.module.dependencies.direction")) { @Override public boolean isSelected(@NotNull AnActionEvent e) { return !myState.forwardDirection; } @Override public void setSelected(@NotNull AnActionEvent e, boolean state) { myState.forwardDirection = !state; updateLeftTree(); } @Override public void update(@NotNull AnActionEvent e) { e.getPresentation().setIcon(myState.forwardDirection ? AllIcons.Hierarchy.Subtypes : AllIcons.Hierarchy.Supertypes); super.update(e); } @Override public @NotNull ActionUpdateThread getActionUpdateThread() { return ActionUpdateThread.BGT; } }); group.add(new ToggleAction(CodeInsightBundle.message("action.module.dependencies.tests"), null, AllIcons.Nodes.TestSourceFolder) { @Override public boolean isSelected(@NotNull AnActionEvent e) { return myState.includeTests; } @Override public @NotNull ActionUpdateThread getActionUpdateThread() { return ActionUpdateThread.BGT; } @Override public void setSelected(@NotNull AnActionEvent e, boolean state) { myState.includeTests = state; updateModuleGraph(); updateLeftTree(); } }); ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("ModulesDependencies", group, true); JPanel panel = new JPanel(new BorderLayout()); panel.add(toolbar.getComponent(), BorderLayout.WEST); panel.add(myPathField, BorderLayout.CENTER); return panel; }