Search in sources :

Example 1 with ConfigurationScope

use of org.eclipse.core.runtime.preferences.ConfigurationScope in project xtext-eclipse by eclipse.

the class PreferenceStoreAccessTest method testScope.

@SuppressWarnings("deprecation")
@Test
public void testScope() {
    ScopedPreferenceStore scopedPreferenceStore = new ScopedPreferenceStore(new ConfigurationScope(), "org");
    assertFalse("partial keys are not supported", scopedPreferenceStore.getBoolean("xtext.MyLanguage.someBoolean"));
}
Also used : ScopedPreferenceStore(org.eclipse.ui.preferences.ScopedPreferenceStore) ConfigurationScope(org.eclipse.core.runtime.preferences.ConfigurationScope) Test(org.junit.Test)

Example 2 with ConfigurationScope

use of org.eclipse.core.runtime.preferences.ConfigurationScope in project xtext-eclipse by eclipse.

the class AbstractPreferencePage method handleUseProjectSettings.

/**
 * Switches the search scope of the preference store to use [Project, Instance, Configuration] if values are project
 * specific, and [Instance, Configuration] otherwise. This implementation requires that the given preference store
 * is based on the Project preference store when the page is used as a Properties page. (This is done in
 * {@link #doGetPreferenceStore()}).
 */
@SuppressWarnings("deprecation")
private void handleUseProjectSettings() {
    // Note: uses the pre Eclipse 3.6 way of specifying search scopes (deprecated since 3.6)
    boolean isUseProjectSettings = useProjectSettingsButton.getSelection();
    link.setEnabled(!isUseProjectSettings);
    if (!isUseProjectSettings) {
        ((FixedScopedPreferenceStore) getPreferenceStore()).setSearchContexts(new IScopeContext[] { new InstanceScope(), new ConfigurationScope() });
    } else {
        ((FixedScopedPreferenceStore) getPreferenceStore()).setSearchContexts(new IScopeContext[] { new ProjectScope(currentProject()), new InstanceScope(), new ConfigurationScope() });
        setProjectSpecificValues();
    }
    updateFieldEditors(isUseProjectSettings);
}
Also used : ProjectScope(org.eclipse.core.resources.ProjectScope) InstanceScope(org.eclipse.core.runtime.preferences.InstanceScope) ConfigurationScope(org.eclipse.core.runtime.preferences.ConfigurationScope)

Example 3 with ConfigurationScope

use of org.eclipse.core.runtime.preferences.ConfigurationScope in project xtext-eclipse by eclipse.

the class PreferenceStoreAccessImpl method getWritablePreferenceStore.

@Override
@SuppressWarnings("deprecation")
public IPreferenceStore getWritablePreferenceStore(Object context) {
    lazyInitialize();
    IProject project = getProject(context);
    if (project == null) {
        return getWritablePreferenceStore();
    }
    ProjectScope projectScope = new ProjectScope(project);
    FixedScopedPreferenceStore result = new FixedScopedPreferenceStore(projectScope, getQualifier());
    result.setSearchContexts(new IScopeContext[] { projectScope, new InstanceScope(), new ConfigurationScope() });
    return result;
}
Also used : ProjectScope(org.eclipse.core.resources.ProjectScope) InstanceScope(org.eclipse.core.runtime.preferences.InstanceScope) IProject(org.eclipse.core.resources.IProject) ConfigurationScope(org.eclipse.core.runtime.preferences.ConfigurationScope)

Example 4 with ConfigurationScope

use of org.eclipse.core.runtime.preferences.ConfigurationScope in project xtext-eclipse by eclipse.

the class PreferenceStoreAccessImpl method getWritablePreferenceStore.

@Override
@SuppressWarnings("deprecation")
public IPreferenceStore getWritablePreferenceStore() {
    lazyInitialize();
    FixedScopedPreferenceStore result = new FixedScopedPreferenceStore(new InstanceScope(), getQualifier());
    result.setSearchContexts(new IScopeContext[] { new InstanceScope(), new ConfigurationScope() });
    return result;
}
Also used : InstanceScope(org.eclipse.core.runtime.preferences.InstanceScope) ConfigurationScope(org.eclipse.core.runtime.preferences.ConfigurationScope)

Example 5 with ConfigurationScope

use of org.eclipse.core.runtime.preferences.ConfigurationScope in project polymap4-core by Polymap4.

the class PasswordProviderSelector method getDisabledModules.

protected HashSet getDisabledModules() {
    IEclipsePreferences node = new ConfigurationScope().getNode(AuthPlugin.PI_AUTH);
    String tmp = node.get(IStorageConstants.DISABLED_PROVIDERS_KEY, null);
    if (tmp == null || tmp.length() == 0)
        return null;
    HashSet disabledModules = new HashSet();
    // $NON-NLS-1$
    String[] disabledProviders = tmp.split(",");
    for (int i = 0; i < disabledProviders.length; i++) {
        disabledModules.add(disabledProviders[i]);
    }
    return disabledModules;
}
Also used : IEclipsePreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences) ConfigurationScope(org.eclipse.core.runtime.preferences.ConfigurationScope)

Aggregations

ConfigurationScope (org.eclipse.core.runtime.preferences.ConfigurationScope)11 InstanceScope (org.eclipse.core.runtime.preferences.InstanceScope)7 ProjectScope (org.eclipse.core.resources.ProjectScope)3 IEclipsePreferences (org.eclipse.core.runtime.preferences.IEclipsePreferences)3 ScopedPreferenceStore (org.eclipse.ui.preferences.ScopedPreferenceStore)3 ChainedPreferenceStore (org.eclipse.ui.texteditor.ChainedPreferenceStore)3 Test (org.junit.Test)3 IProject (org.eclipse.core.resources.IProject)2 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)2 FixedScopedPreferenceStore (org.eclipse.xtext.ui.editor.preferences.FixedScopedPreferenceStore)2 IPreferencesService (org.eclipse.core.runtime.preferences.IPreferencesService)1 StorageException (org.eclipse.equinox.security.storage.StorageException)1 Preferences (org.osgi.service.prefs.Preferences)1