use of org.eclipse.core.runtime.preferences.InstanceScope 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;
}
use of org.eclipse.core.runtime.preferences.InstanceScope 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;
}
use of org.eclipse.core.runtime.preferences.InstanceScope 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);
}
use of org.eclipse.core.runtime.preferences.InstanceScope in project ecf by eclipse.
the class AccountStart method loadConnectionDetailsFromPreferenceStore.
public void loadConnectionDetailsFromPreferenceStore() {
try {
Preferences preferences = new InstanceScope().getNode(ClientPlugin.PLUGIN_ID);
Preferences connections = preferences.node(SAVED);
String[] targets = connections.childrenNames();
for (int i = 0; i < targets.length; i++) {
String target = targets[i];
Preferences node = connections.node(target);
if (node != null) {
addConnectionDetails(new ConnectionDetails(node.get(ConnectionDetails.CONTAINER_TYPE, ""), // $NON-NLS-1$
node.get(ConnectionDetails.TARGET_URI, ""), // $NON-NLS-1$
node.get(ConnectionDetails.NICKNAME, ""), // $NON-NLS-1$
node.get(ConnectionDetails.PASSWORD, // $NON-NLS-1$
"")));
}
}
} catch (BackingStoreException e) {
ClientPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, ClientPlugin.PLUGIN_ID, BACKING_STORE_LOAD_ERROR, Messages.AccountStart_EXCEPTION_LOADING_CONNECTION_DETAILS, e));
}
}
use of org.eclipse.core.runtime.preferences.InstanceScope in project ecf by eclipse.
the class AccountStart method removeConnectionDetails.
public void removeConnectionDetails(ConnectionDetails cd) {
try {
Preferences preferences = new InstanceScope().getNode(ClientPlugin.PLUGIN_ID);
Preferences connections = preferences.node(SAVED);
String[] targets = connections.childrenNames();
for (int i = 0; i < targets.length; i++) {
String target = targets[i];
Preferences node = connections.node(target);
String cdTarget = normalizeURI(cd.getTargetURI());
if (node != null && target != null && target.equals(cdTarget)) {
node.removeNode();
}
}
connections.flush();
} catch (BackingStoreException e) {
ClientPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, ClientPlugin.PLUGIN_ID, BACKING_STORE_LOAD_ERROR, Messages.AccountStart_EXCEPTION_LOADING_CONNECTION_DETAILS, e));
}
}
Aggregations