diff options
2 files changed, 30 insertions, 6 deletions
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FilteredContributionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FilteredContributionDialog.java index 2801f17e..42dc97ba 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FilteredContributionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FilteredContributionDialog.java @@ -8,6 +8,7 @@ * Contributors: * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 424730, Bug 435625, Bug 436281 * Andrej ten Brummelhuis <andrejbrummelhuis@gmail.com> - Bug 395283 + * Marco Descher <marco@descher.at> - Bug 442647 *******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; @@ -103,7 +104,9 @@ public abstract class FilteredContributionDialog extends SaveDialogBoundsSetting private static final int MAX_RESULTS = 500; private Image contributionTypeImage; private TableViewer viewer; + private static final String PREF_SEARCHSCOPE = "searchScope"; //$NON-NLS-1$ private ResourceSearchScope searchScope = ResourceSearchScope.PROJECT; + private static final String PREF_SEARCHSCOPES = "searchScopes"; //$NON-NLS-1$ private EnumSet<ResourceSearchScope> searchScopes = EnumSet.of(ResourceSearchScope.PROJECT); // private EnumSet<SearchScope> searchScopes = // EnumSet.of(SearchScope.PROJECT, SearchScope.REFERENCES); @@ -216,6 +219,8 @@ public abstract class FilteredContributionDialog extends SaveDialogBoundsSetting @Override public boolean close() { stopSearchThread(true); + getPreferences().put(PREF_SEARCHSCOPE, searchScope.toString()); + getPreferences().put(PREF_SEARCHSCOPES, searchScopes.toString()); return super.close(); } @@ -231,6 +236,20 @@ public abstract class FilteredContributionDialog extends SaveDialogBoundsSetting super(parentShell); this.context = context; imageCache = new BundleImageCache(context.get(Display.class), getClass().getClassLoader()); + + String searchScopeString = getPreferences().get(PREF_SEARCHSCOPE, ResourceSearchScope.PROJECT.toString()); + searchScope = ResourceSearchScope.valueOf(searchScopeString); + + String searchScopesString = getPreferences().get(PREF_SEARCHSCOPES, EnumSet.of(ResourceSearchScope.PROJECT).toString()); + searchScopes = valueOf(ResourceSearchScope.class, searchScopesString); + } + + public static <E extends Enum<E>> EnumSet<E> valueOf(Class<E> eClass, String str) { + String[] arr = str.substring(1, str.length() - 1).split(","); + EnumSet<E> set = EnumSet.noneOf(eClass); + for (String e : arr) + set.add(E.valueOf(eClass, e.trim())); + return set; } public void setStatus(final String message) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SaveDialogBoundsSettingsDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SaveDialogBoundsSettingsDialog.java index a713f642..01db113d 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SaveDialogBoundsSettingsDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SaveDialogBoundsSettingsDialog.java @@ -7,6 +7,7 @@ * * Contributors: * Andrej ten Brummelhuis <andrejbrummelhuis@gmail.com> - initial implementation (Bug 395283) + * Marco Descher <marco@descher.at> - Bug 442647 *******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; @@ -27,22 +28,17 @@ public abstract class SaveDialogBoundsSettingsDialog extends TitleAreaDialog { private static final String DIALOG_WIDTH = "DIALOG_WIDTH"; //$NON-NLS-1$ private static final String DIALOG_HEIGHT = "DIALOG_HEIGHT"; //$NON-NLS-1$ - private IDialogSettings dialogSettings; + private IDialogSettings dialogSettings = new DialogSettings(ORG_ECLIPSE_E4_TOOLS_EMF_UI); private Preferences preferences = InstanceScope.INSTANCE.getNode(ORG_ECLIPSE_E4_TOOLS_EMF_UI); public SaveDialogBoundsSettingsDialog(Shell parentShell) { super(parentShell); - } - @Override - protected IDialogSettings getDialogBoundsSettings() { - dialogSettings = new DialogSettings(ORG_ECLIPSE_E4_TOOLS_EMF_UI); dialogSettings.put(DIALOG_HEIGHT, preferences.getInt(DIALOG_HEIGHT, -1)); dialogSettings.put(DIALOG_WIDTH, preferences.getInt(DIALOG_WIDTH, -1)); dialogSettings.put(DIALOG_ORIGIN_X, preferences.getInt(DIALOG_ORIGIN_X, -1)); dialogSettings.put(DIALOG_ORIGIN_Y, preferences.getInt(DIALOG_ORIGIN_Y, -1)); - return dialogSettings; } private void saveDialogSettings() { @@ -63,4 +59,13 @@ public abstract class SaveDialogBoundsSettingsDialog extends TitleAreaDialog { saveDialogSettings(); return returnValue; } + + @Override + protected IDialogSettings getDialogBoundsSettings() { + return dialogSettings; + } + + public Preferences getPreferences() { + return preferences; + } } |