public static DefaultActionGroup createPopupActionGroup( final Project project, final TodoPanelSettings settings, Consumer<TodoFilter> todoFilterConsumer) { TodoFilter[] filters = TodoConfiguration.getInstance().getTodoFilters(); DefaultActionGroup group = new DefaultActionGroup(); group.add( new TodoFilterApplier( IdeBundle.message("action.todo.show.all"), IdeBundle.message("action.description.todo.show.all"), null, settings, todoFilterConsumer)); for (TodoFilter filter : filters) { group.add( new TodoFilterApplier(filter.getName(), null, filter, settings, todoFilterConsumer)); } group.addSeparator(); group.add( new AnAction( IdeBundle.message("action.todo.edit.filters"), IdeBundle.message("action.todo.edit.filters"), AllIcons.General.Settings) { @Override public void actionPerformed(AnActionEvent e) { final ShowSettingsUtil util = ShowSettingsUtil.getInstance(); util.editConfigurable(project, new TodoConfigurable()); } }); return group; }
@Override public void update(AnActionEvent e) { super.update(e); if (myFilter != null) { e.getPresentation().setEnabled(!myFilter.isEmpty()); } }
@Override public boolean isSelected(AnActionEvent e) { return Comparing.equal( myFilter != null ? myFilter.getName() : null, mySettings.todoFilterName); }