use of org.eclipse.core.runtime.preferences.ConfigurationScope in project xtext-xtend by eclipse.
the class XtendPreferenceStoreAccess method getContextPreferenceStore.
@SuppressWarnings("all")
@Override
public IPreferenceStore getContextPreferenceStore(Object context) {
IProject project = getProject(context);
if (project == null)
return getPreferenceStore();
IPreferenceStore store = super.getContextPreferenceStore(context);
ProjectScope projectScope = new ProjectScope(project);
FixedScopedPreferenceStore jdtStore = new FixedScopedPreferenceStore(projectScope, JavaCore.PLUGIN_ID);
jdtStore.setSearchContexts(new IScopeContext[] { projectScope, new InstanceScope(), new ConfigurationScope() });
return new ChainedPreferenceStore(new IPreferenceStore[] { store, jdtStore, PreferenceConstants.getPreferenceStore() });
}
use of org.eclipse.core.runtime.preferences.ConfigurationScope in project webtools.sourceediting by eclipse.
the class PrefUtil method getProperty.
private static String getProperty(String property) {
// Importance order is:
// default-default < instanceScope < configurationScope < systemProperty
// < envVar
String value = null;
if (value == null) {
value = System.getenv(property);
}
if (value == null) {
value = System.getProperty(property);
}
if (value == null) {
IPreferencesService preferencesService = Platform.getPreferencesService();
String key = property;
if (property != null && property.startsWith(SSECorePlugin.ID)) {
// +1, include the "."
key = property.substring(SSECorePlugin.ID.length() + 1, property.length());
}
InstanceScope instance = new InstanceScope();
ConfigurationScope config = new ConfigurationScope();
Preferences instanceNode = instance.getNode(SSECorePlugin.ID);
Preferences configNode = config.getNode(SSECorePlugin.ID);
value = preferencesService.get(key, getDefault(property), new Preferences[] { configNode, instanceNode });
}
return value;
}
use of org.eclipse.core.runtime.preferences.ConfigurationScope in project polymap4-core by Polymap4.
the class JavaEncryption method internalInitialize.
protected void internalInitialize() throws StorageException {
if (cipherAlgorithm != null && keyFactoryAlgorithm != null) {
if (roundtrip(cipherAlgorithm, keyFactoryAlgorithm))
return;
// this is a bad situation - JVM cipher no longer available. Both log and throw an exception
String msg = NLS.bind(SecAuthMessages.noAlgorithm, cipherAlgorithm);
StorageException e = new StorageException(StorageException.INTERNAL_ERROR, msg);
AuthPlugin.getDefault().logError(msg, e);
throw e;
}
if (cipherAlgorithm == null || keyFactoryAlgorithm == null) {
IEclipsePreferences eclipseNode = new ConfigurationScope().getNode(AuthPlugin.PI_AUTH);
cipherAlgorithm = eclipseNode.get(IStorageConstants.CIPHER_KEY, IStorageConstants.DEFAULT_CIPHER);
keyFactoryAlgorithm = eclipseNode.get(IStorageConstants.KEY_FACTORY_KEY, IStorageConstants.DEFAULT_KEY_FACTORY);
}
if (roundtrip(cipherAlgorithm, keyFactoryAlgorithm))
return;
String unavailableCipher = cipherAlgorithm;
detect();
if (availableCiphers.size() == 0)
throw new StorageException(StorageException.INTERNAL_ERROR, SecAuthMessages.noAlgorithms);
// use first available
cipherAlgorithm = (String) availableCiphers.keySet().iterator().next();
keyFactoryAlgorithm = (String) availableCiphers.get(cipherAlgorithm);
String msg = NLS.bind(SecAuthMessages.usingAlgorithm, unavailableCipher, cipherAlgorithm);
AuthPlugin.getDefault().logMessage(msg);
}
use of org.eclipse.core.runtime.preferences.ConfigurationScope in project xtext-xtend by eclipse.
the class XtendPreferenceStoreAccess method getPreferenceStore.
@SuppressWarnings("all")
@Override
public IPreferenceStore getPreferenceStore() {
IPreferenceStore store = super.getPreferenceStore();
FixedScopedPreferenceStore jdtStore = new FixedScopedPreferenceStore(new InstanceScope(), JavaCore.PLUGIN_ID);
jdtStore.setSearchContexts(new IScopeContext[] { new InstanceScope(), new ConfigurationScope() });
return new ChainedPreferenceStore(new IPreferenceStore[] { store, jdtStore, PreferenceConstants.getPreferenceStore() });
}
use of org.eclipse.core.runtime.preferences.ConfigurationScope in project xtext-eclipse by eclipse.
the class PreferenceStoreAccessTest method testScopeWithAnotherInstance.
@SuppressWarnings("deprecation")
@Test
public void testScopeWithAnotherInstance() {
// ensure initialization
getWritable();
ScopedPreferenceStore scopedPreferenceStore = new ScopedPreferenceStore(new ConfigurationScope(), LANGUAGE_ID);
assertTrue(scopedPreferenceStore.getBoolean("someBoolean"));
}
Aggregations