use of org.osgi.service.prefs.Preferences in project webtools.servertools by eclipse.
the class ServerPreferenceModifyListener method preApply.
/* (non-Javadoc)
* @see org.eclipse.core.runtime.preferences.PreferenceModifyListener#preApply(org.eclipse.core.runtime.preferences.IEclipsePreferences)
*/
public IEclipsePreferences preApply(IEclipsePreferences node) {
Preferences instance = node.node(InstanceScope.SCOPE);
Preferences runtimes = instance.node(ServerPlugin.PLUGIN_ID);
if (runtimes != null)
// $NON-NLS-1$
removeLockedServerRuntimePreference(runtimes);
return super.preApply(node);
}
use of org.osgi.service.prefs.Preferences in project jbosstools-openshift by jbosstools.
the class Cluster method load.
public void load(Preferences clusterNode, ISecurePreferences secureClusterNode) throws StorageException {
clusterNode.get(ENDPOINT_URL_KEY, OSIOCoreConstants.OSIO_ENDPOINT);
try {
String[] ids = clusterNode.childrenNames();
for (String id : ids) {
Account account = new Account(id, this);
Preferences accountNode = clusterNode.node(id);
ISecurePreferences secureAccountNode = secureClusterNode.node(id);
try {
account.load(accountNode, secureAccountNode);
identities.add(account);
} catch (StorageException e) {
OpenShiftIOCoreActivator.logError(e.getLocalizedMessage(), e);
}
}
} catch (BackingStoreException e) {
OpenShiftIOCoreActivator.logError(e.getLocalizedMessage(), e);
}
}
use of org.osgi.service.prefs.Preferences in project jbosstools-openshift by jbosstools.
the class Cluster method save.
@Override
public void save() {
try {
Preferences accountsNode = AccountModel.getAccountsPreferences();
Preferences clusterNode = accountsNode.node(getId());
ISecurePreferences clusterSecureNode = AccountModel.getSecureAccountsPreferences().node(getId());
clusterNode.put(ENDPOINT_URL_KEY, getEndpointURL());
removed.forEach(id -> {
try {
clusterNode.node(id).removeNode();
clusterSecureNode.node(id).removeNode();
} catch (BackingStoreException e) {
OpenShiftIOCoreActivator.logError(e.getLocalizedMessage(), e);
}
});
removed.clear();
clusterNode.flush();
clusterSecureNode.flush();
} catch (BackingStoreException | IOException e) {
OpenShiftIOCoreActivator.logError("Error saving cluster in storage", e);
}
}
use of org.osgi.service.prefs.Preferences in project jbosstools-openshift by jbosstools.
the class Account method save.
@Override
public void save() {
try {
ISecurePreferences secureAccountsRoot = AccountModel.getSecureAccountsPreferences();
Preferences accountsRoot = AccountModel.getAccountsPreferences();
ISecurePreferences secureAccountNode = secureAccountsRoot.node(cluster.getId()).node(getId());
Preferences accountNode = accountsRoot.node(cluster.getId()).node(getId());
accountNode.putLong(ACCESS_TOKEN_EXPIRY_TIME_KEY, getAccessTokenExpiryTime());
accountNode.putLong(KEYREFRESH_TOKEN_EXPIRY_TIME, getRefreshTokenExpiryTime());
accountNode.putLong(LAST_REFRESHED_TIME_KEY, getLastRefreshedTime());
secureAccountNode.put(ACCESS_TOKEN_KEY, getAccessToken(), true);
secureAccountNode.put(REFRESH_TOKEN_KEY, getRefreshToken(), true);
accountNode.flush();
secureAccountNode.flush();
} catch (StorageException | BackingStoreException | IOException e) {
OpenShiftIOCoreActivator.logError("Error saving credentials ", e);
}
}
use of org.osgi.service.prefs.Preferences in project polymap4-core by Polymap4.
the class ProjectPreferences method deleted.
static void deleted(IFolder folder) throws CoreException {
IPath path = folder.getFullPath();
int count = path.segmentCount();
if (count != 2)
return;
// check if we are the .settings directory
if (!EclipsePreferences.DEFAULT_PREFERENCES_DIRNAME.equals(path.segment(1)))
return;
Preferences root = Platform.getPreferencesService().getRootNode();
// The settings dir has been removed/moved so remove all project prefs
// for the resource.
String project = path.segment(0);
Preferences projectNode = root.node(ProjectScope.SCOPE).node(project);
// check if we need to notify the charset manager
boolean hasResourcesSettings = getFile(folder, ResourcesPlugin.PI_RESOURCES).exists();
// remove the preferences
removeNode(projectNode);
// notifies the CharsetManager
if (hasResourcesSettings)
preferencesChanged(folder.getProject());
}
Aggregations