Author: jjohnstn
Date: 2010-10-19 15:41:57 -0400 (Tue, 19 Oct 2010)
New Revision: 25921
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/InstancePropertySource.java
Log:
2010-10-19 Jeff Johnston <jjohnstn(a)redhat.com>
[JBIDE-7366]
* src/org/jboss/tools/deltacloud/ui/views/InstancePropertySource.java
(InstancePropertySource): Calculate
the cloud in the constructor.
(getPropertyValue): For non-mock clouds where the keyname is not filled in, attempt to
refresh the instance to get the keyname.
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2010-10-19 19:39:51
UTC (rev 25920)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2010-10-19 19:41:57
UTC (rev 25921)
@@ -1,3 +1,11 @@
+2010-10-19 Jeff Johnston <jjohnstn(a)redhat.com>
+
+ [JBIDE-7366]
+ * src/org/jboss/tools/deltacloud/ui/views/InstancePropertySource.java
(InstancePropertySource): Calculate
+ the cloud in the constructor.
+ (getPropertyValue): For non-mock clouds where the keyname is not filled in, attempt to
+ refresh the instance to get the keyname.
+
2010-10-14 André Dietisheim <adietish(a)redhat.com>
* src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java:
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstancePropertySource.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstancePropertySource.java 2010-10-19
19:39:51 UTC (rev 25920)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstancePropertySource.java 2010-10-19
19:41:57 UTC (rev 25921)
@@ -15,6 +15,7 @@
import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.IPropertySource;
import org.eclipse.ui.views.properties.PropertyDescriptor;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
public class InstancePropertySource implements IPropertySource {
@@ -40,7 +41,13 @@
private IPropertyDescriptor[] propertyDescriptors;
private DeltaCloudInstance instance;
+ private DeltaCloud cloud;
public InstancePropertySource(CVInstanceElement element, Object o) {
+ CloudViewElement parent = (CloudViewElement)element.getParent();
+ while (parent != null && !(parent instanceof CVCloudElement)) {
+ parent = (CloudViewElement)parent.getParent();
+ }
+ cloud = (DeltaCloud)parent.getElement();
instance = (DeltaCloudInstance)o;
}
@@ -101,8 +108,27 @@
return instance.getRealmId();
if (id.equals(PROPERTY_IMAGEID))
return instance.getImageId();
- if (id.equals(PROPERTY_KEYNAME))
- return instance.getKey();
+ if (id.equals(PROPERTY_KEYNAME)) {
+ // At present (Deltacloud 0.0.7), the keyname is omitted
+ // in the data passed back from a listInstances request.
+ // If an instance is running and the keyname is missing,
+ // we can refresh the instance by its id and this will give us
+ // the full data. We can then replace the instance so that
+ // it will be complete for future requests until a refresh gets the
+ // entire list again.
+ String key = instance.getKey();
+ if (!cloud.getType().equals(DeltaCloudInstance.MOCK_TYPE)) {
+ if (instance.getState().equals(DeltaCloudInstance.RUNNING) && (key == null ||
key.length() == 0)) {
+ instance = cloud.refreshInstance(instance.getId());
+ if (instance != null) {
+ key = instance.getKey();
+ if (key != null && key.length() > 0)
+ cloud.addReplaceInstance(instance);
+ }
+ }
+ }
+ return key;
+ }
if (id.equals(PROPERTY_STATE)) {
return instance.getState();
}
Show replies by date