Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2005-12-07 21:37:53 +0000
committermkersten2005-12-07 21:37:53 +0000
commit883debcda93092f5364d78418f530dd32bd482ae (patch)
treee4a4c3c69ebce9e88429e6024571f5a5de4c3651
parentf5e6c5d16ace341232ae5ea493a7c0fb96fbb07d (diff)
downloadorg.eclipse.mylyn.tasks-883debcda93092f5364d78418f530dd32bd482ae.tar.gz
org.eclipse.mylyn.tasks-883debcda93092f5364d78418f530dd32bd482ae.tar.xz
org.eclipse.mylyn.tasks-883debcda93092f5364d78418f530dd32bd482ae.zip
Completed: Bug 119556: fix task list drag and drop
https://bugs.eclipse.org/bugs/show_bug.cgi?id=119556
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasklist/BugzillaTaskExternalizer.java130
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasklist/BugzillaTaskListManager.java2
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskListManagerTest.java18
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITask.java8
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/DelegatingLocalTaskExternalizer.java8
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/Task.java15
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/TaskCategory.java6
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/TaskListSavePolicy.java63
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/TaskListWriter.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/preferences/MylarTasklistPreferencePage.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/views/TaskListView.java4
11 files changed, 107 insertions, 155 deletions
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasklist/BugzillaTaskExternalizer.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasklist/BugzillaTaskExternalizer.java
index 81c877b13..b2cc85b6e 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasklist/BugzillaTaskExternalizer.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasklist/BugzillaTaskExternalizer.java
@@ -32,48 +32,58 @@ import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/**
- * The wierd thing here is that the registry gets read in as a normal
- * category, but gets written out by createRegistry
+ * The wierd thing here is that the registry gets read in as a normal category,
+ * but gets written out by createRegistry
*
* @author Mik Kersten and Ken Sueda
*/
public class BugzillaTaskExternalizer extends DelegatingLocalTaskExternalizer {
- public static final String BUGZILLA_ARCHIVE_LABEL = "Archived Reports " + DelegatingLocalTaskExternalizer.LABEL_AUTOMATIC;
+ public static final String BUGZILLA_ARCHIVE_LABEL = "Archived Reports "
+ + DelegatingLocalTaskExternalizer.LABEL_AUTOMATIC;
+
private static final String BUGZILLA = "Bugzilla";
+
private static final String LAST_DATE = "LastDate";
+
private static final String DIRTY = "Dirty";
+
private static final String SYNC_STATE = "offlineSyncState";
+
private static final String DESCRIPTION = "Description";
+
private static final String URL = "URL";
private static final String BUGZILLA_TASK_REGISTRY = "BugzillaTaskRegistry" + TAG_CATEGORY;
+
private static final String TAG_BUGZILLA_CATEGORY = "BugzillaQuery" + TAG_CATEGORY;
-
+
private static final String TAG_BUGZILLA_QUERY_HIT = "Bugzilla" + TAG_QUERY_HIT;
+
private static final String TAG_BUGZILLA_QUERY = "Bugzilla" + TAG_QUERY;
+
private static final String TAG_BUGZILLA_CUSTOM_QUERY = "BugzillaCustom" + TAG_QUERY;
-
+
private static final String TAG_TASK = "BugzillaReport";
-
+
@Override
public void createRegistry(Document doc, Node parent) {
Element node = doc.createElement(BUGZILLA_TASK_REGISTRY);
- for (BugzillaTask task : BugzillaUiPlugin.getDefault().getBugzillaTaskListManager().getBugzillaTaskRegistry().values()) {
+ for (BugzillaTask task : BugzillaUiPlugin.getDefault().getBugzillaTaskListManager().getBugzillaTaskRegistry()
+ .values()) {
try {
createTaskElement(task, doc, node);
} catch (Exception e) {
MylarPlugin.log(e, e.getMessage());
}
-
+
}
parent.appendChild(node);
- }
-
+ }
+
@Override
public boolean canReadCategory(Node node) {
- return node.getNodeName().equals(getCategoryTagName())
- || node.getNodeName().equals(BUGZILLA_TASK_REGISTRY);
+ return node.getNodeName().equals(getCategoryTagName()) || node.getNodeName().equals(BUGZILLA_TASK_REGISTRY);
}
@Override
@@ -82,20 +92,21 @@ public class BugzillaTaskExternalizer extends DelegatingLocalTaskExternalizer {
if (e.getNodeName().equals(BUGZILLA_TASK_REGISTRY)) {
readRegistry(node, taskList);
} else {
- BugzillaQueryCategory cat = new BugzillaQueryCategory(e.getAttribute(DESCRIPTION), e.getAttribute(URL), e.getAttribute(MAX_HITS));
+ BugzillaQueryCategory cat = new BugzillaQueryCategory(e.getAttribute(DESCRIPTION), e.getAttribute(URL), e
+ .getAttribute(MAX_HITS));
taskList.internalAddQuery(cat);
}
}
public String getQueryTagNameForElement(IQuery query) {
- if(query instanceof BugzillaCustomQuery){
+ if (query instanceof BugzillaCustomQuery) {
return TAG_BUGZILLA_CUSTOM_QUERY;
- } else if(query instanceof BugzillaQueryCategory){
+ } else if (query instanceof BugzillaQueryCategory) {
return TAG_BUGZILLA_QUERY;
}
return "";
}
-
+
public boolean canReadQuery(Node node) {
return node.getNodeName().equals(TAG_BUGZILLA_CUSTOM_QUERY) || node.getNodeName().equals(TAG_BUGZILLA_QUERY);
}
@@ -104,12 +115,14 @@ public class BugzillaTaskExternalizer extends DelegatingLocalTaskExternalizer {
boolean hasCaughtException = false;
Element element = (Element) node;
IQuery cat = null;
- if(node.getNodeName().equals(TAG_BUGZILLA_CUSTOM_QUERY)){
- cat = new BugzillaCustomQuery(element.getAttribute(NAME), element.getAttribute(QUERY_STRING), element.getAttribute(MAX_HITS));
- } else if(node.getNodeName().equals(TAG_BUGZILLA_QUERY)){
- cat = new BugzillaQueryCategory(element.getAttribute(NAME), element.getAttribute(QUERY_STRING), element.getAttribute(MAX_HITS));
+ if (node.getNodeName().equals(TAG_BUGZILLA_CUSTOM_QUERY)) {
+ cat = new BugzillaCustomQuery(element.getAttribute(NAME), element.getAttribute(QUERY_STRING), element
+ .getAttribute(MAX_HITS));
+ } else if (node.getNodeName().equals(TAG_BUGZILLA_QUERY)) {
+ cat = new BugzillaQueryCategory(element.getAttribute(NAME), element.getAttribute(QUERY_STRING), element
+ .getAttribute(MAX_HITS));
}
- if(cat != null){
+ if (cat != null) {
tlist.internalAddQuery(cat);
}
NodeList list = node.getChildNodes();
@@ -121,9 +134,10 @@ public class BugzillaTaskExternalizer extends DelegatingLocalTaskExternalizer {
hasCaughtException = true;
}
}
- if (hasCaughtException) throw new TaskListExternalizerException("Failed to load all tasks");
+ if (hasCaughtException)
+ throw new TaskListExternalizerException("Failed to load all tasks");
}
-
+
public void readRegistry(Node node, TaskList taskList) throws TaskListExternalizerException {
boolean hasCaughtException = false;
NodeList list = node.getChildNodes();
@@ -136,17 +150,18 @@ public class BugzillaTaskExternalizer extends DelegatingLocalTaskExternalizer {
Node child = list.item(i);
ITask task = readTask(child, taskList, null, null);
if (task instanceof BugzillaTask) {
- BugzillaUiPlugin.getDefault().getBugzillaTaskListManager()
- .addToBugzillaTaskRegistry((BugzillaTask) task);
+ BugzillaUiPlugin.getDefault().getBugzillaTaskListManager().addToBugzillaTaskRegistry(
+ (BugzillaTask) task);
}
} catch (TaskListExternalizerException e) {
hasCaughtException = true;
}
}
-
- if (hasCaughtException) throw new TaskListExternalizerException("Failed to restore all tasks");
+
+ if (hasCaughtException)
+ throw new TaskListExternalizerException("Failed to restore all tasks");
}
-
+
public boolean canCreateElementFor(ITaskCategory cat) {
return false;
}
@@ -154,26 +169,26 @@ public class BugzillaTaskExternalizer extends DelegatingLocalTaskExternalizer {
public boolean canCreateElementFor(ITask task) {
return task instanceof BugzillaTask;
}
-
+
public Element createTaskElement(ITask task, Document doc, Element parent) {
Element node = super.createTaskElement(task, doc, parent);
BugzillaTask bt = (BugzillaTask) task;
node.setAttribute(BUGZILLA, TRUE);
if (bt.getLastRefresh() != null) {
- node.setAttribute(LAST_DATE, new Long(bt.getLastRefresh()
- .getTime()).toString());
+ node.setAttribute(LAST_DATE, new Long(bt.getLastRefresh().getTime()).toString());
} else {
node.setAttribute(LAST_DATE, new Long(new Date().getTime()).toString());
}
-
+
node.setAttribute(SYNC_STATE, bt.getSyncState().toString());
-
+
if (bt.isDirty()) {
node.setAttribute(DIRTY, TRUE);
} else {
node.setAttribute(DIRTY, FALSE);
}
-// bt.saveBugReport(false); // XXX don't think that this needs to be done, should be handled already
+ // bt.saveBugReport(false); // XXX don't think that this needs to be
+ // done, should be handled already
return node;
}
@@ -183,7 +198,8 @@ public class BugzillaTaskExternalizer extends DelegatingLocalTaskExternalizer {
}
@Override
- public ITask readTask(Node node, TaskList tlist, ITaskCategory category, ITask parent) throws TaskListExternalizerException{
+ public ITask readTask(Node node, TaskList tlist, ITaskCategory category, ITask parent)
+ throws TaskListExternalizerException {
Element element = (Element) node;
String handle;
String label;
@@ -197,13 +213,12 @@ public class BugzillaTaskExternalizer extends DelegatingLocalTaskExternalizer {
} else {
throw new TaskListExternalizerException("Description not stored for bug report");
}
- BugzillaTask task = new BugzillaTask(handle, label, true, false);
+ BugzillaTask task = new BugzillaTask(handle, label, true, false);
readTaskInfo(task, tlist, element, category, parent);
-
+
task.setState(BugTaskState.FREE);
- task.setLastRefresh(new Date(new Long(element.getAttribute("LastDate"))
- .longValue()));
-
+ task.setLastRefresh(new Date(new Long(element.getAttribute("LastDate")).longValue()));
+
if (element.getAttribute("Dirty").compareTo("true") == 0) {
task.setDirty(true);
} else {
@@ -213,33 +228,32 @@ public class BugzillaTaskExternalizer extends DelegatingLocalTaskExternalizer {
if (task.readBugReport() == false) {
MylarPlugin.log("Failed to read bug report", null);
}
- } catch(Exception e) {
+ } catch (Exception e) {
MylarPlugin.log(e, "Failed to read bug report");
}
-
+
if (element.hasAttribute(SYNC_STATE)) {
String syncState = element.getAttribute(SYNC_STATE);
- if(syncState.compareTo(BugReportSyncState.OK.toString()) == 0){
+ if (syncState.compareTo(BugReportSyncState.OK.toString()) == 0) {
task.setSyncState(BugReportSyncState.OK);
- } else if(syncState.compareTo(BugReportSyncState.INCOMMING.toString()) == 0){
+ } else if (syncState.compareTo(BugReportSyncState.INCOMMING.toString()) == 0) {
task.setSyncState(BugReportSyncState.INCOMMING);
- } else if(syncState.compareTo(BugReportSyncState.OUTGOING.toString()) == 0){
+ } else if (syncState.compareTo(BugReportSyncState.OUTGOING.toString()) == 0) {
task.setSyncState(BugReportSyncState.OUTGOING);
- } else if(syncState.compareTo(BugReportSyncState.CONFLICT.toString()) == 0){
+ } else if (syncState.compareTo(BugReportSyncState.CONFLICT.toString()) == 0) {
task.setSyncState(BugReportSyncState.CONFLICT);
}
}
-
+
ITaskHandler taskHandler = MylarTaskListPlugin.getDefault().getHandlerForElement(task);
- if(taskHandler != null){
- ITask addedTask = taskHandler.taskAdded(task);
- if(addedTask instanceof BugzillaTask) task = (BugzillaTask)addedTask;
- }
+ if (taskHandler != null) {
+ ITask addedTask = taskHandler.taskAdded(task);
+ if (addedTask instanceof BugzillaTask)
+ task = (BugzillaTask) addedTask;
+ }
return task;
}
-
-
-
+
public boolean canReadQueryHit(Node node) {
return node.getNodeName().equals(getQueryHitTagName());
}
@@ -267,7 +281,7 @@ public class BugzillaTaskExternalizer extends DelegatingLocalTaskExternalizer {
}
if (element.hasAttribute(COMPLETE)) {
status = element.getAttribute(COMPLETE);
- if(status.equals(TRUE))
+ if (status.equals(TRUE))
status = "RESO";
else
status = "NEW";
@@ -277,7 +291,7 @@ public class BugzillaTaskExternalizer extends DelegatingLocalTaskExternalizer {
BugzillaHit hit = new BugzillaHit(label, priority, BugzillaTask.getBugId(handle), null, status);
query.addHit(hit);
}
-
+
@Override
public String getCategoryTagName() {
return TAG_BUGZILLA_CATEGORY;
@@ -287,9 +301,9 @@ public class BugzillaTaskExternalizer extends DelegatingLocalTaskExternalizer {
public String getTaskTagName() {
return TAG_TASK;
}
-
+
@Override
- public String getQueryHitTagName(){
+ public String getQueryHitTagName() {
return TAG_BUGZILLA_QUERY_HIT;
}
}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasklist/BugzillaTaskListManager.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasklist/BugzillaTaskListManager.java
index 4f982e10e..59d289e39 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasklist/BugzillaTaskListManager.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasklist/BugzillaTaskListManager.java
@@ -36,7 +36,7 @@ public class BugzillaTaskListManager implements IOfflineBugListener {
public void addToBugzillaTaskRegistry(BugzillaTask task){
if(bugzillaTaskRegistry.get(task.getHandleIdentifier()) == null){
bugzillaTaskRegistry.put(task.getHandleIdentifier(), task);
- if(cat != null){
+ if(cat != null) {
cat.internalAddTask(task);
}
}
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 80df3b236..e164d124a 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
@@ -104,27 +104,24 @@ public class TaskListManagerTest extends TestCase {
manager.addCategory(cat1);
Task task3 = new Task(manager.genUniqueTaskHandle(), "task 3", true);
manager.moveToCategory(cat1, task3);
-// cat1.addTask(task3);
+ assertEquals(cat1, task3.getCategory());
Task sub2 = new Task(manager.genUniqueTaskHandle(), "sub 2", true);
task3.addSubTask(sub2);
sub2.setParent(task3);
Task task4 = new Task(manager.genUniqueTaskHandle(), "task 4", true);
manager.moveToCategory(cat1, task4);
-// cat1.addTask(task4);
TaskCategory cat2 = new TaskCategory("Category 2");
manager.addCategory(cat2);
Task task5 = new Task(manager.genUniqueTaskHandle(), "task 5", true);
manager.moveToCategory(cat2, task5);
-// cat2.addTask(task5);
Task task6 = new Task(manager.genUniqueTaskHandle(), "task 6", true);
manager.moveToCategory(cat2, task6);
-// cat2.addTask(task6);
BugzillaTask report = new BugzillaTask("123", "label 123", true);
manager.moveToCategory(cat2, report);
-// cat2.addTask(report);
-
+ assertEquals(cat2, report.getCategory());
+
BugzillaTask report2 = new BugzillaTask("124", "label 124", true);
manager.moveToRoot(report2);
@@ -150,14 +147,19 @@ public class TaskListManagerTest extends TestCase {
assertEquals(3, manager.getTaskList().getCategories().size());
- readList = readCats.get(1).getChildren();
+ TaskCategory readCat = readCats.get(1);
+ readList = readCat.getChildren();
assertTrue(readList.get(0).getDescription(true).equals("task 3"));
+ assertEquals(readCat, readList.get(0).getCategory());
assertTrue(readList.get(0).getChildren().get(0).getDescription(true).equals("sub 2"));
assertTrue(readList.get(1).getDescription(true).equals("task 4"));
- readList = readCats.get(2).getChildren();
+
+ TaskCategory readCat2 = readCats.get(2);
+ readList = readCat2.getChildren();
assertTrue(readList.get(0).getDescription(true).equals("task 5"));
assertTrue(readList.get(1).getDescription(true).equals("task 6"));
assertTrue(readList.get(2) instanceof BugzillaTask);
+ assertEquals(readCat2, readList.get(2).getCategory());
}
}
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 8906e3ec5..a7eb029eb 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
@@ -16,7 +16,6 @@ package org.eclipse.mylar.tasklist;
import java.util.Date;
import java.util.List;
-import org.eclipse.mylar.tasklist.internal.TaskCategory;
import org.eclipse.mylar.tasklist.ui.ITaskListElement;
/**
@@ -87,6 +86,9 @@ public interface ITask extends ITaskListElement {
public abstract void setCategory(ITaskCategory cat);
+ /**
+ * @return null if root task
+ */
public abstract ITaskCategory getCategory();
public abstract long getElapsedMillis();
@@ -107,11 +109,11 @@ public interface ITask extends ITaskListElement {
public abstract void setReminded(boolean reminded);
- abstract void internalSetCategory(TaskCategory category);
-
public abstract boolean participatesInTaskHandles();
}
+//abstract void internalSetCategory(TaskCategory category);
+
//public abstract void setEndDate(String date);
//public abstract void setCreationDate(String date);
//public abstract void setReminderDate(String date);
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/DelegatingLocalTaskExternalizer.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/DelegatingLocalTaskExternalizer.java
index c6be57843..1fae0fddd 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/DelegatingLocalTaskExternalizer.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/DelegatingLocalTaskExternalizer.java
@@ -214,7 +214,9 @@ public class DelegatingLocalTaskExternalizer implements ITaskListExternalizer {
try {
for (ITaskListExternalizer externalizer : delegateExternalizers) {
if (externalizer.canReadTask(child)) {
- category.internalAddTask(externalizer.readTask(child, tlist, category, null));
+ ITask task = externalizer.readTask(child, tlist, category, null);
+ category.addTask(task);
+ if (!category.isArchive()) task.setCategory(category);
read = true;
}
}
@@ -344,9 +346,9 @@ public class DelegatingLocalTaskExternalizer implements ITaskListExternalizer {
ii++;
}
if (category != null) {
- task.internalSetCategory((TaskCategory) category);
+ task.setCategory((TaskCategory) category);
} else {
- task.internalSetCategory(null);
+ task.setCategory(null);
}
task.setParent(parent);
NodeList list = element.getChildNodes();
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/Task.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/Task.java
index 77c3beee7..aa0f533e8 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/Task.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/Task.java
@@ -337,28 +337,19 @@ public class Task implements ITask {
public void addSubTask(ITask t) {
children.add(t);
- if (MylarTaskListPlugin.getDefault() != null) {
- MylarTaskListPlugin.getDefault().saveTaskListAndContexts();
- }
}
public void removeSubTask(ITask t) {
children.remove(t);
- if (MylarTaskListPlugin.getDefault() != null) {
- MylarTaskListPlugin.getDefault().saveTaskListAndContexts();
- }
}
public void setCategory(ITaskCategory cat) {
this.parentCategory = cat;
- if (MylarTaskListPlugin.getDefault() != null) {
- MylarTaskListPlugin.getDefault().saveTaskListAndContexts();
- }
}
- public void internalSetCategory(TaskCategory cat) {
- this.parentCategory = cat;
- }
+// public void internalSetCategory(TaskCategory cat) {
+// this.parentCategory = cat;
+// }
public ITaskCategory getCategory() {
return parentCategory;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/TaskCategory.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/TaskCategory.java
index 86a6ab358..f6b77268a 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/TaskCategory.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/TaskCategory.java
@@ -96,7 +96,7 @@ public class TaskCategory implements ITaskCategory, Serializable {
}
/**
- * So it can be used by other externalizers
+ * HACK: public so it can be used by other externalizers
*/
public void internalAddTask(ITask task) {
tasks.add(task);
@@ -204,4 +204,8 @@ public class TaskCategory implements ITaskCategory, Serializable {
MylarPlugin.log(ex, "open failed");
}
}
+
+ public String toString() {
+ return getDescription(false);
+ }
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/TaskListSavePolicy.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/TaskListSavePolicy.java
deleted file mode 100644
index 85191a530..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/TaskListSavePolicy.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 - 2005 University Of British Columbia and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * University Of British Columbia - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylar.tasklist.internal;
-
-import java.util.List;
-
-import org.eclipse.mylar.tasklist.ITask;
-import org.eclipse.mylar.tasklist.ITaskActivityListener;
-import org.eclipse.mylar.tasklist.MylarTaskListPlugin;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-
-/**
- * @author Mik Kersten
- */
-public class TaskListSavePolicy implements ITaskActivityListener, DisposeListener {
-
- public void taskActivated(ITask task) {
-
- }
-
- public void tasksActivated(List<ITask> tasks) {
- // TODO Auto-generated method stub
-
- }
-
- public void taskDeactivated(ITask task) {
- // TODO Auto-generated method stub
-
- }
-
- public void taskChanged(ITask task) {
- if (MylarTaskListPlugin.getDefault() != null) {
- MylarTaskListPlugin.getDefault().saveTaskListAndContexts();
- }
- }
-
- public void tasklistRead() {
- // TODO Auto-generated method stub
-
- }
-
- public void tasklistModified() {
- if (MylarTaskListPlugin.getDefault() != null) {
- MylarTaskListPlugin.getDefault().saveTaskListAndContexts();
- }
- }
-
- public void widgetDisposed(DisposeEvent e) {
- if (MylarTaskListPlugin.getDefault() != null) {
- MylarTaskListPlugin.getDefault().saveTaskListAndContexts();
- }
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/TaskListWriter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/TaskListWriter.java
index 8093d62db..31b18ee62 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/TaskListWriter.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/TaskListWriter.java
@@ -358,7 +358,7 @@ public class TaskListWriter {
// and return a new DOM Document object. Also throws IOException
document = builder.parse(inputFile);
} catch (SAXException se) {
- File backup = new File(MylarTaskListPlugin.getDefault().getBackupFilePath());
+ File backup = new File(MylarTaskListPlugin.getDefault().getTaskListSaveManager().getBackupFilePath());
String message = "Restoring the tasklist failed. Would you like to attempt to restore from the backup?\n\nTasklist XML File location: "
+ inputFile.getAbsolutePath()
+ "\n\nBackup tasklist XML file location: "
@@ -366,7 +366,7 @@ public class TaskListWriter {
if (backup.exists() && MessageDialog.openQuestion(null, "Restore From Backup", message)) {
try {
document = builder.parse(backup);
- MylarTaskListPlugin.getDefault().reverseBackup();
+ MylarTaskListPlugin.getDefault().getTaskListSaveManager().reverseBackup();
} catch (SAXException s) {
inputFile.renameTo(new File(inputFile.getName() + FILE_SUFFIX_SAVE));
MylarPlugin.log(s, "Failed to recover from backup restore");
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/preferences/MylarTasklistPreferencePage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/preferences/MylarTasklistPreferencePage.java
index 850769f0e..82d2642cf 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/preferences/MylarTasklistPreferencePage.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/preferences/MylarTasklistPreferencePage.java
@@ -116,9 +116,9 @@ public class MylarTasklistPreferencePage extends PreferencePage implements IWork
taskDirectory = taskDirectory.replaceAll("\\\\", "/");
if (!taskDirectory.equals(MylarPlugin.getDefault().getMylarDataDirectory())) {
//Order matters:
- MylarTaskListPlugin.getDefault().saveTaskListAndContexts();
+ MylarTaskListPlugin.getDefault().getTaskListSaveManager().saveTaskListAndContexts();
if (copyExistingDataCheckbox.getSelection()) {
- MylarTaskListPlugin.getDefault().copyDataDirContentsTo(taskDirectory);
+ MylarTaskListPlugin.getDefault().getTaskListSaveManager().copyDataDirContentsTo(taskDirectory);
}
getPreferenceStore().setValue(MylarPlugin.MYLAR_DIR, taskDirectory);
MylarTaskListPlugin.getDefault().setDataDirectory(MylarPlugin.getDefault().getMylarDataDirectory());
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 32310b9fd..07f5ad87a 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
@@ -703,10 +703,10 @@ public class TaskListView extends ViewPart {
IMemento m = sorter.createChild("sorter");
m.putInteger("sortIndex", sortIndex);
- MylarTaskListPlugin.getDefault().createTaskListBackupFile();
+ MylarTaskListPlugin.getDefault().getTaskListSaveManager().createTaskListBackupFile();
if (MylarTaskListPlugin.getDefault() != null) {
- MylarTaskListPlugin.getDefault().saveTaskListAndContexts();
+ MylarTaskListPlugin.getDefault().getTaskListSaveManager().saveTaskListAndContexts();
}
}

Back to the top