Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2005-08-17 19:28:41 -0400
committermkersten2005-08-17 19:28:41 -0400
commit586a74715618691df252828ea5a9f22193bb4958 (patch)
tree81e22d4b4c14516b754ab3ea802f47711839ed18
parentda0d334bedfaa2bc9dc9a728c728e578bff649d3 (diff)
downloadorg.eclipse.mylyn.tasks-586a74715618691df252828ea5a9f22193bb4958.tar.gz
org.eclipse.mylyn.tasks-586a74715618691df252828ea5a9f22193bb4958.tar.xz
org.eclipse.mylyn.tasks-586a74715618691df252828ea5a9f22193bb4958.zip
Fix for Bug #106930: Task list is loosing its content after each restart
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/BugzillaUiPlugin.java5
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/MylarTasklistPlugin.java12
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/TaskCategory.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/TaskList.java7
4 files changed, 22 insertions, 6 deletions
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/BugzillaUiPlugin.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/BugzillaUiPlugin.java
index 9f1d35ea2..0627302bd 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/BugzillaUiPlugin.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/BugzillaUiPlugin.java
@@ -14,6 +14,7 @@ import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.mylar.bugzilla.core.BugzillaPlugin;
import org.eclipse.mylar.bugzilla.ui.tasklist.BugzillaRefreshManager;
import org.eclipse.mylar.bugzilla.ui.tasklist.BugzillaTaskListManager;
+import org.eclipse.mylar.tasklist.MylarTasklistPlugin;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
@@ -48,6 +49,10 @@ public class BugzillaUiPlugin extends AbstractUIPlugin {
* This method is called when the plug-in is stopped
*/
public void stop(BundleContext context) throws Exception {
+ if (MylarTasklistPlugin.getDefault() != null) {
+ MylarTasklistPlugin.getDefault().saveState();
+ }
+
super.stop(context);
plugin = null;
bugzillaRefreshManager.clearAllRefreshes();
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 f479fec5d..26fcda6fc 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
@@ -255,12 +255,11 @@ public class MylarTasklistPlugin extends AbstractUIPlugin implements IStartup {
@Override
public void stop(BundleContext context) throws Exception {
+ createFileBackup();
+
super.stop(context);
plugin = null;
resourceBundle = null;
- saveState();
- createFileBackup();
-// getPrefs().setValue(REMINDER_CHECK, true);
}
@Override
@@ -272,8 +271,6 @@ public class MylarTasklistPlugin extends AbstractUIPlugin implements IStartup {
store.setDefault(REPORT_OPEN_EXTERNAL, false);
store.setDefault(MULTIPLE_ACTIVE_TASKS, false);
store.setDefault(SAVE_TASKLIST_MODE, TaskListSaveMode.THREE_HOURS.toString());
-// store.setDefault(REMINDER_CHECK, true);
-
}
public static TaskListManager getTaskListManager() {
@@ -317,7 +314,10 @@ public class MylarTasklistPlugin extends AbstractUIPlugin implements IStartup {
return MylarPlugin.getDefault().getPreferenceStore();
}
- private void saveState() {
+ /**
+ * TODO: make private
+ */
+ public void saveState() {
taskListManager.saveTaskList();
for(ITask task : taskListManager.getTaskList().getActiveTasks()) {
MylarPlugin.getContextManager().saveContext(task.getHandle(), task.getPath());
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 266f90039..9d5be84ff 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
@@ -19,6 +19,7 @@ import java.util.List;
import org.eclipse.mylar.tasklist.AbstractCategory;
import org.eclipse.mylar.tasklist.ITask;
+import org.eclipse.mylar.tasklist.MylarTasklistPlugin;
import org.eclipse.mylar.tasklist.TaskListImages;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
@@ -58,6 +59,9 @@ public class TaskCategory extends AbstractCategory implements Serializable {
public void addTask(ITask task) {
tasks.add(task);
+ if (MylarTasklistPlugin.getDefault() != null) {
+ MylarTasklistPlugin.getDefault().saveState();
+ }
}
public void removeTask(ITask task) {
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/TaskList.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/TaskList.java
index 40cba3d2b..ec7023273 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/TaskList.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/TaskList.java
@@ -20,6 +20,7 @@ import java.util.List;
import org.eclipse.mylar.tasklist.AbstractCategory;
import org.eclipse.mylar.tasklist.ITask;
import org.eclipse.mylar.tasklist.ITaskListElement;
+import org.eclipse.mylar.tasklist.MylarTasklistPlugin;
/**
@@ -35,10 +36,16 @@ public class TaskList implements Serializable {
public void addRootTask(ITask task) {
rootTasks.add(task);
+ if (MylarTasklistPlugin.getDefault() != null) {
+ MylarTasklistPlugin.getDefault().saveState();
+ }
}
public void addCategory(AbstractCategory cat) {
categories.add(cat);
+ if (MylarTasklistPlugin.getDefault() != null) {
+ MylarTasklistPlugin.getDefault().saveState();
+ }
}
public void setActive(ITask task, boolean active) {

Back to the top