Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2005-11-02 22:33:17 -0500
committermkersten2005-11-02 22:33:17 -0500
commit30f602019d8148386380f131031d7de7ea2ca70d (patch)
tree9963d992d5cd333555baf5399eea65248c2820a4 /org.eclipse.mylyn.tasks.ui
parent4b1afd433df2cbab6c741002b749fdcd944acdf0 (diff)
downloadorg.eclipse.mylyn.tasks-30f602019d8148386380f131031d7de7ea2ca70d.tar.gz
org.eclipse.mylyn.tasks-30f602019d8148386380f131031d7de7ea2ca70d.tar.xz
org.eclipse.mylyn.tasks-30f602019d8148386380f131031d7de7ea2ca70d.zip
Fixed Bugzilla Bug 114853: group Add actions into a submenu on the popup menu
Diffstat (limited to 'org.eclipse.mylyn.tasks.ui')
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/CopyDescriptionAction.java1
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/RemoveFromCategoryAction.java23
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/views/TaskListView.java70
3 files changed, 59 insertions, 35 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/CopyDescriptionAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/CopyDescriptionAction.java
index 3ee801ede..a65d828c5 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/CopyDescriptionAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/CopyDescriptionAction.java
@@ -33,6 +33,7 @@ public class CopyDescriptionAction extends Action {
setToolTipText("Copy Description");
setId(ID);
setImageDescriptor(TaskListImages.COPY);
+ setAccelerator(SWT.MOD1 + 'c');
}
@Override
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/RemoveFromCategoryAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/RemoveFromCategoryAction.java
index e596dfef5..d49a03f3e 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/RemoveFromCategoryAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/RemoveFromCategoryAction.java
@@ -43,10 +43,11 @@ public class RemoveFromCategoryAction extends Action {
@Override
public void run() {
try {
- Object selectedObject = ((IStructuredSelection) this.view.getViewer()
- .getSelection()).getFirstElement();
- if(selectedObject instanceof ITaskListElement &&
+ Object selectedObject = ((IStructuredSelection) this.view.getViewer().getSelection()).getFirstElement();
+
+ if (selectedObject instanceof ITaskListElement &&
MylarTasklistPlugin.getDefault().getTaskHandlerForElement((ITaskListElement)selectedObject) != null) {
+
TreeItem item = this.view.getViewer().getTree().getSelection()[0];
ITaskListElement selectedElement = (ITaskListElement)selectedObject;
ITaskHandler handler = MylarTasklistPlugin.getDefault().getTaskHandlerForElement(selectedElement);
@@ -63,8 +64,8 @@ public class RemoveFromCategoryAction extends Action {
}
ITaskListCategory cat = task.getCategory();
if (cat != null) {
- cat.removeTask(task);
- } else {
+// cat.removeTask(task);
+// } else {
String message = task.getDeleteConfirmationMessage();
boolean deleteConfirmed = MessageDialog.openQuestion(
Workbench.getInstance().getActiveWorkbenchWindow().getShell(),
@@ -79,12 +80,12 @@ public class RemoveFromCategoryAction extends Action {
IWorkbenchPage page = MylarTasklistPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
// if we couldn't get the page, get out of here
- if (page == null)
- return;
- try {
- this.view.closeTaskEditors((ITask) selectedObject, page);
- } catch (Exception e) {
- MylarPlugin.log(e, " remove failed");
+ if (page != null) {
+ try {
+ this.view.closeTaskEditors((ITask) selectedObject, page);
+ } catch (Exception e) {
+ MylarPlugin.log(e, " remove failed");
+ }
}
}
this.view.getViewer().refresh();
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/views/TaskListView.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/views/TaskListView.java
index a6add179e..798846aa3 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/views/TaskListView.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/views/TaskListView.java
@@ -47,13 +47,13 @@ import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.jface.window.Window;
import org.eclipse.mylar.core.MylarPlugin;
import org.eclipse.mylar.dt.MylarWebRef;
+import org.eclipse.mylar.tasklist.IDynamicSubMenuContributor;
import org.eclipse.mylar.tasklist.IQuery;
import org.eclipse.mylar.tasklist.IQueryHit;
import org.eclipse.mylar.tasklist.ITask;
import org.eclipse.mylar.tasklist.ITaskFilter;
import org.eclipse.mylar.tasklist.ITaskHandler;
import org.eclipse.mylar.tasklist.ITaskListCategory;
-import org.eclipse.mylar.tasklist.IDynamicSubMenuContributor;
import org.eclipse.mylar.tasklist.ITaskListElement;
import org.eclipse.mylar.tasklist.MylarTasklistPlugin;
import org.eclipse.mylar.tasklist.Task;
@@ -141,7 +141,7 @@ public class TaskListView extends ViewPart {
private WorkOfflineAction workOffline;
- private CopyDescriptionAction copyAction;
+ private CopyDescriptionAction copyDescriptionAction;
private OpenTaskEditorAction openAction;
private CreateTaskAction createTaskAction;
@@ -150,7 +150,7 @@ public class TaskListView extends ViewPart {
private RenameAction rename;
private CollapseAllAction collapseAll;
- private DeleteAction delete;
+ private DeleteAction deleteAction;
private AutoCloseAction autoClose;
private OpenTaskEditorAction openTaskEditor;
@@ -159,8 +159,8 @@ public class TaskListView extends ViewPart {
private TaskActivateAction activateAction = new TaskActivateAction();
private TaskDeactivateAction deactivateAction = new TaskDeactivateAction();
- private MarkTaskCompleteAction completeTask;
- private MarkTaskIncompleteAction incompleteTask;
+ private MarkTaskCompleteAction markIncompleteAction;
+ private MarkTaskIncompleteAction markCompleteAction;
private FilterCompletedTasksAction filterCompleteTask;
private PriorityDropDownAction filterOnPriority;
private PreviousTaskDropDownAction previousTaskAction;
@@ -728,7 +728,13 @@ public class TaskListView extends ViewPart {
if(rename.isEnabled()){
rename.run();
}
- }
+ } else if (e.keyCode == 'c' && e.stateMask == SWT.MOD1) {
+ copyDescriptionAction.run();
+ } else if (e.keyCode == SWT.DEL) {
+ deleteAction.run();
+ } else if (e.keyCode == SWT.INSERT) {
+ createTaskAction.run();
+ }
}
public void keyReleased(KeyEvent e) {}
@@ -908,10 +914,10 @@ public class TaskListView extends ViewPart {
private void fillLocalPullDown(IMenuManager manager) {
updateDrillDownActions();
- manager.add(new Separator("reports"));
- manager.add(new Separator("local"));
- manager.add(createTaskAction);
- manager.add(createCategoryAction);
+// manager.add(new Separator("reports"));
+// manager.add(new Separator("local"));
+// manager.add(createTaskAction);
+// manager.add(createCategoryAction);
manager.add(goBackAction);
manager.add(collapseAll);
// manager.add(new Separator());
@@ -946,28 +952,44 @@ public class TaskListView extends ViewPart {
element = (ITaskListElement) selectedObject;
}
+ addAction(openAction, manager, element);
if ((element instanceof ITask) || (element instanceof IQueryHit)) {
ITask task = null;
+ boolean isLocal = element.getClass().equals(Task.class); // HACK
if (element instanceof IQueryHit) {
task = ((IQueryHit)element).getOrCreateCorrespondingTask();
} else {
task = (ITask)element;
}
+
if (task.isActive()) {
manager.add(deactivateAction);
} else {
manager.add(activateAction);
}
+
+ if (isLocal) {
+ if (task.isCompleted()) {
+ addAction(markCompleteAction, manager, element);
+ } else {
+ addAction(markIncompleteAction, manager, element);
+ }
+ }
+ // HACK: to avoid removing local tasks
+ if (!isLocal) {
+ addAction(removeAction, manager, element);
+ }
}
- addAction(openAction, manager, element);
- addAction(completeTask, manager, element);
- addAction(incompleteTask, manager, element);
- manager.add(new Separator("tasks"));
- addAction(removeAction, manager, element);
- addAction(rename, manager, element);
- addAction(delete, manager, element);
- addAction(copyAction, manager, element);
-// addAction(createTask, manager, element);
+// manager.add(new Separator("tasks"));
+ addAction(deleteAction, manager, element);
+// addAction(rename, manager, element);
+// addAction(copyDescriptionAction, manager, element);
+
+ manager.add(new Separator("local"));
+ manager.add(createTaskAction);
+ manager.add(createCategoryAction);
+ manager.add(new Separator("reports"));
+
manager.add(new Separator("context"));
for (IDynamicSubMenuContributor contributor : MylarTasklistPlugin.getDefault().getDynamicMenuContributers()) {
@@ -975,7 +997,7 @@ public class TaskListView extends ViewPart {
if (subMenuManager != null) addMenuManager(subMenuManager, manager, element);
}
- manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}
private void addMenuManager(IMenuManager menuToAdd, IMenuManager manager, ITaskListElement element) {
@@ -1063,7 +1085,7 @@ public class TaskListView extends ViewPart {
private void makeActions() {
- copyAction = new CopyDescriptionAction(this);
+ copyDescriptionAction = new CopyDescriptionAction(this);
openAction = new OpenTaskEditorAction(this);
workOffline = new WorkOfflineAction();
@@ -1076,11 +1098,11 @@ public class TaskListView extends ViewPart {
removeAction = new RemoveFromCategoryAction(this);
rename = new RenameAction(this);
- delete = new DeleteAction(this);
+ deleteAction = new DeleteAction(this);
collapseAll = new CollapseAllAction(this);
autoClose = new AutoCloseAction();
- completeTask = new MarkTaskCompleteAction(this);
- incompleteTask = new MarkTaskIncompleteAction(this);
+ markIncompleteAction = new MarkTaskCompleteAction(this);
+ markCompleteAction = new MarkTaskIncompleteAction(this);
openTaskEditor = new OpenTaskEditorAction(this);
filterCompleteTask = new FilterCompletedTasksAction(this);
filterOnPriority = new PriorityDropDownAction();

Back to the top