* <li>Resets the existing details in the IPreferenceStore to empty string
* </ul>
*/
protected void updateAccounts() {
IPreferenceStore prefStore = saros.getPreferenceStore();
ISecurePreferences secureStore = saros.getSecurePrefs();
// Get the active account
String username = prefStore.getString(PreferenceConstants.USERNAME);
String server = prefStore.getString(PreferenceConstants.SERVER);
String password = prefStore.getString(PreferenceConstants.PASSWORD);
try {
// If there is an active account...
if (!username.equals("")) {
// ... put it into secure storage
secureStore.put(PreferenceConstants.USERNAME, username, false);
secureStore.put(PreferenceConstants.SERVER, server, false);
secureStore.put(PreferenceConstants.PASSWORD, password, false);
// ... and clear the old preferences
prefStore.setValue(PreferenceConstants.USERNAME, "");
prefStore.setValue(PreferenceConstants.SERVER, "");
prefStore.setValue(PreferenceConstants.PASSWORD, "");
}
// Now do the same with any remaining accounts
int i = 1;
username = prefStore.getString(PreferenceConstants.USERNAME + i);
server = prefStore.getString(PreferenceConstants.SERVER + i);
password = prefStore.getString(PreferenceConstants.PASSWORD + i);
while (!username.equals("")) {
secureStore.put(PreferenceConstants.USERNAME + i, username,
false);
secureStore.put(PreferenceConstants.SERVER + i, server, false);
secureStore.put(PreferenceConstants.PASSWORD + i, password,
false);
prefStore.setValue(PreferenceConstants.USERNAME + i, "");
prefStore.setValue(PreferenceConstants.SERVER + i, "");
prefStore.setValue(PreferenceConstants.PASSWORD + i, "");