Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsminto2005-08-19 15:53:42 -0400
committersminto2005-08-19 15:53:42 -0400
commitbaaedd28e0359d90310c8df531fda4e59e790e37 (patch)
treee2a2d21161c912d9bff1e1eb5cfb22d46f043fe0
parent9147577b0fc2b516fb2724266e183c9b63b32fd4 (diff)
downloadorg.eclipse.mylyn.tasks-baaedd28e0359d90310c8df531fda4e59e790e37.tar.gz
org.eclipse.mylyn.tasks-baaedd28e0359d90310c8df531fda4e59e790e37.tar.xz
org.eclipse.mylyn.tasks-baaedd28e0359d90310c8df531fda4e59e790e37.zip
fixed Bug #107351: Startup slow
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/core/BugzillaPlugin.java1
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/core/offline/OfflineReportsFile.java2
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/BugzillaUiPlugin.java5
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasklist/BugzillaTaskExternalizer.java2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITask.java2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/MylarTasklistPlugin.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/Task.java13
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/DefaultTaskListExternalizer.java10
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/TaskCategory.java7
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/TaskList.java17
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/TaskListExternalizer.java8
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/views/TaskListView.java12
12 files changed, 63 insertions, 20 deletions
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/core/BugzillaPlugin.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/core/BugzillaPlugin.java
index affa090ed..c1f1cae51 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/core/BugzillaPlugin.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/core/BugzillaPlugin.java
@@ -193,6 +193,7 @@ public class BugzillaPlugin extends AbstractUIPlugin {
offlineReportsFile = new OfflineReportsFile(offlineReportsPath.toFile());
} catch (Exception e) {
logAndShowExceptionDetailsDialog(e, "occurred while restoring saved offline Bugzilla reports.", "Bugzilla Offline Reports Error");
+ offlineReportsPath.toFile().delete();
}
}
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/core/offline/OfflineReportsFile.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/core/offline/OfflineReportsFile.java
index 3dd92b7c8..197090aec 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/core/offline/OfflineReportsFile.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/core/offline/OfflineReportsFile.java
@@ -185,8 +185,6 @@ public class OfflineReportsFile
}
}
in.close();
-
- sort(lastSel);
}
/**
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 0627302bd..9f1d35ea2 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,7 +14,6 @@ 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;
@@ -49,10 +48,6 @@ 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.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 d0c2b5c17..efbdd6e49 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
@@ -74,7 +74,7 @@ public class BugzillaTaskExternalizer extends DefaultTaskListExternalizer {
readRegistry(node, taskList);
} else {
BugzillaQueryCategory cat = new BugzillaQueryCategory(e.getAttribute(DESCRIPTION), e.getAttribute(URL), e.getAttribute(MAX_HITS));
- taskList.addCategory(cat);
+ taskList.internalAddCategory(cat);
}
}
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 2a748e0c0..5a29a92f7 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
@@ -115,4 +115,6 @@ public interface ITask extends Serializable, ITaskListElement {
public abstract boolean hasBeenReminded();
public abstract void setReminded(boolean reminded);
+
+ abstract void internalSetCategory(TaskCategory category);
} \ No newline at end of file
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 26fcda6fc..2b5cf806c 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
@@ -178,7 +178,7 @@ public class MylarTasklistPlugin extends AbstractUIPlugin implements IStartup {
private static ShellListener SHELL_LISTENER = new ShellListener() {
public void shellClosed(ShellEvent arg0) {
- getDefault().saveState();
+// getDefault().saveState();
}
/**
@@ -196,7 +196,7 @@ public class MylarTasklistPlugin extends AbstractUIPlugin implements IStartup {
public void shellDeiconified(ShellEvent arg0) { }
public void shellIconified(ShellEvent arg0) {
- getDefault().saveState();
+// getDefault().saveState();
}
};
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 9bc23309a..70fb43aa8 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
@@ -316,14 +316,27 @@ public class Task implements ITask {
public void addSubTask(ITask t) {
children.add(t);
+ if (MylarTasklistPlugin.getDefault() != null) {
+ MylarTasklistPlugin.getDefault().saveState();
+ }
}
public void removeSubTask(ITask t) {
children.remove(t);
+ if (MylarTasklistPlugin.getDefault() != null) {
+ MylarTasklistPlugin.getDefault().saveState();
+ }
}
public void setCategory(TaskCategory cat) {
this.parentCategory = cat;
+ if (MylarTasklistPlugin.getDefault() != null) {
+ MylarTasklistPlugin.getDefault().saveState();
+ }
+ }
+
+ public void internalSetCategory(TaskCategory cat) {
+ this.parentCategory = cat;
}
public TaskCategory getCategory() {
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 dff1f3df7..2349f367d 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
@@ -137,7 +137,7 @@ public class DefaultTaskListExternalizer implements ITaskListExternalizer {
boolean hasCaughtException = false;
Element element = (Element) node;
TaskCategory category = new TaskCategory(element.getAttribute("Name"));
- tlist.addCategory(category);
+ tlist.internalAddCategory(category);
NodeList list = node.getChildNodes();
for (int i = 0; i < list.getLength(); i++) {
Node child = list.item(i);
@@ -145,13 +145,13 @@ public class DefaultTaskListExternalizer implements ITaskListExternalizer {
try {
for (ITaskListExternalizer externalizer : externalizers) {
if (externalizer.canReadTask(child)) {
- category.addTask(externalizer.readTask(child, tlist,
+ category.internalAddTask(externalizer.readTask(child, tlist,
category, null));
read = true;
}
}
if (!read && canReadTask(child)) {
- category.addTask(readTask(child, tlist, category, null));
+ category.internalAddTask(readTask(child, tlist, category, null));
}
} catch (MylarExternalizerException e) {
hasCaughtException = true;
@@ -250,9 +250,9 @@ public class DefaultTaskListExternalizer implements ITaskListExternalizer {
i++;
}
if (category != null) {
- task.setCategory((TaskCategory) category);
+ task.internalSetCategory((TaskCategory) category);
} else {
- task.setCategory(null);
+ task.internalSetCategory(null);
}
task.setParent(parent);
NodeList list = element.getChildNodes();
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 9d5be84ff..a22d5d6ab 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
@@ -64,8 +64,15 @@ public class TaskCategory extends AbstractCategory implements Serializable {
}
}
+ void internalAddTask(ITask task) {
+ tasks.add(task);
+ }
+
public void removeTask(ITask task) {
tasks.remove(task);
+ if (MylarTasklistPlugin.getDefault() != null) {
+ MylarTasklistPlugin.getDefault().saveState();
+ }
}
public List<ITask> getChildren() {
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 ec7023273..54d3364b9 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
@@ -41,6 +41,10 @@ public class TaskList implements Serializable {
}
}
+ void internalAddRootTask(ITask task) {
+ rootTasks.add(task);
+ }
+
public void addCategory(AbstractCategory cat) {
categories.add(cat);
if (MylarTasklistPlugin.getDefault() != null) {
@@ -48,6 +52,13 @@ public class TaskList implements Serializable {
}
}
+ /**
+ * XXX Only public so that other externalizers can use it
+ */
+ public void internalAddCategory(AbstractCategory cat) {
+ categories.add(cat);
+ }
+
public void setActive(ITask task, boolean active) {
task.setActive(active);
if (active && !activeTasks.contains(task)) {
@@ -67,6 +78,9 @@ public class TaskList implements Serializable {
}
}
}
+ if (MylarTasklistPlugin.getDefault() != null) {
+ MylarTasklistPlugin.getDefault().saveState();
+ }
}
private boolean deleteTaskHelper(List<ITask> tasks, ITask t) {
@@ -84,6 +98,9 @@ public class TaskList implements Serializable {
public void deleteCategory(AbstractCategory category) {
categories.remove(category);
+ if (MylarTasklistPlugin.getDefault() != null) {
+ MylarTasklistPlugin.getDefault().saveState();
+ }
}
public ITask getTaskForHandle(String handle) {
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/TaskListExternalizer.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/TaskListExternalizer.java
index a0e67f6d2..44eb9a94d 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/TaskListExternalizer.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/TaskListExternalizer.java
@@ -249,14 +249,14 @@ public class TaskListExternalizer {
if(taskHandler != null){
newTask = taskHandler.taskAdded(newTask);
}
- tlist.addRootTask(newTask);
+ tlist.internalAddRootTask(newTask);
wasRead = true;
break;
}
}
if (!wasRead && defaultExternalizer.canReadTask(child)) {
- tlist.addRootTask(defaultExternalizer.readTask(child, tlist, null, null));
+ tlist.internalAddRootTask(defaultExternalizer.readTask(child, tlist, null, null));
} else {
// MylarPlugin.log("Did not read: " + child.getNodeName(), this);
}
@@ -452,14 +452,14 @@ public class TaskListExternalizer {
if(taskHandler != null){
newTask = taskHandler.taskAdded(newTask);
}
- tlist.addRootTask(newTask);
+ tlist.internalAddRootTask(newTask);
wasRead = true;
break;
}
}
if (!wasRead && defaultExternalizer.canReadTask(child)) {
- tlist.addRootTask(defaultExternalizer.readTask(child, tlist, null, null));
+ tlist.internalAddRootTask(defaultExternalizer.readTask(child, tlist, null, null));
} else {
// MylarPlugin.log("Did not read: " + child.getNodeName(), this);
}
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 ec16f2c3e..e7a05c104 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
@@ -630,6 +630,10 @@ public class TaskListView extends ViewPart {
IMemento sorter = memento.createChild(tableSortIdentifier);
IMemento m = sorter.createChild("sorter");
m.putInteger("sortIndex", sortIndex);
+
+ if (MylarTasklistPlugin.getDefault() != null) {
+ MylarTasklistPlugin.getDefault().saveState();
+ }
}
private void restoreState() {
@@ -806,6 +810,9 @@ public class TaskListView extends ViewPart {
}
getViewer().setSelection(null);
getViewer().refresh();
+ if (MylarTasklistPlugin.getDefault() != null) {
+ MylarTasklistPlugin.getDefault().saveState();
+ }
return true;
} else if(selectedObject instanceof ITaskListElement &&
MylarTasklistPlugin.getDefault().getTaskHandlerForElement((ITaskListElement)selectedObject) != null &&
@@ -814,7 +821,10 @@ public class TaskListView extends ViewPart {
MylarTasklistPlugin.getDefault().getTaskHandlerForElement((ITaskListElement)selectedObject).dropItem((ITaskListElement)selectedObject, (TaskCategory)getCurrentTarget());
getViewer().setSelection(null);
getViewer().refresh();
- return true;
+ if (MylarTasklistPlugin.getDefault() != null) {
+ MylarTasklistPlugin.getDefault().saveState();
+ }
+ return true;
}
return false;
}

Back to the top