Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2005-11-02 23:03:51 -0500
committermkersten2005-11-02 23:03:51 -0500
commita26846be9e268109f137f01c04e38308289b9c36 (patch)
treeee9c6f3af0c0025a4969873e986d830b26248576 /org.eclipse.mylyn.tasks.ui
parent30f602019d8148386380f131031d7de7ea2ca70d (diff)
downloadorg.eclipse.mylyn.tasks-a26846be9e268109f137f01c04e38308289b9c36.tar.gz
org.eclipse.mylyn.tasks-a26846be9e268109f137f01c04e38308289b9c36.tar.xz
org.eclipse.mylyn.tasks-a26846be9e268109f137f01c04e38308289b9c36.zip
Fixed Bugzilla Bug 112722: adding task when drilled into a category should add it to that category
Diffstat (limited to 'org.eclipse.mylyn.tasks.ui')
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/CreateTaskAction.java15
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/GoIntoAction.java25
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/GoUpAction.java11
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/views/TaskListView.java50
4 files changed, 62 insertions, 39 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/CreateTaskAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/CreateTaskAction.java
index 9095497f1..5dafff438 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/CreateTaskAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/CreateTaskAction.java
@@ -14,6 +14,7 @@ package org.eclipse.mylar.tasklist.ui.actions;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.window.Window;
+import org.eclipse.mylar.tasklist.ITask;
import org.eclipse.mylar.tasklist.MylarTasklistPlugin;
import org.eclipse.mylar.tasklist.Task;
import org.eclipse.mylar.tasklist.TaskListImages;
@@ -56,12 +57,18 @@ public class CreateTaskAction extends Action {
if (selectedObject instanceof TaskCategory) {
newTask.setCategory((TaskCategory) selectedObject);
((TaskCategory) selectedObject).addTask(newTask);
- } else {
+ } else if (selectedObject instanceof ITask) {
+ ITask task = (ITask)selectedObject;
+ if (task.getCategory() != null) {
+ newTask.setCategory(task.getCategory());
+ ((TaskCategory)task.getCategory()).addTask(newTask);
+ }
+ } else if (view.getDrilledIntoCategory() != null) {
+ newTask.setCategory(view.getDrilledIntoCategory());
+ ((TaskCategory)view.getDrilledIntoCategory()).addTask(newTask);
+ } else {
MylarTasklistPlugin.getTaskListManager().addRootTask(newTask);
}
-// MylarUiPlugin.getDefault().setHighlighterMapping(
-// newTask.getHandle(),
-// MylarUiPlugin.getDefault().getDefaultHighlighter().getName());
this.view.getViewer().refresh();
}
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/GoIntoAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/GoIntoAction.java
index c675f8a6f..a56d515af 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/GoIntoAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/GoIntoAction.java
@@ -14,6 +14,7 @@ package org.eclipse.mylar.tasklist.ui.actions;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.mylar.tasklist.TaskListImages;
import org.eclipse.mylar.tasklist.ui.views.TaskListView;
import org.eclipse.ui.IViewActionDelegate;
import org.eclipse.ui.IViewPart;
@@ -23,30 +24,32 @@ import org.eclipse.ui.IViewPart;
*/
public class GoIntoAction extends Action implements IViewActionDelegate {
-// public static final String ID = "org.eclipse.mylar.tasklist.actions.view.go.into";
+ public static final String ID = "org.eclipse.mylar.tasklist.actions.view.go.into";
//
// private DrillDownAdapter drillDownAdapter;
//
-// public GoIntoAction(DrillDownAdapter drillDownAdapter) {
-// this.drillDownAdapter = drillDownAdapter;
-//
-// setId(ID);
-// setText("Go Into Category");
-// setToolTipText("Go Into Category");
-// setImageDescriptor(TaskListImages.GO_INTO);
-// }
+ public GoIntoAction() {
+ setId(ID);
+ setText("Go Into Category");
+ setToolTipText("Go Into Category");
+ setImageDescriptor(TaskListImages.GO_INTO);
+ }
public void init(IViewPart view) {
// TODO Auto-generated method stub
}
- public void run(IAction action) {
- if(TaskListView.getDefault() != null){
+ public void run() {
+ if(TaskListView.getDefault() != null) {
TaskListView.getDefault().goIntoCategory();
}
}
+ public void run(IAction action) {
+ run();
+ }
+
public void selectionChanged(IAction action, ISelection selection) {
// TODO Auto-generated method stub
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/GoUpAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/GoUpAction.java
index b4af820e4..f0cc601db 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/GoUpAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/GoUpAction.java
@@ -17,13 +17,9 @@ import org.eclipse.ui.part.DrillDownAdapter;
public class GoUpAction extends Action {
-
public static final String ID = "org.eclipse.mylar.tasklist.actions.view.go.up";
-
- private DrillDownAdapter drillDownAdapter;
-
+
public GoUpAction(DrillDownAdapter drillDownAdapter) {
- this.drillDownAdapter = drillDownAdapter;
setText("Go Up To Root");
setToolTipText("Go Up To Root");
setId(ID);
@@ -32,9 +28,8 @@ public class GoUpAction extends Action {
@Override
public void run() {
- drillDownAdapter.goBack();
- if(TaskListView.getDefault() != null){
- TaskListView.getDefault().updateDrillDownActions();
+ if(TaskListView.getDefault() != null) {
+ TaskListView.getDefault().goUpToRoot();
}
}
}
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 798846aa3..3f4578b49 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
@@ -135,36 +135,30 @@ public class TaskListView extends ViewPart {
FilteredTree tree;
private DrillDownAdapter drillDownAdapter;
+ private ITaskListCategory drilledIntoCategory = null;
-// private GoIntoAction goIntoAction;
- private GoUpAction goBackAction;
-
+ private GoIntoAction goIntoAction;
+ private GoUpAction goUpAction;
private WorkOfflineAction workOffline;
-
private CopyDescriptionAction copyDescriptionAction;
private OpenTaskEditorAction openAction;
-
private CreateTaskAction createTaskAction;
private CreateCategoryAction createCategoryAction;
-
private RenameAction rename;
-
private CollapseAllAction collapseAll;
private DeleteAction deleteAction;
private AutoCloseAction autoClose;
private OpenTaskEditorAction openTaskEditor;
-
private RemoveFromCategoryAction removeAction;
-
private TaskActivateAction activateAction = new TaskActivateAction();
private TaskDeactivateAction deactivateAction = new TaskDeactivateAction();
-
private MarkTaskCompleteAction markIncompleteAction;
private MarkTaskIncompleteAction markCompleteAction;
private FilterCompletedTasksAction filterCompleteTask;
private PriorityDropDownAction filterOnPriority;
private PreviousTaskDropDownAction previousTaskAction;
private NextTaskDropDownAction nextTaskAction;
+
private static TaskPriorityFilter PRIORITY_FILTER = new TaskPriorityFilter();
private static TaskCompleteFilter COMPLETE_FILTER = new TaskCompleteFilter();
List<ITaskFilter> filters = new ArrayList<ITaskFilter>();
@@ -918,7 +912,7 @@ public class TaskListView extends ViewPart {
// manager.add(new Separator("local"));
// manager.add(createTaskAction);
// manager.add(createCategoryAction);
- manager.add(goBackAction);
+ manager.add(goUpAction);
manager.add(collapseAll);
// manager.add(new Separator());
// autoClose.setEnabled(true);
@@ -982,6 +976,12 @@ public class TaskListView extends ViewPart {
}
// manager.add(new Separator("tasks"));
addAction(deleteAction, manager, element);
+ if (element instanceof ITaskListCategory) {
+ manager.add(goIntoAction);
+ }
+ if (drilledIntoCategory != null) {
+ manager.add(goUpAction);
+ }
// addAction(rename, manager, element);
// addAction(copyDescriptionAction, manager, element);
@@ -1090,8 +1090,8 @@ public class TaskListView extends ViewPart {
workOffline = new WorkOfflineAction();
-// goIntoAction = new GoIntoAction(drillDownAdapter);
- goBackAction = new GoUpAction(drillDownAdapter);
+ goIntoAction = new GoIntoAction();
+ goUpAction = new GoUpAction(drillDownAdapter);
createTaskAction = new CreateTaskAction(this);
createCategoryAction = new CreateCategoryAction(this);
@@ -1274,9 +1274,9 @@ public class TaskListView extends ViewPart {
public void updateDrillDownActions() {
if(drillDownAdapter.canGoBack()){
- goBackAction.setEnabled(true);
+ goUpAction.setEnabled(true);
} else {
- goBackAction.setEnabled(false);
+ goUpAction.setEnabled(false);
}
// if(drillDownAdapter.canGoInto()){
// canEnableGoInto = true;
@@ -1307,7 +1307,21 @@ public class TaskListView extends ViewPart {
}
public void goIntoCategory() {
- drillDownAdapter.goInto();
+ ISelection selection = getViewer().getSelection();
+ if (selection instanceof StructuredSelection) {
+ StructuredSelection structuredSelection = (StructuredSelection)selection;
+ Object element = structuredSelection.getFirstElement();
+ if (element instanceof ITaskListCategory) {
+ drilledIntoCategory = (ITaskListCategory)element;
+ drillDownAdapter.goInto();
+ updateDrillDownActions();
+ }
+ }
+ }
+
+ public void goUpToRoot() {
+ drilledIntoCategory = null;
+ drillDownAdapter.goBack();
updateDrillDownActions();
}
@@ -1360,4 +1374,8 @@ public class TaskListView extends ViewPart {
}
}
+
+ public ITaskListCategory getDrilledIntoCategory() {
+ return drilledIntoCategory;
+ }
} \ No newline at end of file

Back to the top