private JComponent createTreeToolbar() { final DefaultActionGroup group = new DefaultActionGroup(); final Runnable update = new Runnable() { public void run() { rebuild(true); } }; if (ProjectViewDirectoryHelper.getInstance(myProject).supportsFlattenPackages()) { group.add(new FlattenPackagesAction(update)); } final PatternDialectProvider[] dialectProviders = Extensions.getExtensions(PatternDialectProvider.EP_NAME); for (PatternDialectProvider provider : dialectProviders) { for (AnAction action : provider.createActions(myProject, update)) { group.add(action); } } group.add(new ShowFilesAction(update)); final Module[] modules = ModuleManager.getInstance(myProject).getModules(); if (modules.length > 1) { group.add(new ShowModulesAction(update)); group.add(new ShowModuleGroupsAction(update)); } group.add(new FilterLegalsAction(update)); if (dialectProviders.length > 1) { group.add(new ChooseScopeTypeAction(update)); } ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, group, true); return toolbar.getComponent(); }
private ActionGroup createTreePopupActions() { final DefaultActionGroup actionGroup = new DefaultActionGroup(); actionGroup.add( new AnAction(IdeBundle.message("button.include")) { @Override public void actionPerformed(AnActionEvent e) { includeSelected(false); } }); actionGroup.add( new AnAction(IdeBundle.message("button.include.recursively")) { @Override public void actionPerformed(AnActionEvent e) { includeSelected(true); } @Override public void update(AnActionEvent e) { e.getPresentation().setEnabled(isButtonEnabled(true)); } }); actionGroup.add( new AnAction(IdeBundle.message("button.exclude")) { @Override public void actionPerformed(AnActionEvent e) { excludeSelected(false); } }); actionGroup.add( new AnAction(IdeBundle.message("button.exclude.recursively")) { @Override public void actionPerformed(AnActionEvent e) { excludeSelected(true); } @Override public void update(AnActionEvent e) { e.getPresentation().setEnabled(isButtonEnabled(true)); } }); return actionGroup; }
@NotNull protected DefaultActionGroup createPopupActionGroup(final JComponent button) { final DefaultActionGroup group = new DefaultActionGroup(); for (final PatternDialectProvider provider : Extensions.getExtensions(PatternDialectProvider.EP_NAME)) { group.add( new AnAction(provider.getDisplayName()) { public void actionPerformed(final AnActionEvent e) { DependencyUISettings.getInstance().SCOPE_TYPE = provider.getShortName(); myUpdate.run(); } }); } return group; }