use of org.osgi.service.prefs.Preferences in project n4js by eclipse.
the class ProjectNameFilterAwareWorkingSetManager method restoreState.
@Override
public IStatus restoreState(final IProgressMonitor monitor) {
final IStatus superRestoreResult = super.restoreState(monitor);
if (superRestoreResult.isOK()) {
final Preferences node = getPreferences();
final String orderedFilters = node.get(ORDERED_FILTERS_KEY, EMPTY_STRING);
if (!Strings.isNullOrEmpty(orderedFilters)) {
orderedWorkingSetFilters.clear();
orderedWorkingSetFilters.addAll(Arrays.asList(orderedFilters.split(SEPARATOR)));
}
discardWorkingSetCaches();
return statusHelper.OK();
}
return superRestoreResult;
}
use of org.osgi.service.prefs.Preferences in project n4js by eclipse.
the class ProjectNameFilterAwareWorkingSetManager method saveState.
@Override
public IStatus saveState(final IProgressMonitor monitor) {
final IStatus superSaveResult = super.saveState(monitor);
if (superSaveResult.isOK()) {
final Preferences node = getPreferences();
node.put(ORDERED_FILTERS_KEY, Joiner.on(SEPARATOR).join(orderedWorkingSetFilters));
try {
node.flush();
} catch (final BackingStoreException e) {
final String message = "Error occurred while saving state to preference store.";
LOGGER.error(message, e);
return statusHelper.createError(message, e);
}
return statusHelper.OK();
}
return superSaveResult;
}
use of org.osgi.service.prefs.Preferences in project n4js by eclipse.
the class OsgiBinariesPreferenceStore method init.
@Override
protected Map<Binary, URI> init() {
final Map<Binary, URI> initState = super.init();
final Preferences node = InstanceScope.INSTANCE.getNode(QUALIFIER);
for (final Binary binary : binariesProvider.getRegisteredBinaries()) {
recursivePreferencesRead(initState, node, binary);
}
return initState;
}
use of org.osgi.service.prefs.Preferences in project n4js by eclipse.
the class OsgiExternalLibraryPreferenceStore method doLoad.
@Override
protected ExternalLibraryPreferenceModel doLoad() {
final Preferences node = InstanceScope.INSTANCE.getNode(QUALIFIER);
final String jsonString = node.get(CONFIGURATION_KEY, "");
if (isNullOrEmpty(jsonString)) {
return ExternalLibraryPreferenceModel.createDefaultForN4Product();
}
return ExternalLibraryPreferenceModel.createFromJson(jsonString);
}
use of org.osgi.service.prefs.Preferences 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));
}
}
Aggregations