aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Rolka2014-01-23 08:54:13 (EST)
committerGerrit Code Review @ Eclipse.org2014-02-20 15:02:13 (EST)
commitcaa114ecd0ea2afc36dfba4a63196da09244d144 (patch)
treef1458814d7cff441e95ef46560f586c746f32333
parent5ab686beafc66a952614277db728857b560fd634 (diff)
downloadeclipse.platform.ui-caa114ecd0ea2afc36dfba4a63196da09244d144.zip
eclipse.platform.ui-caa114ecd0ea2afc36dfba4a63196da09244d144.tar.gz
eclipse.platform.ui-caa114ecd0ea2afc36dfba4a63196da09244d144.tar.bz2
Bug 412970 - [WorkingSets] Working sets reset after closing eclipserefs/changes/32/22232/2
Change-Id: I9172a97c36a76c6dd7826b593e1a9cd6fa199b79 Signed-off-by: Daniel Rolka <daniel.rolka@pl.ibm.com>
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java31
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSetManager.java8
2 files changed, 29 insertions, 10 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java
index 2be9178..ab3234f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java
@@ -4483,12 +4483,19 @@ public class WorkbenchPage extends CompatibleWorkbenchPage implements
if (aggregateWorkingSet == null) {
IWorkingSetManager workingSetManager = PlatformUI.getWorkbench()
.getWorkingSetManager();
- aggregateWorkingSet = (AggregateWorkingSet) workingSetManager.getWorkingSet(
- getAggregateWorkingSetId());
+
+ if (aggregateWorkingSetId == null) {
+ aggregateWorkingSet = findAggregateWorkingSet(workingSetManager);
+ aggregateWorkingSetId = aggregateWorkingSet == null ? getDefaultAggregateWorkingSetId()
+ : aggregateWorkingSet.getName();
+ } else {
+ aggregateWorkingSet = (AggregateWorkingSet) workingSetManager
+ .getWorkingSet(aggregateWorkingSetId);
+ }
+
if (aggregateWorkingSet == null) {
aggregateWorkingSet = (AggregateWorkingSet) workingSetManager
- .createAggregateWorkingSet(
- getAggregateWorkingSetId(),
+ .createAggregateWorkingSet(aggregateWorkingSetId,
WorkbenchMessages.WorkbenchPage_workingSet_default_label,
getWorkingSets());
workingSetManager.addWorkingSet(aggregateWorkingSet);
@@ -4497,13 +4504,19 @@ public class WorkbenchPage extends CompatibleWorkbenchPage implements
return aggregateWorkingSet;
}
- private String getAggregateWorkingSetId() {
- if (aggregateWorkingSetId == null) {
- aggregateWorkingSetId = "Aggregate for window " + System.currentTimeMillis(); //$NON-NLS-1$
- }
- return aggregateWorkingSetId;
+ private String getDefaultAggregateWorkingSetId() {
+ return "Aggregate for window " + System.currentTimeMillis(); //$NON-NLS-1$
}
+ private AggregateWorkingSet findAggregateWorkingSet(IWorkingSetManager workingSetManager) {
+ for (IWorkingSet workingSet : workingSetManager.getAllWorkingSets()) {
+ if (workingSet instanceof AggregateWorkingSet) {
+ return (AggregateWorkingSet) workingSet;
+ }
+ }
+ return null;
+ }
+
/*
* (non-Javadoc)
*
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSetManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSetManager.java
index 4151c53..f544550 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSetManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSetManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2014 IBM Corporation 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
@@ -170,4 +170,10 @@ public class WorkingSetManager extends AbstractWorkingSetManager implements
StatusManager.getManager().handle(sa,
StatusManager.SHOW | StatusManager.LOG);
}
+
+ @Override
+ protected void restoreWorkingSetState(IMemento memento) {
+ super.restoreWorkingSetState(memento);
+ saveState();
+ }
}