use of org.osgi.service.prefs.Preferences in project webtools.sourceediting by eclipse.
the class XSLValidationPreferencePage method initializeValues.
protected void initializeValues() {
Preferences prefs = getModelPreferences();
int maxErrors = prefs.getInt(ValidationPreferences.MAX_ERRORS, 100);
maxErrorsText.setText(String.valueOf(maxErrors));
for (Map.Entry<String, Combo> entry : combos.entrySet()) {
int val = prefs.getInt(entry.getKey(), IMarker.SEVERITY_WARNING);
if (val < 0) {
val = IMarker.SEVERITY_WARNING;
}
entry.getValue().select(ERROR_MAP.get(val));
}
}
use of org.osgi.service.prefs.Preferences in project webtools.servertools by eclipse.
the class ProfilerPreferences method setServerProfilerId.
/**
* Sets the profiler to use when profiling on server
* @param profilerId the id of the server profiler
*/
public void setServerProfilerId(String profilerId) {
Preferences node = new InstanceScope().getNode(PREF_PROFILER_QUALIFIER);
node.put(PREF_SELECTED_PROFILER, profilerId);
try {
node.flush();
} catch (BackingStoreException e) {
if (Trace.SEVERE) {
Trace.trace(Trace.STRING_SEVERE, "Could not save server profiler preference", e);
}
}
}
use of org.osgi.service.prefs.Preferences in project n4js by eclipse.
the class ManualAssociationAwareWorkingSetManager method saveState.
@Override
public IStatus saveState(final IProgressMonitor monitor) {
final IStatus superSaveResult = super.saveState(monitor);
if (superSaveResult.isOK()) {
final Preferences node = getPreferences();
try {
final String associationString = mapper.writeValueAsString(projectAssociations);
node.put(ORDERED_ASSOCIATIONS_KEY, associationString);
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);
} catch (final IOException e) {
final String message = "Error occurred while serializing project associations.";
LOGGER.error(message, e);
return statusHelper.createError(message, e);
}
resetEclipseWorkingSetsBaseOnCurrentState();
return statusHelper.OK();
}
return superSaveResult;
}
use of org.osgi.service.prefs.Preferences in project n4js by eclipse.
the class WorkingSetManagerBrokerImpl method restoreState.
private IStatus restoreState() {
final Preferences node = getPreferences();
// Top level element.
workingSetTopLevel.set(node.getBoolean(IS_WORKINGSET_TOP_LEVEL_KEY, false));
// Active working set manager.
final String value = node.get(ACTIVE_MANAGER_KEY, "");
WorkingSetManager workingSetManager = contributions.get().get(value);
if (workingSetManager == null) {
if (!contributions.get().isEmpty()) {
workingSetManager = contributions.get().values().iterator().next();
}
}
if (workingSetManager != null) {
setActiveManager(workingSetManager);
}
return Status.OK_STATUS;
}
use of org.osgi.service.prefs.Preferences in project n4js by eclipse.
the class WorkingSetManagerImpl method saveState.
@Override
public IStatus saveState(final IProgressMonitor monitor) {
final Preferences node = getPreferences();
// Save ordered labels.
node.put(ORDERED_IDS_KEY, Joiner.on(SEPARATOR).join(orderedWorkingSetIds));
// Save visible labels.
node.put(VISIBLE_IDS_KEY, Joiner.on(SEPARATOR).join(visibleWorkingSetIds));
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();
}
Aggregations