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;
}
Aggregations