Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2010-10-09 18:45:22 -0400
committerspingel2010-10-09 18:45:22 -0400
commitc2cf4a7d000910a5d262f3448398de0d8cc9ba1c (patch)
treefaab3349a59d861e9207d491a77c60651863d834
parent58bc872a0d63cac63465566bb50706c8b0f9449d (diff)
downloadorg.eclipse.mylyn.tasks-c2cf4a7d000910a5d262f3448398de0d8cc9ba1c.tar.gz
org.eclipse.mylyn.tasks-c2cf4a7d000910a5d262f3448398de0d8cc9ba1c.tar.xz
org.eclipse.mylyn.tasks-c2cf4a7d000910a5d262f3448398de0d8cc9ba1c.zip
NEW - bug 327262: Mylyn Task working sets cause loss of working set data on eclipse crash
https://bugs.eclipse.org/bugs/show_bug.cgi?id=327262
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingsets/TaskWorkingSetUpdater.java25
1 files changed, 20 insertions, 5 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingsets/TaskWorkingSetUpdater.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingsets/TaskWorkingSetUpdater.java
index 98cc5b7c3..94807b653 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingsets/TaskWorkingSetUpdater.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/workingsets/TaskWorkingSetUpdater.java
@@ -8,6 +8,7 @@
* Contributors:
* Eugene Kuleshov - initial API and implementation
* Tasktop Technologies - initial API and implementation
+ * Yatta Solutions - fix for bug 327262
*******************************************************************************/
package org.eclipse.mylyn.internal.tasks.ui.workingsets;
@@ -17,6 +18,7 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
@@ -47,6 +49,7 @@ import org.eclipse.ui.PlatformUI;
* @author Eugene Kuleshov
* @author Mik Kersten
* @author Steffen Pingel
+ * @author Carsten Reckord
*/
public class TaskWorkingSetUpdater implements IWorkingSetUpdater, ITaskListChangeListener, IResourceChangeListener {
@@ -109,25 +112,37 @@ public class TaskWorkingSetUpdater implements IWorkingSetUpdater, ITaskListChang
}
private void checkElementExistence(IWorkingSet workingSet) {
- ArrayList<IAdaptable> list = new ArrayList<IAdaptable>();
- for (IAdaptable adaptable : workingSet.getElements()) {
+ ArrayList<IAdaptable> list = new ArrayList<IAdaptable>(Arrays.asList(workingSet.getElements()));
+ boolean changed = false;
+ for (Iterator<IAdaptable> iter = list.iterator(); iter.hasNext();) {
+ IAdaptable adaptable = iter.next();
+ boolean remove = false;
if (adaptable instanceof AbstractTaskContainer) {
String handle = ((AbstractTaskContainer) adaptable).getHandleIdentifier();
+ remove = true;
for (IRepositoryElement element : TasksUiPlugin.getTaskList().getRootElements()) {
if (element != null && element.getHandleIdentifier().equals(handle)) {
list.add(adaptable);
+ remove = false;
+ break;
}
}
} else if (adaptable instanceof IProject) {
IProject project = ResourcesPlugin.getWorkspace()
.getRoot()
.getProject(((IProject) adaptable).getName());
- if (project != null && project.exists()) {
- list.add(project);
+ if (project == null || !project.exists()) {
+ remove = true;
}
}
+ if (remove) {
+ iter.remove();
+ changed = true;
+ }
+ }
+ if (changed) {
+ workingSet.setElements(list.toArray(new IAdaptable[list.size()]));
}
- workingSet.setElements(list.toArray(new IAdaptable[list.size()]));
}
public boolean contains(IWorkingSet workingSet) {

Back to the top