Search in sources :

Example 1 with SimpleActionGroup

use of com.intellij.tools.SimpleActionGroup in project intellij-community by JetBrains.

the class SwitchTaskAction method createActionsStep.

private static ActionGroup createActionsStep(final List<TaskListItem> tasks, final Project project, final Ref<Boolean> shiftPressed) {
    SimpleActionGroup group = new SimpleActionGroup();
    final TaskManager manager = TaskManager.getManager(project);
    final LocalTask task = tasks.get(0).getTask();
    if (tasks.size() == 1 && task != null) {
        group.add(new AnAction("&Switch to") {

            public void actionPerformed(AnActionEvent e) {
                manager.activateTask(task, !shiftPressed.get());
            }
        });
        group.add(new AnAction("&Edit") {

            @Override
            public void actionPerformed(AnActionEvent e) {
                EditTaskDialog.editTask((LocalTaskImpl) task, project);
            }
        });
    }
    final AnAction remove = new AnAction("&Remove") {

        @Override
        public void actionPerformed(AnActionEvent e) {
            for (TaskListItem item : tasks) {
                LocalTask itemTask = item.getTask();
                if (itemTask != null) {
                    removeTask(project, itemTask, manager);
                }
            }
        }
    };
    remove.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0)), null);
    group.add(remove);
    return group;
}
Also used : SimpleActionGroup(com.intellij.tools.SimpleActionGroup) TaskManager(com.intellij.tasks.TaskManager) LocalTaskImpl(com.intellij.tasks.impl.LocalTaskImpl) LocalTask(com.intellij.tasks.LocalTask)

Aggregations

LocalTask (com.intellij.tasks.LocalTask)1 TaskManager (com.intellij.tasks.TaskManager)1 LocalTaskImpl (com.intellij.tasks.impl.LocalTaskImpl)1 SimpleActionGroup (com.intellij.tools.SimpleActionGroup)1