Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDani Megert2001-11-06 13:20:55 -0500
committerDani Megert2001-11-06 13:20:55 -0500
commitfd143776c71e62926fffe0e62f02090fc5037fbd (patch)
tree49fdc649c7a7a521bd48b7b0e39394be10f2f786
parent4382bf1ed591a52903663d6d7d4137af36809c76 (diff)
downloadeclipse.platform.text-fd143776c71e62926fffe0e62f02090fc5037fbd.tar.gz
eclipse.platform.text-fd143776c71e62926fffe0e62f02090fc5037fbd.tar.xz
eclipse.platform.text-fd143776c71e62926fffe0e62f02090fc5037fbd.zip
Persist last working set
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/ScopePart.java19
1 files changed, 13 insertions, 6 deletions
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/ScopePart.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/ScopePart.java
index 7bedb17f4..dd2dc2c21 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/ScopePart.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/ScopePart.java
@@ -16,6 +16,7 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Text;
+import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.util.Assert;
import org.eclipse.ui.dialogs.SelectionDialog;
@@ -35,6 +36,11 @@ public class ScopePart {
private static String fgLRUsedWorkingSetName;
+ // Settings store
+ private static final String DIALOG_SETTINGS_KEY= "SearchDialog.ScopePart"; //$NON-NLS-1$
+ private static final String STORE_LRU_WORKING_SET_NAME= "lastUsedWorkingSetName"; //$NON-NLS-1$
+ private static IDialogSettings fgSettingsStore;
+
// Scope radio buttons
private Button fUseWorkspace;
private Button fUseSelection;
@@ -75,9 +81,11 @@ public class ScopePart {
public ScopePart(int initialScope) {
Assert.isLegal(initialScope >= 0 && initialScope <= 3);
fScope= initialScope;
- fWorkingSet= SearchUI.findWorkingSet(fgLRUsedWorkingSetName);
- if (fWorkingSet == null && SearchUI.getWorkingSets().length > 0)
- fWorkingSet= SearchUI.getWorkingSets()[0];
+ fgSettingsStore= SearchPlugin.getDefault().getDialogSettings().getSection(DIALOG_SETTINGS_KEY);
+ if (fgSettingsStore == null)
+ fgSettingsStore= SearchPlugin.getDefault().getDialogSettings().addNewSection(DIALOG_SETTINGS_KEY);
+ String lruWorkingSetName= fgSettingsStore.get(STORE_LRU_WORKING_SET_NAME);
+ fWorkingSet= SearchUI.findWorkingSet(lruWorkingSetName);
}
/**
@@ -167,9 +175,9 @@ public class ScopePart {
workingSet= SearchUI.findWorkingSet(name);
if (workingSet != null) {
fWorkingSet= workingSet;
- fgLRUsedWorkingSetName= name;
+ fgSettingsStore.put(STORE_LRU_WORKING_SET_NAME, workingSet.getName());
} else {
- name= "";
+ name= ""; //$NON-NLS-1$
fWorkingSet= null;
}
if (fWorkingSetText != null)
@@ -258,7 +266,6 @@ public class ScopePart {
if (dialog.open() == dialog.OK) {
IWorkingSet workingSet= (IWorkingSet)dialog.getResult()[0];
setSelectedWorkingSet(workingSet);
- fgLRUsedWorkingSetName= workingSet.getName();
return true;
} else {
// test if selected working set has been removed

Back to the top