Author: jjohnstn
Date: 2010-08-16 16:02:45 -0400 (Mon, 16 Aug 2010)
New Revision: 24187
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceView.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnection.java
Log:
2010-08-16 Jeff Johnston <jjohnstn(a)redhat.com>
* src/org/jboss/tools/deltacloud/ui/views/InstanceView.java (changeEvent): Check if
there any clouds and that there is a current cloud before referencing anything. If
it turns out there are no longer any clouds, set the input to an empty list of
instances.
(.modifyText): Refresh the view in an async display thread.
(createPartControl): Check if there are any clouds before setting currCloud or accessing
the clouds collection.
(initializeCloudSelector): Ditto.
* src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnection.java
(performFinish):
Create DeltaCloud with special persistence option set to true.
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2010-08-16 19:59:46
UTC (rev 24186)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2010-08-16 20:02:45
UTC (rev 24187)
@@ -1,3 +1,16 @@
+2010-08-16 Jeff Johnston <jjohnstn(a)redhat.com>
+
+ * src/org/jboss/tools/deltacloud/ui/views/InstanceView.java (changeEvent): Check if
+ there any clouds and that there is a current cloud before referencing anything. If
+ it turns out there are no longer any clouds, set the input to an empty list of
+ instances.
+ (.modifyText): Refresh the view in an async display thread.
+ (createPartControl): Check if there are any clouds before setting currCloud or
accessing
+ the clouds collection.
+ (initializeCloudSelector): Ditto.
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnection.java
(performFinish):
+ Create DeltaCloud with special persistence option set to true.
+
2010-08-13 Jeff Johnston <jjohnstn(a)redhat.com>
* icons/delta-large.gif: New file.
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceView.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceView.java 2010-08-16
19:59:46 UTC (rev 24186)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceView.java 2010-08-16
20:02:45 UTC (rev 24187)
@@ -98,10 +98,19 @@
public void modifyText(ModifyEvent e) {
int index = cloudSelector.getSelectionIndex();
currCloud = clouds[index];
- currCloud.removeInstanceListListener(parentView);
- viewer.setInput(currCloud);
- currCloud.addInstanceListListener(parentView);
- viewer.refresh();
+ Display.getCurrent().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ // TODO Auto-generated method stub
+ currCloud.removeInstanceListListener(parentView);
+ viewer.setInput(currCloud);
+ currCloud.addInstanceListListener(parentView);
+ viewer.refresh();
+
+ }
+
+ });
}
};
@@ -180,10 +189,12 @@
}
table.setSortDirection(SWT.NONE);
- currCloud = clouds[0];
- currCloud.removeInstanceListListener(parentView);
- viewer.setInput(clouds[0]);
- currCloud.addInstanceListListener(parentView);
+ if (clouds.length > 0) {
+ currCloud = clouds[0];
+ currCloud.removeInstanceListListener(parentView);
+ viewer.setInput(clouds[0]);
+ currCloud.addInstanceListListener(parentView);
+ }
FormData f = new FormData();
f.top = new FormAttachment(0, 8);
@@ -438,24 +449,36 @@
cloudNames[i] = clouds[i].getName();
}
cloudSelector.setItems(cloudNames);
- cloudSelector.setText(cloudNames[0]);
- currCloud = clouds[0];
+ if (clouds.length > 0) {
+ cloudSelector.setText(cloudNames[0]);
+ currCloud = clouds[0];
+ }
}
public void changeEvent(int type) {
- String currName = currCloud.getName();
+ String currName = null;
clouds = DeltaCloudManager.getDefault().getClouds();
+ if (currCloud != null) {
+ currName = currCloud.getName();
+ }
String[] cloudNames = new String[clouds.length];
int index = 0;
for (int i = 0; i < clouds.length; ++i) {
cloudNames[i] = clouds[i].getName();
- if (currName.equals(cloudNames[i]))
+ if (cloudNames[i].equals(currName))
index = i;
}
cloudSelector.removeModifyListener(cloudModifyListener);
cloudSelector.setItems(cloudNames);
- cloudSelector.setText(cloudNames[index]);
- currCloud = clouds[index];
+ if (cloudNames.length > 0) {
+ cloudSelector.setText(cloudNames[index]);
+ currCloud = clouds[index];
+ viewer.setInput(currCloud);
+ } else {
+ currCloud = null;
+ cloudSelector.setText("");
+ viewer.setInput(new DeltaCloudInstance[0]);
+ }
cloudSelector.addModifyListener(cloudModifyListener);
}
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnection.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnection.java 2010-08-16
19:59:46 UTC (rev 24186)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnection.java 2010-08-16
20:02:45 UTC (rev 24187)
@@ -59,7 +59,7 @@
String username = mainPage.getUsername();
String password = mainPage.getPassword();
try {
- DeltaCloud newCloud = new DeltaCloud(name, url, username, password);
+ DeltaCloud newCloud = new DeltaCloud(name, url, username, password, true);
DeltaCloudManager.getDefault().addCloud(newCloud);
} catch (MalformedURLException e) {
Activator.log(e);
Show replies by date