Author: adietish
Date: 2010-12-02 11:44:20 -0500 (Thu, 02 Dec 2010)
New Revision: 27111
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnectionWizard.java
Log:
cleanup
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnectionWizard.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnectionWizard.java 2010-12-02
16:42:03 UTC (rev 27110)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnectionWizard.java 2010-12-02
16:44:20 UTC (rev 27111)
@@ -50,9 +50,10 @@
protected CloudConnectionPage createCloudConnectionPage() {
try {
- if (initialCloud == null)
+ if (initialCloud == null) {
return new CloudConnectionPage(pageTitle, this);
- // else
+ }
+
return new CloudConnectionPage(pageTitle, initialCloud, this);
} catch (Exception e) {
ErrorUtils.handleError(WizardMessages.getString("EditCloudConnectionError.title"),
@@ -87,8 +88,7 @@
DeltaCloud newCloud = new DeltaCloud(name, url, username, password);
return newCloud.testConnection();
} catch (DeltaCloudException e) {
- ErrorUtils
- .handleError(WizardMessages.getString("CloudConnectionAuthError.title"),
+ ErrorUtils.handleError(WizardMessages.getString("CloudConnectionAuthError.title"),
WizardMessages.getFormattedString("CloudConnectionAuthError.message",
url), e, getShell());
return true;
}
@@ -112,10 +112,24 @@
public boolean performFinish() {
String name = mainPage.getModel().getName();
String url = mainPage.getModel().getUrl();
+ storeUrl(url);
String username = mainPage.getModel().getUsername();
String password = mainPage.getModel().getPassword();
String type = getServerType();
+ try {
+ DeltaCloud newCloud = new DeltaCloud(name, url, username, password, type);
+ DeltaCloudManager.getDefault().addCloud(newCloud);
+ DeltaCloudManager.getDefault().saveClouds();
+ } catch (Exception e) {
+ // TODO internationalize strings
+ ErrorUtils
+ .handleError("Error", MessageFormat.format("Could not create cloud
{0}", name), e, getShell());
+ }
+ return true;
+ }
+
+ private void storeUrl(String url) {
// save URL in some plugin preference key!
Preferences prefs = new InstanceScope().getNode(Activator.PLUGIN_ID);
String previousURL = prefs.get(LAST_USED_URL, "");
@@ -127,16 +141,5 @@
// intentionally ignore, non-critical
}
}
-
- try {
- DeltaCloud newCloud = new DeltaCloud(name, url, username, password, type);
- DeltaCloudManager.getDefault().addCloud(newCloud);
- DeltaCloudManager.getDefault().saveClouds();
- } catch (Exception e) {
- // TODO internationalize strings
- ErrorUtils
- .handleError("Error", MessageFormat.format("Could not create cloud
{0}", name), e, getShell());
- }
- return true;
}
}