diff options
author | Steffen Pingel | 2014-07-23 15:43:51 +0000 |
---|---|---|
committer | Daniel Rolka | 2014-07-23 15:43:51 +0000 |
commit | d647cef9f618dc137277671e9ad0490d0941eb5a (patch) | |
tree | 95a24fbd8186ee3acf0dc430adace0658a436363 | |
parent | 318d1251dbc5230860b452889719bb8517854472 (diff) | |
download | eclipse.platform.ui-d647cef9f618dc137277671e9ad0490d0941eb5a.tar.gz eclipse.platform.ui-d647cef9f618dc137277671e9ad0490d0941eb5a.tar.xz eclipse.platform.ui-d647cef9f618dc137277671e9ad0490d0941eb5a.zip |
Bug 440240 - [WorkingSets] updating of working sets during workbench
restore can cause loss of working sets
Change-Id: I0c5d12c0af52e1bdb3202ea65adf3958831a7846
Signed-off-by: Steffen Pingel <steffen.pingel@tasktop.com>
-rw-r--r-- | bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSetManager.java | 19 |
1 files changed, 19 insertions, 0 deletions
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 3322f6ae36b..2cdf90f0d14 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 @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Tasktop Technologies - fix for bug 327396 *******************************************************************************/ package org.eclipse.ui.internal; @@ -43,6 +44,10 @@ public class WorkingSetManager extends AbstractWorkingSetManager implements // Working set persistence public static final String WORKING_SET_STATE_FILENAME = "workingsets.xml"; //$NON-NLS-1$ + private boolean restoreInProgress; + + private boolean savePending; + public WorkingSetManager(BundleContext context) { super(context); } @@ -104,6 +109,8 @@ public class WorkingSetManager extends AbstractWorkingSetManager implements if (stateFile != null && stateFile.exists()) { try { + restoreInProgress = true; + FileInputStream input = new FileInputStream(stateFile); BufferedReader reader = new BufferedReader( new InputStreamReader(input, "utf-8")); //$NON-NLS-1$ @@ -122,6 +129,13 @@ public class WorkingSetManager extends AbstractWorkingSetManager implements e, WorkbenchMessages.ProblemRestoringWorkingSetState_title, WorkbenchMessages.ProblemRestoringWorkingSetState_message); + } finally { + restoreInProgress = false; + } + + if (savePending) { + saveState(); + savePending = false; } } } @@ -130,6 +144,11 @@ public class WorkingSetManager extends AbstractWorkingSetManager implements * Saves the working sets in the persistence store */ private void saveState() { + if (restoreInProgress) { + // bug 327396: avoid saving partial state + savePending = true; + return; + } File stateFile = getWorkingSetStateFile(); if (stateFile == null) { |