use of org.eclipse.equinox.security.storage.ISecurePreferences in project ecf by eclipse.
the class IDEntry method getAssociates.
public IIDEntry[] getAssociates(String key) {
if (key == null)
return new IIDEntry[0];
ISecurePreferences associateNode = prefs.node(key);
String[] childrenNames = associateNode.childrenNames();
SortedMap results = new TreeMap();
for (int i = 0; i < childrenNames.length; i++) {
addAssociateFromName(childrenNames[i], results);
}
return (IIDEntry[]) results.values().toArray(new IIDEntry[] {});
}
use of org.eclipse.equinox.security.storage.ISecurePreferences in project ecf by eclipse.
the class ContainerStoreTest method testStoreContainer.
public ID testStoreContainer() throws Exception {
final IContainer container = createContainer();
final IContainerEntry containerEntry = storeContainer(getStorableContainerAdapter(container));
final ISecurePreferences prefs = containerEntry.getPreferences();
assertNotNull(prefs);
return container.getID();
}
use of org.eclipse.equinox.security.storage.ISecurePreferences in project arduino-eclipse-plugin by Sloeber.
the class PasswordManager method setHost.
/**
* Sets the host. If there is no Login,password for this host the method
* returns false. If a login/password for the host is found the method
* returns true
*
* @param host
* @return
*/
public boolean setHost(String host) {
this.myhost = host;
this.myPassword = null;
this.myLogin = null;
String nodename = ConvertHostToNodeName(this.myhost);
ISecurePreferences root = SecurePreferencesFactory.getDefault();
try {
if (root.nodeExists(nodename)) {
ISecurePreferences node = root.node(nodename);
this.myPassword = node.get(Messages.security_password, null);
this.myLogin = node.get(Messages.security_login, null);
return true;
}
} catch (StorageException e) {
Common.log(new Status(IStatus.ERROR, Const.CORE_PLUGIN_ID, "Set a password on the project properties->Sloeber page", // $NON-NLS-1$
e));
}
return false;
}
use of org.eclipse.equinox.security.storage.ISecurePreferences in project arduino-eclipse-plugin by Sloeber.
the class PasswordManager method setPwd.
public static void setPwd(String host, String login, String pwd) {
String nodename = ConvertHostToNodeName(host);
ISecurePreferences root = SecurePreferencesFactory.getDefault();
ISecurePreferences node = root.node(nodename);
try {
node.put(Messages.security_login, login, false);
node.put(Messages.security_password, pwd, false);
} catch (StorageException e) {
// $NON-NLS-1$
Common.log(new Status(IStatus.ERROR, Const.CORE_PLUGIN_ID, "failed to set login info", e));
}
}
use of org.eclipse.equinox.security.storage.ISecurePreferences in project jbosstools-openshift by jbosstools.
the class SecureStore method getNode.
private ISecurePreferences getNode(IStoreKey key) throws UnsupportedEncodingException, SecureStoreException {
if (key == null) {
throw new SecureStoreException("storage key is null.");
}
ISecurePreferences root = SecurePreferencesFactory.getDefault();
ISecurePreferences node = root.node(key.getKey());
if (node == null) {
throw new SecureStoreException(NLS.bind("Could find storage node {0}", key.getKey()));
}
return node;
}
Aggregations