Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2005-10-26 11:52:52 -0400
committermkersten2005-10-26 11:52:52 -0400
commit0d11bd44261c1cc06a7a9e516b2338f2dcc82e49 (patch)
treefe66a8d3eb90dfa21f6f5972e781ba2dce258403
parent4df71c14ccfd1e8f1a074aa566613af13c853044 (diff)
downloadorg.eclipse.mylyn.tasks-0d11bd44261c1cc06a7a9e516b2338f2dcc82e49.tar.gz
org.eclipse.mylyn.tasks-0d11bd44261c1cc06a7a9e516b2338f2dcc82e49.tar.xz
org.eclipse.mylyn.tasks-0d11bd44261c1cc06a7a9e516b2338f2dcc82e49.zip
Fixed Bugzilla Bug 111945: Read-only activations of tasks
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/plugin.xml56
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskHistoryTest.java20
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskListManagerTest.java23
-rw-r--r--org.eclipse.mylyn.tasks.ui/plugin.xml14
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITask.java6
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/MylarTasklistPlugin.java8
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/Task.java9
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/TaskListManager.java3
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/DefaultTaskListExternalizer.java14
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/internal/CompletedTaskCollector.java (renamed from org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/internal/CompletedTaskCollector.java)2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/internal/ITasksCollector.java (renamed from org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/internal/ITasksCollector.java)2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/internal/ReminderRequiredCollector.java (renamed from org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/internal/ReminderRequiredCollector.java)2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/internal/TaskReportGenerator.java (renamed from org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/internal/TaskReportGenerator.java)2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/ui/CompletedTasksContentProvider.java (renamed from org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/ui/CompletedTasksContentProvider.java)2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/ui/CompletedTasksEditorInput.java (renamed from org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/ui/CompletedTasksEditorInput.java)8
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/ui/CompletedTasksLabelProvider.java (renamed from org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/ui/CompletedTasksLabelProvider.java)2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/ui/CompletedTasksSorter.java (renamed from org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/ui/CompletedTasksSorter.java)2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/ui/MylarTaskPlannerEditorPart.java (renamed from org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/ui/PlanningGameEditorPart.java)7
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/ui/MylarTaskPlannerWizard.java (renamed from org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/ui/PlanningGameWizard.java)12
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/ui/MylarTaskPlannerWizardPage.java (renamed from org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/ui/PlanningGameWizardPage.java)26
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/ui/PlannedTasksContentProvider.java (renamed from org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/ui/PlannedTasksContentProvider.java)2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/ui/PlannedTasksLabelProvider.java (renamed from org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/ui/PlannedTasksLabelProvider.java)2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/ui/PlannedTasksSorter.java (renamed from org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/ui/PlannedTasksSorter.java)2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/ui/ReminderCellEditor.java (renamed from org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/ui/ReminderCellEditor.java)2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/AutoCloseAction.java2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/DropDownTaskNavigateAction.java2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/NextTaskDropDownAction.java2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/PreviousTaskDropDownAction.java2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/TaskActivateAction.java37
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/TaskDeactivateAction.java33
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/views/TaskListView.java386
31 files changed, 244 insertions, 448 deletions
diff --git a/org.eclipse.mylyn.bugzilla.ui/plugin.xml b/org.eclipse.mylyn.bugzilla.ui/plugin.xml
index 09fe646c2..e4275632e 100644
--- a/org.eclipse.mylyn.bugzilla.ui/plugin.xml
+++ b/org.eclipse.mylyn.bugzilla.ui/plugin.xml
@@ -120,16 +120,27 @@
<viewContribution
id="org.eclipse.mylar.bugzilla.ui.tasklist.actions"
targetID="org.eclipse.mylar.tasks.ui.views.TaskListView">
-
+
+ <action
+ class="org.eclipse.mylar.bugzilla.ui.actions.RefreshBugzillaAction"
+ enablesFor="*"
+ icon="icons/etool16/task-bug-refresh.gif"
+ id="org.eclipse.mylar.bugzilla.ui.popup.refresh"
+ label="Synchronize Reports"
+ menubarPath="reports"
+ tooltip="Synchronize Reports">
+ </action>
+
+
<action
- class="org.eclipse.mylar.bugzilla.ui.actions.CreateBugzillaTaskAction"
+ class="org.eclipse.mylar.bugzilla.ui.actions.CreateBugzillaQueryCategoryAction"
enablesFor="*"
- icon="icons/etool16/task-bug.gif"
- id="org.eclipse.mylar.bugzilla.tasklist.addExisting"
- label="Add Existing Bugzilla Report"
- menubarPath="bugzilla"
+ icon="icons/etool16/category-query-new.gif"
+ id="org.eclipse.mylar.bugzilla.tasklist.addQuery"
+ label="Add Bugzilla Query"
+ menubarPath="reports"
style="push"
- tooltip="Add Existing Bugzilla Report">
+ tooltip="Add Bugzilla Query">
</action>
<action
@@ -138,36 +149,27 @@
icon="icons/etool16/task-bug-new.gif"
id="org.eclipse.mylar.bugzilla.tasklist.addNew"
label="Add New Bugzilla Report"
+ menubarPath="reports"
style="push"
toolbarPath="reports"
tooltip="Add New Bugzilla Report">
</action>
-
-
+
<action
- class="org.eclipse.mylar.bugzilla.ui.actions.CreateBugzillaQueryCategoryAction"
+ class="org.eclipse.mylar.bugzilla.ui.actions.CreateBugzillaTaskAction"
enablesFor="*"
- icon="icons/etool16/category-query-new.gif"
- id="org.eclipse.mylar.bugzilla.tasklist.addQuery"
- label="Add Bugzilla Query"
+ icon="icons/etool16/task-bug.gif"
+ id="org.eclipse.mylar.bugzilla.tasklist.addExisting"
+ label="Add Existing Bugzilla Report"
+ menubarPath="reports"
style="push"
- toolbarPath="reports"
- tooltip="Add Bugzilla Query">
+ tooltip="Add Existing Bugzilla Report">
</action>
-
- <action
- class="org.eclipse.mylar.bugzilla.ui.actions.RefreshBugzillaAction"
- enablesFor="*"
- icon="icons/etool16/task-bug-refresh.gif"
- id="org.eclipse.mylar.bugzilla.ui.popup.refresh"
- label="Synchronize Reports"
- menubarPath="bugzilla"
- tooltip="Synchronize Reports">
- </action>
</viewContribution>
</extension>
- <extension
+<!--
+ <extension
point="org.eclipse.ui.popupMenus">
<viewerContribution
id="org.eclipse.mylar.bugzilla.ui.viewerContribution1"
@@ -201,7 +203,7 @@
</enablement>
</action>
</viewerContribution>
-
</extension>
+-->
</plugin>
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskHistoryTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskHistoryTest.java
index fdc0ca874..f9d348353 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskHistoryTest.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskHistoryTest.java
@@ -83,11 +83,11 @@ public class TaskHistoryTest extends TestCase {
* Tests the next task and previous task navigation.
*/
public void testBasicHistoryNavigation(){
- (new TaskActivateAction(task1)).run();
+ (new TaskActivateAction()).run(task1);
taskView.addTaskToHistory(task1);
- (new TaskActivateAction(task2)).run();
+ (new TaskActivateAction()).run(task2);
taskView.addTaskToHistory(task2);
- (new TaskActivateAction(task3)).run();
+ (new TaskActivateAction()).run(task3);
taskView.addTaskToHistory(task3);
assertTrue(task3.isActive());
@@ -117,7 +117,7 @@ public class TaskHistoryTest extends TestCase {
taskView.getNextTaskAction().run();
assertTrue(task3.isActive());
- (new TaskActivateAction(task4)).run();
+ (new TaskActivateAction()).run(task4);
taskView.addTaskToHistory(task4); //Simulate clicking on it rather than navigating next or previous
assertTrue(task4.isActive());
@@ -143,13 +143,13 @@ public class TaskHistoryTest extends TestCase {
//Simulate activating the tasks by clicking rather than
//navigating previous/next
- (new TaskActivateAction(task1)).run();
+ (new TaskActivateAction()).run(task1);
taskView.addTaskToHistory(task1);
- (new TaskActivateAction(task2)).run();
+ (new TaskActivateAction()).run(task2);
taskView.addTaskToHistory(task2);
- (new TaskActivateAction(task3)).run();
+ (new TaskActivateAction()).run(task3);
taskView.addTaskToHistory(task3);
- (new TaskActivateAction(task4)).run();
+ (new TaskActivateAction()).run(task4);
taskView.addTaskToHistory(task4);
assertTrue(task4.isActive());
@@ -194,8 +194,8 @@ public class TaskHistoryTest extends TestCase {
assertTrue(prevHistoryList.get(prevHistoryList.size() - 3) == task1);
//Check that a deactivated task appears first on the history list
- (new TaskActivateAction(task5)).run();
- (new TaskDeactivateAction(task5, taskView)).run();
+ (new TaskActivateAction()).run(task5);
+ (new TaskDeactivateAction()).run(task5);
taskView.addTaskToHistory(task5);
prevHistoryList = taskHistory.getPreviousTasks();
assertTrue(prevHistoryList.get(prevHistoryList.size() - 1) == task5);
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskListManagerTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskListManagerTest.java
index 102c965eb..76105ebd2 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskListManagerTest.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskListManagerTest.java
@@ -32,12 +32,33 @@ import org.eclipse.mylar.tasklist.internal.TaskList;
*/
public class TaskListManagerTest extends TestCase {
+ public void testPlans() {
+ File file = new File("foo" + MylarTasklistPlugin.FILE_EXTENSION);
+ file.deleteOnExit();
+ TaskListManager manager = new TaskListManager(file);
+
+ Task task1 = new Task(MylarTasklistPlugin.getTaskListManager().genUniqueTaskId(), "task 1", true);
+ task1.addPlan("default");
+ manager.addRootTask(task1);
+
+ manager.saveTaskList();
+ assertNotNull(manager.getTaskList());
+ TaskList list = new TaskList();
+ manager.setTaskList(list);
+ manager.readTaskList();
+ assertNotNull(manager.getTaskList());
+
+ List<ITask> readList = manager.getTaskList().getRootTasks();
+ ITask task = readList.get(0);
+ assertEquals(1, task.getPlans().size());
+ assertTrue(task.getPlans().get(0).equals("default"));
+ }
+
public void testCreationAndExternalization() {
File file = new File("foo" + MylarTasklistPlugin.FILE_EXTENSION);
file.deleteOnExit();
TaskListManager manager = new TaskListManager(file);
-// TaskList tlist = manager.getTaskList();
Task task1 = new Task(MylarTasklistPlugin.getTaskListManager().genUniqueTaskId(), "task 1", true);
manager.addRootTask(task1);
Task sub1 = new Task(MylarTasklistPlugin.getTaskListManager().genUniqueTaskId(), "sub 1", true);
diff --git a/org.eclipse.mylyn.tasks.ui/plugin.xml b/org.eclipse.mylyn.tasks.ui/plugin.xml
index 683085587..a798129e9 100644
--- a/org.eclipse.mylyn.tasks.ui/plugin.xml
+++ b/org.eclipse.mylyn.tasks.ui/plugin.xml
@@ -37,7 +37,7 @@
<extension point="org.eclipse.ui.newWizards">
<wizard
category="org.eclipse.mylar.wizards"
- class="org.eclipse.mylar.tasklist.report.ui.PlanningGameWizard"
+ class="org.eclipse.mylar.tasklist.planner.ui.MylarTaskPlannerWizard"
icon="icons/eview16/task-list.gif"
id="org.eclipse.mylar.tasklist.report.ui.planningGameWizard"
name="Mylar Task Planner">
@@ -71,16 +71,16 @@
class="org.eclipse.mylar.tasklist.ui.TaskEditor"
name="Task Viewer"
id="org.eclipse.mylar.tasklist.ui.taskEditor"/>
- <editor
- icon="icons/eview16/task.gif"
- class="org.eclipse.mylar.tasklist.report.ui.PlanningGameEditorPart"
- name="Planning Game Report"
- id="org.eclipse.mylar.tasklist.report.ui.planning"/>
<editor
icon="icons/eview16/task.gif"
class="org.eclipse.mylar.tasklist.ui.CategoryEditor"
name="Category Editor"
- id="org.eclipse.mylar.tasklist.ui.catEditor"/>
+ id="org.eclipse.mylar.tasklist.ui.catEditor"/>
+ <editor
+ icon="icons/eview16/task-list.gif"
+ class="org.eclipse.mylar.tasklist.planner.ui.MylarTaskPlannerEditorPart"
+ name="Mylar Task Planner"
+ id="org.eclipse.mylar.tasklist.ui.planner.editor"/>
</extension>
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITask.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITask.java
index 401daf3d9..e06ef0d89 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITask.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITask.java
@@ -22,7 +22,7 @@ import org.eclipse.mylar.tasklist.internal.TaskCategory;
/**
* @author Mik Kersten
*
- * TODO: make IDs be handles
+ * TODO: make IDs be handles, clean up
*/
public interface ITask extends Serializable, ITaskListElement {
@@ -37,6 +37,10 @@ public interface ITask extends Serializable, ITaskListElement {
public abstract boolean isActive();
public abstract void setActive(boolean active, boolean isStalled);
+
+ public abstract void addPlan(String plan);
+
+ public List<String> getPlans();
public abstract void setCompleted(boolean completed);
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/MylarTasklistPlugin.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/MylarTasklistPlugin.java
index bb39071b1..6592848a3 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/MylarTasklistPlugin.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/MylarTasklistPlugin.java
@@ -27,8 +27,8 @@ import org.eclipse.core.runtime.Preferences.PropertyChangeEvent;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.mylar.core.MylarPlugin;
import org.eclipse.mylar.tasklist.internal.TaskListExternalizer;
-import org.eclipse.mylar.tasklist.report.internal.ReminderRequiredCollector;
-import org.eclipse.mylar.tasklist.report.internal.TaskReportGenerator;
+import org.eclipse.mylar.tasklist.planner.internal.ReminderRequiredCollector;
+import org.eclipse.mylar.tasklist.planner.internal.TaskReportGenerator;
import org.eclipse.mylar.tasklist.ui.TasksReminderDialog;
import org.eclipse.mylar.tasklist.ui.views.TaskListView;
import org.eclipse.swt.events.DisposeEvent;
@@ -55,8 +55,8 @@ public class MylarTasklistPlugin extends AbstractUIPlugin implements IStartup {
private List<ITaskHandler> taskHandlers = new ArrayList<ITaskHandler>(); // TODO: use extension points
private List<IContextEditorFactory> contextEditors = new ArrayList<IContextEditorFactory>();
- public static final String PLANNING_GAME_WIZARD_ID = "org.eclipse.mylar.tasklist.report.ui.planningGameWizard";
- public static final String PLANNING_GAME_EDITOR_ID = "org.eclipse.mylar.tasklist.report.ui.planning";
+ public static final String PLANNING_GAME_WIZARD_ID = "org.eclipse.mylar.tasklist.ui.planner.wizard";
+ public static final String PLANNING_GAME_EDITOR_ID = "org.eclipse.mylar.tasklist.ui.planner.editor";
public static final String REPORT_OPEN_EDITOR = "org.eclipse.mylar.tasklist.report.open.editor";
public static final String REPORT_OPEN_INTERNAL = "org.eclipse.mylar.tasklist.report.open.internal";
public static final String REPORT_OPEN_EXTERNAL = "org.eclipse.mylar.tasklist.report.open.external";
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/Task.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/Task.java
index 0884bca43..c8cb860dd 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/Task.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/Task.java
@@ -55,6 +55,7 @@ public class Task implements ITask {
private int estimatedTime = 0;
private boolean completed;
private List<String> links = new ArrayList<String>();
+ private List<String> plans = new ArrayList<String>();
private String issueReportURL = "";
private ITaskListCategory parentCategory = null;
@@ -549,4 +550,12 @@ public class Task implements ITask {
public String getEstimateTimeForDisplay() {
return estimatedTime / 10 + " Hours";
}
+
+ public void addPlan(String plan) {
+ if (plan != null && !plans.contains(plan)) plans.add(plan);
+ }
+
+ public List<String> getPlans() {
+ return plans;
+ }
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/TaskListManager.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/TaskListManager.java
index b13930248..2cda5683f 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/TaskListManager.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/TaskListManager.java
@@ -149,8 +149,7 @@ public class TaskListManager {
public void deactivateTask(ITask task) {
TaskActiveTimerListener activeListener = listenerMap.remove(task);
- if(activeListener != null)
- activeListener.stopTimer();
+ if(activeListener != null) activeListener.stopTimer();
taskList.setActive(task, false, false);
for (ITaskActivityListener listener : listeners) listener.taskDeactivated(task);
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/DefaultTaskListExternalizer.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/DefaultTaskListExternalizer.java
index ab2981bf0..e6a7c26d1 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/DefaultTaskListExternalizer.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/DefaultTaskListExternalizer.java
@@ -44,6 +44,7 @@ public class DefaultTaskListExternalizer implements ITaskListExternalizer {
public static final String TAG_TASK_CATEGORY = "Task" + TAG_CATEGORY;
public static final String LINK = "Link";
+ public static final String PLAN = "Plan";
public static final String ESTIMATED = "Estimated";
public static final String ELAPSED = "Elapsed";
public static final String ISSUEURL = "IssueURL";
@@ -134,6 +135,12 @@ public class DefaultTaskListExternalizer implements ITaskListExternalizer {
node.setAttribute(LINK+i, link);
i++;
}
+ List<String> plans = task.getPlans();
+ int currPlan = 0;
+ for (String plan : plans) {
+ node.setAttribute(PLAN+currPlan, plan);
+ currPlan++;
+ }
for (ITask t : task.getChildren()) {
createTaskElement(t, doc, node);
@@ -211,7 +218,7 @@ public class DefaultTaskListExternalizer implements ITaskListExternalizer {
if (element.getAttribute(ACTIVE).compareTo(TRUE) == 0) {
task.setActive(true, false);
tlist.setActive(task, true, false);
- new TaskActivateAction(task).run();
+ new TaskActivateAction().run(task);
} else {
task.setActive(false, false);
}
@@ -272,6 +279,11 @@ public class DefaultTaskListExternalizer implements ITaskListExternalizer {
task.getRelatedLinks().add(element.getAttribute(LINK+i));
i++;
}
+ int ii = 0;
+ while (element.hasAttribute(PLAN+ii)) {
+ task.getPlans().add(element.getAttribute(PLAN+i));
+ ii++;
+ }
if (category != null) {
task.internalSetCategory((TaskCategory) category);
} else {
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/internal/CompletedTaskCollector.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/internal/CompletedTaskCollector.java
index 0a422387b..41421a970 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/internal/CompletedTaskCollector.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/internal/CompletedTaskCollector.java
@@ -9,7 +9,7 @@
* University Of British Columbia - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylar.tasklist.report.internal;
+package org.eclipse.mylar.tasklist.planner.internal;
import java.util.Collection;
import java.util.Date;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/internal/ITasksCollector.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/internal/ITasksCollector.java
index 86c0a5948..663588735 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/internal/ITasksCollector.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/internal/ITasksCollector.java
@@ -9,7 +9,7 @@
* University Of British Columbia - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylar.tasklist.report.internal;
+package org.eclipse.mylar.tasklist.planner.internal;
import java.util.Collection;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/internal/ReminderRequiredCollector.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/internal/ReminderRequiredCollector.java
index 9898e06ff..ce8697522 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/internal/ReminderRequiredCollector.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/internal/ReminderRequiredCollector.java
@@ -9,7 +9,7 @@
* University Of British Columbia - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylar.tasklist.report.internal;
+package org.eclipse.mylar.tasklist.planner.internal;
import java.util.ArrayList;
import java.util.Date;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/internal/TaskReportGenerator.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/internal/TaskReportGenerator.java
index 8bc16042c..449f72b7d 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/internal/TaskReportGenerator.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/internal/TaskReportGenerator.java
@@ -9,7 +9,7 @@
* University Of British Columbia - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylar.tasklist.report.internal;
+package org.eclipse.mylar.tasklist.planner.internal;
import java.util.ArrayList;
import java.util.List;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/ui/CompletedTasksContentProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/ui/CompletedTasksContentProvider.java
index d9aa92277..181ce70ea 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/ui/CompletedTasksContentProvider.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/ui/CompletedTasksContentProvider.java
@@ -9,7 +9,7 @@
* University Of British Columbia - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylar.tasklist.report.ui;
+package org.eclipse.mylar.tasklist.planner.ui;
import java.util.List;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/ui/CompletedTasksEditorInput.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/ui/CompletedTasksEditorInput.java
index aff4bd859..201480193 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/ui/CompletedTasksEditorInput.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/ui/CompletedTasksEditorInput.java
@@ -9,15 +9,15 @@
* University Of British Columbia - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylar.tasklist.report.ui;
+package org.eclipse.mylar.tasklist.planner.ui;
import java.util.List;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.mylar.tasklist.ITask;
import org.eclipse.mylar.tasklist.internal.TaskList;
-import org.eclipse.mylar.tasklist.report.internal.CompletedTaskCollector;
-import org.eclipse.mylar.tasklist.report.internal.TaskReportGenerator;
+import org.eclipse.mylar.tasklist.planner.internal.CompletedTaskCollector;
+import org.eclipse.mylar.tasklist.planner.internal.TaskReportGenerator;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IPersistableElement;
@@ -47,7 +47,7 @@ public class CompletedTasksEditorInput implements IEditorInput {
}
public String getName() {
- return "Planning Game Report";
+ return "Task Planner";
}
public IPersistableElement getPersistable() {
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/ui/CompletedTasksLabelProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/ui/CompletedTasksLabelProvider.java
index 1e76fb164..46e0a2496 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/ui/CompletedTasksLabelProvider.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/ui/CompletedTasksLabelProvider.java
@@ -9,7 +9,7 @@
* University Of British Columbia - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylar.tasklist.report.ui;
+package org.eclipse.mylar.tasklist.planner.ui;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/ui/CompletedTasksSorter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/ui/CompletedTasksSorter.java
index 357116aa5..66e756fd3 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/ui/CompletedTasksSorter.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/ui/CompletedTasksSorter.java
@@ -9,7 +9,7 @@
* University Of British Columbia - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylar.tasklist.report.ui;
+package org.eclipse.mylar.tasklist.planner.ui;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerSorter;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/ui/PlanningGameEditorPart.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/ui/MylarTaskPlannerEditorPart.java
index 5da135081..e23d6c174 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/ui/PlanningGameEditorPart.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/ui/MylarTaskPlannerEditorPart.java
@@ -9,7 +9,7 @@
* University Of British Columbia - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylar.tasklist.report.ui;
+package org.eclipse.mylar.tasklist.planner.ui;
import java.util.Arrays;
@@ -58,9 +58,10 @@ import org.eclipse.ui.forms.widgets.TableWrapLayout;
import org.eclipse.ui.part.EditorPart;
/**
- * @author Ken Sueda
+ * @author Mik Kersten
+ * @author Ken Sueda (original prototype)
*/
-public class PlanningGameEditorPart extends EditorPart {
+public class MylarTaskPlannerEditorPart extends EditorPart {
private CompletedTasksEditorInput editorInput = null;
private Table completedTable;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/ui/PlanningGameWizard.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/ui/MylarTaskPlannerWizard.java
index cfc0e19c5..27f16d2ec 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/ui/PlanningGameWizard.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/ui/MylarTaskPlannerWizard.java
@@ -9,7 +9,7 @@
* University Of British Columbia - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylar.tasklist.report.ui;
+package org.eclipse.mylar.tasklist.planner.ui;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
@@ -24,10 +24,10 @@ import org.eclipse.ui.PartInitException;
/**
* @author Ken Sueda
*/
-public class PlanningGameWizard extends Wizard implements INewWizard {
+public class MylarTaskPlannerWizard extends Wizard implements INewWizard {
- private PlanningGameWizardPage planningGamePage = null;
- public PlanningGameWizard() {
+ private MylarTaskPlannerWizardPage planningGamePage = null;
+ public MylarTaskPlannerWizard() {
super();
init();
}
@@ -44,7 +44,7 @@ public class PlanningGameWizard extends Wizard implements INewWizard {
MylarTasklistPlugin.getTaskListManager().getTaskList());
page.openEditor(input, MylarTasklistPlugin.PLANNING_GAME_EDITOR_ID);
} catch (PartInitException ex) {
- MylarPlugin.log(ex, "coudln't open summary editor");
+ MylarPlugin.log(ex, "couldn't open summary editor");
}
return true;
}
@@ -53,7 +53,7 @@ public class PlanningGameWizard extends Wizard implements INewWizard {
}
private void init() {
- planningGamePage = new PlanningGameWizardPage();
+ planningGamePage = new MylarTaskPlannerWizardPage();
super.setForcePreviousAndNextButtons(true);
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/ui/PlanningGameWizardPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/ui/MylarTaskPlannerWizardPage.java
index 810616396..328984826 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/ui/PlanningGameWizardPage.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/ui/MylarTaskPlannerWizardPage.java
@@ -9,7 +9,7 @@
* University Of British Columbia - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylar.tasklist.report.ui;
+package org.eclipse.mylar.tasklist.planner.ui;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
@@ -21,29 +21,35 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
/**
- * @author Ken Sueda
+ * @author Mik Kersten
+ * @author Ken Sueda (original prototype)
*/
-public class PlanningGameWizardPage extends WizardPage {
+public class MylarTaskPlannerWizardPage extends WizardPage {
+ private static final String DEFAULT_DAYS = "7";
+ private static final String TITLE = "Mylar Task Planner";
+ private static final String DESCRIPTION =
+ "Summarizes task activity and assists planning future tasks.";
+
private Text numDays;
private int num = 0;
- public PlanningGameWizardPage() {
- super("Planning Game Wizard");
- setTitle("Planning Game Report");
- setDescription("All tasks completed with the last selected date will be summarized into a report");
+ public MylarTaskPlannerWizardPage() {
+ super(TITLE);
+ setTitle(TITLE);
+ setDescription(DESCRIPTION);
}
public void createControl(Composite parent) {
Composite container = new Composite(parent, SWT.NULL);
GridLayout layout = new GridLayout();
container.setLayout(layout);
- layout.numColumns = 2;
-
+ layout.numColumns = 2;
Label l = new Label(container, SWT.NULL);
- l.setText("Number of days to compile reports over: ");
+ l.setText("Number of past days to report on: ");
numDays = new Text(container, SWT.BORDER);
+ numDays.setText(DEFAULT_DAYS);
numDays.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
try{
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/ui/PlannedTasksContentProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/ui/PlannedTasksContentProvider.java
index 235926765..c12dd96ff 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/ui/PlannedTasksContentProvider.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/ui/PlannedTasksContentProvider.java
@@ -9,7 +9,7 @@
* University Of British Columbia - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylar.tasklist.report.ui;
+package org.eclipse.mylar.tasklist.planner.ui;
import java.util.ArrayList;
import java.util.List;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/ui/PlannedTasksLabelProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/ui/PlannedTasksLabelProvider.java
index f91eb57de..8008a9a7e 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/ui/PlannedTasksLabelProvider.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/ui/PlannedTasksLabelProvider.java
@@ -9,7 +9,7 @@
* University Of British Columbia - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylar.tasklist.report.ui;
+package org.eclipse.mylar.tasklist.planner.ui;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/ui/PlannedTasksSorter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/ui/PlannedTasksSorter.java
index 1fbb049b2..4d55c7eaa 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/ui/PlannedTasksSorter.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/ui/PlannedTasksSorter.java
@@ -9,7 +9,7 @@
* University Of British Columbia - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylar.tasklist.report.ui;
+package org.eclipse.mylar.tasklist.planner.ui;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerSorter;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/ui/ReminderCellEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/ui/ReminderCellEditor.java
index 2f51614a8..1a031c73b 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/report/ui/ReminderCellEditor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/planner/ui/ReminderCellEditor.java
@@ -8,7 +8,7 @@
* Contributors:
* University Of British Columbia - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylar.tasklist.report.ui;
+package org.eclipse.mylar.tasklist.planner.ui;
import java.util.Date;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/AutoCloseAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/AutoCloseAction.java
index 0cd95401c..ed5936211 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/AutoCloseAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/AutoCloseAction.java
@@ -21,7 +21,7 @@ import org.eclipse.mylar.tasklist.MylarTasklistPlugin;
public class AutoCloseAction extends Action {
public static final String ID = "org.eclipse.mylar.tasklist.actions.auto.close";
- private static final String LABEL = "Close Editors On Context Switch";
+ private static final String LABEL = "Auto Close Editors";
public AutoCloseAction() {
setText(LABEL);
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/DropDownTaskNavigateAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/DropDownTaskNavigateAction.java
index 23d66aad7..479a7045a 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/DropDownTaskNavigateAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/DropDownTaskNavigateAction.java
@@ -67,7 +67,7 @@ public abstract class DropDownTaskNavigateAction extends Action implements IMenu
}
public void run(){
- new TaskActivateAction(targetTask).run();
+ new TaskActivateAction().run(targetTask);
taskHistory.navigatedToTask(targetTask); //Notify the task history of arbitrary history navigation
setButtonStatus();
view.getViewer().refresh();
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/NextTaskDropDownAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/NextTaskDropDownAction.java
index a04bd99ee..d04ac4ccc 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/NextTaskDropDownAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/NextTaskDropDownAction.java
@@ -51,7 +51,7 @@ public class NextTaskDropDownAction extends DropDownTaskNavigateAction {
public void run() {
if (taskHistory.hasNext()) {
- new TaskActivateAction(taskHistory.getNextTask()).run();
+ new TaskActivateAction().run(taskHistory.getNextTask());
setButtonStatus();
view.getViewer().refresh();
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/PreviousTaskDropDownAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/PreviousTaskDropDownAction.java
index a8029ffc6..3e04120a9 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/PreviousTaskDropDownAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/PreviousTaskDropDownAction.java
@@ -51,7 +51,7 @@ public class PreviousTaskDropDownAction extends DropDownTaskNavigateAction {
public void run() {
if (taskHistory.hasPrevious()) {
- new TaskActivateAction(taskHistory.getPreviousTask()).run();
+ new TaskActivateAction().run(taskHistory.getPreviousTask());
setButtonStatus();
view.getViewer().refresh();
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/TaskActivateAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/TaskActivateAction.java
index 44866a6ae..d2ac31c36 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/TaskActivateAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/TaskActivateAction.java
@@ -14,10 +14,10 @@ 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.jface.viewers.IStructuredSelection;
import org.eclipse.mylar.core.MylarPlugin;
import org.eclipse.mylar.tasklist.ITask;
import org.eclipse.mylar.tasklist.MylarTasklistPlugin;
+import org.eclipse.mylar.tasklist.TaskListImages;
import org.eclipse.mylar.tasklist.ui.views.TaskListView;
import org.eclipse.ui.IViewActionDelegate;
import org.eclipse.ui.IViewPart;
@@ -28,37 +28,34 @@ import org.eclipse.ui.IViewPart;
public class TaskActivateAction extends Action implements IViewActionDelegate {
public static final String ID = "org.eclipse.mylar.tasklist.actions.context.activate";
-
- private ITask task = null;
- public TaskActivateAction() {
- // plugin.xml activation
- }
+ public ITask task = null;
- public TaskActivateAction(ITask task) {
- this.task = task;
+ public TaskActivateAction() {
setId(ID);
+ setText("Activate");
+ setImageDescriptor(TaskListImages.TASK_ACTIVE);
}
- public void run() {
- MylarPlugin.getContextManager().actionObserved(this, Boolean.TRUE.toString());
- MylarTasklistPlugin.getTaskListManager().activateTask(task);
- }
-
public void init(IViewPart view) {
// TODO Auto-generated method stub
}
- public void run(IAction action) {
- ISelection selection = TaskListView.getDefault().getViewer().getSelection();
- if (selection instanceof IStructuredSelection) {
- Object element = ((IStructuredSelection)selection).getFirstElement();
- if (element instanceof ITask) {
- MylarTasklistPlugin.getTaskListManager().activateTask((ITask)element);
- }
+ public void run() {
+ MylarPlugin.getContextManager().actionObserved(this, Boolean.TRUE.toString());
+ run(TaskListView.getDefault().getSelectedTask());
+ }
+
+ public void run(ITask task) {
+ if (task != null) {
+ MylarTasklistPlugin.getTaskListManager().activateTask(task);
}
}
+
+ 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/TaskDeactivateAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/TaskDeactivateAction.java
index 2595b6ed9..ea2276d29 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/TaskDeactivateAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/TaskDeactivateAction.java
@@ -15,37 +15,38 @@ import org.eclipse.jface.action.Action;
import org.eclipse.mylar.core.MylarPlugin;
import org.eclipse.mylar.tasklist.ITask;
import org.eclipse.mylar.tasklist.MylarTasklistPlugin;
+import org.eclipse.mylar.tasklist.TaskListImages;
import org.eclipse.mylar.tasklist.ui.views.TaskListView;
import org.eclipse.ui.IWorkbenchPage;
/**
- * @author Mik Kersten and Ken Sueda
+ * @author Mik Kersten
*/
public class TaskDeactivateAction extends Action {
public static final String ID = "org.eclipse.mylar.tasklist.actions.context.deactivate";
-
- private ITask task;
- private final TaskListView view;
-
- public TaskDeactivateAction(ITask task, TaskListView view) {
- this.task = task;
- this.view = view;
+
+ public TaskDeactivateAction() {
setId(ID);
+ setText("Deactivate");
+ setImageDescriptor(TaskListImages.TASK_INACTIVE);
}
- public void run() {
+ public void run(ITask task) {
MylarPlugin.getContextManager().actionObserved(this, Boolean.FALSE.toString());
- MylarTasklistPlugin.getTaskListManager().deactivateTask(task);
IWorkbenchPage page = MylarTasklistPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
-
- // if we couldn't get the page, get out of here
- if (page == null)
- return;
+ if (page == null) return;
try {
- this.view.closeTaskEditors(task, page);
+ if (task != null) {
+ MylarTasklistPlugin.getTaskListManager().deactivateTask(task);
+ TaskListView.getDefault().closeTaskEditors(task, page);
+ }
} catch (Exception e) {
MylarPlugin.log(e, " Closing task editor on task deactivation failed");
- }
+ }
+ }
+
+ public void run() {
+ run(TaskListView.getDefault().getSelectedTask());
}
} \ No newline at end of file
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 3ee326d20..3018c37f0 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
@@ -31,11 +31,12 @@ import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.CheckboxCellEditor;
import org.eclipse.jface.viewers.ComboBoxCellEditor;
-import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.ICellModifier;
-import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.IOpenListener;
+import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.OpenEvent;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TextCellEditor;
@@ -46,12 +47,12 @@ 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.ITaskListCategory;
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.ITaskListDynamicSubMenuContributor;
import org.eclipse.mylar.tasklist.ITaskListElement;
import org.eclipse.mylar.tasklist.MylarTasklistPlugin;
@@ -128,7 +129,8 @@ public class TaskListView extends ViewPart {
public static final String ID = "org.eclipse.mylar.tasks.ui.views.TaskListView";
private static final String SEPARATOR_ID_REPORTS = "reports";
-
+ private static final String PART_NAME = "Mylar Tasks";
+
private static TaskListView INSTANCE;
FilteredTree tree;
@@ -142,8 +144,7 @@ public class TaskListView extends ViewPart {
private CopyDescriptionAction copyAction;
private OpenTaskEditorAction openAction;
- private CreateTaskAction createTask;
- private CreateTaskAction createTaskToolbar;
+ private CreateTaskAction createTaskAction;
private CreateCategoryAction createCategory;
private RenameAction rename;
@@ -151,7 +152,7 @@ public class TaskListView extends ViewPart {
private CollapseAllAction collapseAll;
private DeleteAction delete;
private AutoCloseAction autoClose;
- private OpenTaskEditorAction doubleClickAction;
+ private OpenTaskEditorAction openTaskEditor;
private RemoveFromCategoryAction removeAction;
@@ -472,11 +473,11 @@ public class TaskListView extends ViewPart {
}
if (task != null) {
if (task.isActive()) {
- new TaskDeactivateAction(task, INSTANCE).run();
+ new TaskDeactivateAction().run();
nextTaskAction.setEnabled(taskHistory.hasNext());
previousTaskAction.setEnabled(taskHistory.hasPrevious());
} else {
- new TaskActivateAction(task).run();
+ new TaskActivateAction().run();
addTaskToHistory(task);
}
// getViewer().setSelection(null);
@@ -757,7 +758,7 @@ public class TaskListView extends ViewPart {
makeActions();
hookContextMenu();
- hookDoubleClickAction();
+ hookOpenAction();
contributeToActionBars();
ToolTipHandler toolTipHandler = new ToolTipHandler(getViewer().getControl().getShell());
@@ -899,16 +900,34 @@ public class TaskListView extends ViewPart {
private void fillLocalPullDown(IMenuManager manager) {
updateDrillDownActions();
- manager.add(collapseAll);
+ manager.add(new Separator("reports"));
+ manager.add(new Separator("local"));
+ manager.add(createTaskAction);
+ manager.add(createCategory);
manager.add(goBackAction);
+ manager.add(collapseAll);
// manager.add(new Separator());
+// autoClose.setEnabled(true);
+ manager.add(new Separator("context"));
manager.add(autoClose);
- autoClose.setEnabled(true);
manager.add(workOffline);
-// workOffline.setEnabled(true);
manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}
+ private void fillLocalToolBar(IToolBarManager manager) {
+// manager.removeAll();
+ manager.add(new Separator(SEPARATOR_ID_REPORTS));
+ manager.add(createTaskAction);
+ manager.add(new Separator());
+ manager.add(filterCompleteTask);
+ manager.add(filterOnPriority);
+ manager.add(new Separator());
+ manager.add(previousTaskAction);
+ manager.add(nextTaskAction);
+ manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+
+ }
+
void fillContextMenu(IMenuManager manager) {
updateDrillDownActions();
@@ -918,17 +937,19 @@ public class TaskListView extends ViewPart {
element = (ITaskListElement) selectedObject;
}
+ addAction(new TaskActivateAction(), manager, element);
+ addAction(new TaskDeactivateAction(), manager, element);
addAction(openAction, manager, element);
-// addAction(goIntoAction, manager, element);
+// addAction(openAction, manager, element);
manager.add(new Separator("tasks"));
addAction(completeTask, manager, element);
addAction(incompleteTask, manager, element);
- addAction(delete, manager, element);
- addAction(copyAction, manager, element);
+ manager.add(new Separator());
addAction(rename, manager, element);
addAction(removeAction, manager, element);
- manager.add(new Separator());
- addAction(createTask, manager, element);
+ addAction(delete, manager, element);
+ addAction(copyAction, manager, element);
+// addAction(createTask, manager, element);
manager.add(new Separator("context"));
for (ITaskListDynamicSubMenuContributor contributor : MylarTasklistPlugin.getDefault().getDynamicMenuContributers()) {
@@ -1026,10 +1047,6 @@ public class TaskListView extends ViewPart {
// }
}
- /**
- * @see org.eclipse.pde.internal.ui.view.HistoryDropDownAction
- *
- */
private void makeActions() {
copyAction = new CopyDescriptionAction(this);
@@ -1040,8 +1057,7 @@ public class TaskListView extends ViewPart {
// goIntoAction = new GoIntoAction(drillDownAdapter);
goBackAction = new GoUpAction(drillDownAdapter);
- createTask = new CreateTaskAction(this);
- createTaskToolbar = new CreateTaskAction(this);
+ createTaskAction = new CreateTaskAction(this);
createCategory = new CreateCategoryAction(this);
removeAction = new RemoveFromCategoryAction(this);
rename = new RenameAction(this);
@@ -1051,13 +1067,12 @@ public class TaskListView extends ViewPart {
autoClose = new AutoCloseAction();
completeTask = new MarkTaskCompleteAction(this);
incompleteTask = new MarkTaskIncompleteAction(this);
- doubleClickAction = new OpenTaskEditorAction(this);
+ openTaskEditor = new OpenTaskEditorAction(this);
filterCompleteTask = new FilterCompletedTasksAction(this);
filterOnPriority = new PriorityDropDownAction();
previousTaskAction = new PreviousTaskDropDownAction(this, taskHistory);
nextTaskAction = new NextTaskDropDownAction(this, taskHistory);
}
-
public void toggleNextAction(boolean enable) {
nextTaskAction.setEnabled(enable);
@@ -1117,11 +1132,11 @@ public class TaskListView extends ViewPart {
}
}
- private void hookDoubleClickAction() {
- getViewer().addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- doubleClickAction.run();
- }
+ private void hookOpenAction() {
+ getViewer().addOpenListener(new IOpenListener() {
+ public void open(OpenEvent event) {
+ openTaskEditor.run();
+ }
});
}
@@ -1204,25 +1219,9 @@ public class TaskListView extends ViewPart {
return COMPLETE_FILTER;
}
-
public TaskPriorityFilter getPriorityFilter() {
return PRIORITY_FILTER;
}
-
- private void fillLocalToolBar(IToolBarManager manager) {
- manager.removeAll();
- manager.add(createTaskToolbar);
- manager.add(createCategory);
- manager.add(new Separator(SEPARATOR_ID_REPORTS));
- manager.add(new Separator());
- manager.add(filterCompleteTask);
- manager.add(filterOnPriority);
-// manager.add(new Separator());
- manager.add(previousTaskAction);
- manager.add(nextTaskAction);
- manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
-
- }
public void addFilter(ITaskFilter filter) {
if (!filters.contains(filter)) filters.add(filter);
@@ -1276,279 +1275,24 @@ public class TaskListView extends ViewPart {
updateDrillDownActions();
}
-}
-
-//TextTransfer textTransfer = TextTransfer.getInstance();
-//DropTarget target = new DropTarget(viewer.getTree(), DND.DROP_MOVE);
-//target.setTransfer(new Transfer[] { textTransfer });
-//target.addDropListener(new TaskListDropTargetListener(parent, null, textTransfer, true));
-//
-//DragSource source = new DragSouarce(viewer.getTree(), DND.DROP_MOVE);
-//source.setTransfer(types);
-
-//source.addDragListener(new DragSourceListener() {
-//public void dragStart(DragSourceEvent event) {
-// if (((StructuredSelection)viewer.getSelection()).isEmpty()) {
-// event.doit = false;
-// }
-//}
-//public void dragSetData(DragSourceEvent event) {
-// StructuredSelection selection = (StructuredSelection) viewer.getSelection();
-// if (!selection.isEmpty()) {
-// event.data = "" + ((ITask)selection.getFirstElement()).getId();
-// } else {
-// event.data = "null";
-// }
-//}
-//
-//public void dragFinished(DragSourceEvent event) { }
-//});
-
-
-// public boolean getServerStatus() {
-// return serverStatus;
-// }
-//
-// /**
-// * Sets whether or not we could connect to the Bugzilla server. If
-// * necessary, the corresponding label in the view is updated.
-// *
-// * @param canRead
-// * <code>true</code> if the Bugzilla server could be connected
-// * to
-// */
-// public void setServerStatus(boolean canRead) {
-// if (serverStatus != canRead) {
-// serverStatus = canRead;
-// updateServerStatusLabel();
-// }
-// }
-//
-// private void updateServerStatusLabel() {
-// if (serverStatusLabel.isDisposed()) {
-// return;
-// }
-// if (serverStatus) {
-// serverStatusLabel.setText(CAN_READ_LABEL);
-// }
-// else {
-// serverStatusLabel.setText(CANNOT_READ_LABEL);
-// }
-// }
-//
-// private class ServerPingJob extends Job {
-// private boolean shouldCheckAgain = true;
-// private int counter = 0;
-//
-// public ServerPingJob(String name) {
-// super(name);
-// }
-//
-// public void stopPinging() {
-// shouldCheckAgain = false;
-// }
-//
-// protected IStatus run(IProgressMonitor monitor) {
-// while (shouldCheckAgain) {
-// try {
-// final boolean canReadFromServer = TaskListView.checkServer();
-// Workbench.getInstance().getDisplay().asyncExec(new Runnable() {
-// public void run() {
-// setServerStatus(canReadFromServer);
-// }
-// });
-// Thread.sleep(10000/*MylarPreferencePage.getServerPing()*5000*/);
-// } catch (InterruptedException e) {
-// break;
-// }
-// }
-// return new Status(IStatus.OK, MylarPlugin.IDENTIFIER, IStatus.OK, "", null);
-// }
-// }
-//
-// /**
-// * @return <code>true</code> if we could connect to the Bugzilla server
-// */
-// public static boolean checkServer() {
-// boolean canRead = true;
-// BufferedReader in = null;
-//
-// // Call this function to intialize the Bugzilla url that the repository
-// // is using.
-// BugzillaRepository.getInstance();
-//
-// try {
-// // connect to the bugzilla server
-// SSLContext ctx = SSLContext.getInstance("TLS");
-// javax.net.ssl.TrustManager[] tm = new javax.net.ssl.TrustManager[]{new TrustAll()};
-// ctx.init(null, tm, null);
-// HttpsURLConnection.setDefaultSSLSocketFactory(ctx.getSocketFactory());
-// String urlText = "";
-//
-// // use the usename and password to get into bugzilla if we have it
-// if(BugzillaPreferences.getUserName() != null && !BugzillaPreferences.getUserName().equals("") && BugzillaPreferences.getPassword() != null && !BugzillaPreferences.getPassword().equals(""))
-// {
-// /*
-// * The UnsupportedEncodingException exception for
-// * URLEncoder.encode() should not be thrown, since every
-// * implementation of the Java platform is required to support
-// * the standard charset "UTF-8"
-// */
-// try {
-// urlText += "?GoAheadAndLogIn=1&Bugzilla_login=" + URLEncoder.encode(BugzillaPreferences.getUserName(), "UTF-8") + "&Bugzilla_password=" + URLEncoder.encode(BugzillaPreferences.getPassword(), "UTF-8");
-// } catch (UnsupportedEncodingException e) { }
-// }
-//
-// URL url = new URL(BugzillaRepository.getURL() + "/enter_bug.cgi" + urlText);
-//
-// // create a new input stream for getting the bug
-// in = new BufferedReader(new InputStreamReader(url.openStream()));
-// }
-// catch (Exception e) {
-// // If there was an IOException, then there was a problem connecting.
-// // If there was some other exception, then it was a problem not
-// // related to the server.
-// if (e instanceof IOException) {
-// canRead = false;
-// }
-// }
-//
-// // Close the BufferedReader if we opened one.
-// try {
-// if (in != null)
-// in.close();
-// } catch(IOException e) {}
-//
-// return canRead;
-// }
-//
-// public void dispose() {
-// if (serverPingJob != null) {
-// serverPingJob.stopPinging();
-// }
-// super.dispose();
-// }
-
-// source.addDragListener(new DragSourceListener() {
-//
-// public void dragStart(DragSourceEvent event) {
-// if (((StructuredSelection) viewer.getSelection()).getFirstElement() == null) {
-// event.doit = false;
-// }
-// }
-//
-// public void dragSetData(DragSourceEvent event) {
-// StructuredSelection selection = (StructuredSelection)viewer.getSelection();
-// ITask task = (ITask) selection.getFirstElement();
-// if (task != null) {
-// event.data = "" + task.getId();
-// } else {
-// event.data = " ";
-// }
-// }
-//
-// public void dragFinished(DragSourceEvent event) {
-// StructuredSelection selection = (StructuredSelection)viewer.getSelection();
-// if (selection.isEmpty()) {
-// return;
-// } else {
-// ITask task = (ITask) selection.getFirstElement();
-//
-//
-// }
-// }
-//
-// });
+ public ITask getSelectedTask() {
+ ISelection selection = getViewer().getSelection();
+ if (selection.isEmpty()) return null;
+ if (selection instanceof StructuredSelection) {
+ StructuredSelection structuredSelection = (StructuredSelection)selection;
+ if (structuredSelection.getFirstElement() instanceof ITask) {
+ return (ITask)structuredSelection.getFirstElement();
+ }
+ }
+ return null;
+ }
-//private ViewerFilter completeFilter = new ViewerFilter(){
-//@Override
-//public boolean select(Viewer viewer, Object parentElement, Object element) {
-// if (element instanceof ITaskListElement) {
-// if(element instanceof ITask && ((ITaskListElement)element).hasCorrespondingActivatableTask()){
-// ITask task = ((ITaskListElement)element).getOrCreateCorrespondingTask();
-// if (task.isActive()) {
-// return true;
-// }
-// if(task != null){
-// return !task.isCompleted();
-// } else {
-// return true;
-// }
-// } else {
-// return true;
-// }
-// }
-// return false;
-//}
-//};
-//
-//private ViewerFilter inCompleteFilter = new ViewerFilter(){
-//@Override
-//public boolean select(Viewer viewer, Object parentElement, Object element) {
-// if (element instanceof ITask) {
-// return ((ITask)element).isCompleted();
-// } else {
-// return true;
-// }
-//}
-//};
-//
-//public class PriorityFilter extends ViewerFilter {
-//private List<String> priorities = new ArrayList<String>();
-//
-//public PriorityFilter() {
-// displayPrioritiesAbove(MylarTasklistPlugin.getPriorityLevel());
-//}
-//
-//public void displayPrioritiesAbove(String p) {
-// priorities.clear();
-// if (p.equals(PRIORITY_LEVELS[0])) {
-// priorities.add(PRIORITY_LEVELS[0]);
-// }
-// if (p.equals(PRIORITY_LEVELS[1])) {
-// priorities.add(PRIORITY_LEVELS[0]);
-// priorities.add(PRIORITY_LEVELS[1]);
-// } else if (p.equals(PRIORITY_LEVELS[2])) {
-// priorities.add(PRIORITY_LEVELS[0]);
-// priorities.add(PRIORITY_LEVELS[1]);
-// priorities.add(PRIORITY_LEVELS[2]);
-// } else if (p.equals(PRIORITY_LEVELS[3])) {
-// priorities.add(PRIORITY_LEVELS[0]);
-// priorities.add(PRIORITY_LEVELS[1]);
-// priorities.add(PRIORITY_LEVELS[2]);
-// priorities.add(PRIORITY_LEVELS[3]);
-// } else if (p.equals(PRIORITY_LEVELS[4])) {
-// priorities.add(PRIORITY_LEVELS[0]);
-// priorities.add(PRIORITY_LEVELS[1]);
-// priorities.add(PRIORITY_LEVELS[2]);
-// priorities.add(PRIORITY_LEVELS[3]);
-// priorities.add(PRIORITY_LEVELS[4]);
-// }
-//}
-//
-//@Override
-//public boolean select(Viewer viewer, Object parentElement, Object element) {
-// if (element instanceof ITaskListElement) {
-// ITaskListElement task = (ITaskListElement) element;
-// if (priorities.size() == PRIORITY_LEVELS.length) {
-// return true;
-// } else {
-// return checkTask(task);
-// }
-// } else {
-// return true;
-// }
-//}
-//private boolean checkTask(ITaskListElement task) {
-// if (task instanceof ITask && ((ITask)task).isActive()) {
-// return true;
-// }
-// for (String filter : priorities) {
-// if (task.getPriority().equals(filter)) {
-// return true;
-// }
-// }
-// return false;
-//}
-//}; \ No newline at end of file
+ public void indicatePaused(boolean paused) {
+ if (paused) {
+ setPartName("(paused) " + PART_NAME);
+ } else {
+ setPartName(PART_NAME);
+ }
+ }
+} \ No newline at end of file

Back to the top