Author: adietish
Date: 2010-11-26 10:36:11 -0500 (Fri, 26 Nov 2010)
New Revision: 26979
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/EditCloudConnectionWizard.java
Log:
[JBIDE-7731] extracted password storage to its own class (removed duplicate code in
EditCloudConnectionWizard, NewCloudConnectionWizard and DeltaCloud)
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/EditCloudConnectionWizard.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/EditCloudConnectionWizard.java 2010-11-26
15:35:39 UTC (rev 26978)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/EditCloudConnectionWizard.java 2010-11-26
15:36:11 UTC (rev 26979)
@@ -13,8 +13,6 @@
import java.net.MalformedURLException;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.equinox.security.storage.ISecurePreferences;
-import org.eclipse.equinox.security.storage.SecurePreferencesFactory;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
@@ -45,31 +43,23 @@
@Override
public void addPages() {
- String password = getPassword();
try {
+ String cloudName = cloud.getName();
+ String userName = cloud.getUsername();
+ String password = cloud.getPassword();
mainPage = new CloudConnectionPage(WizardMessages.getString(MAINPAGE_NAME),
- cloud.getName(), cloud.getURL(), cloud.getUsername(), password,
- cloud.getType(), this);
+ cloudName, cloud.getURL(), userName, password, cloud.getType(), this);
addPage(mainPage);
} catch (MalformedURLException e) {
ErrorUtils.handleError(WizardMessages.getString("EditCloudConnectionError.title"),
WizardMessages.getString("EditCloudConnectionError.message"), e,
getShell());
+ } catch (DeltaCloudException e) {
+ // TODO: internationalize strings
+ ErrorUtils.handleError("Error",
+ "Could not create wizard page", e, getShell());
}
}
- private String getPassword() {
- String password = "";
- String key = DeltaCloud.getPreferencesKey(cloud.getURL(), cloud.getUsername());
- ISecurePreferences root = SecurePreferencesFactory.getDefault();
- ISecurePreferences node = root.node(key);
- try {
- password = node.get("password", null); //$NON-NLS-1$
- } catch (Exception e) {
- Activator.log(e);
- }
- return password;
- }
-
@Override
public boolean canFinish() {
return mainPage.isPageComplete();
@@ -119,10 +109,10 @@
if (type == null) {
return null;
}
-
+
return type.toString();
}
-
+
@Override
public boolean needsProgressMonitor() {
return true;
Show replies by date