Author: adietish
Date: 2010-11-09 12:40:47 -0500 (Tue, 09 Nov 2010)
New Revision: 26391
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/InstanceStoppedPropertyTester.java
Log:
[JBIDE-7516] using adapter now to be able to use in the instance viewer, too (which does
not use CVInstanceElements but DeltaCloudInstances)
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/InstanceStoppedPropertyTester.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/InstanceStoppedPropertyTester.java 2010-11-09
17:37:26 UTC (rev 26390)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/InstanceStoppedPropertyTester.java 2010-11-09
17:40:47 UTC (rev 26391)
@@ -12,9 +12,9 @@
import org.eclipse.core.expressions.PropertyTester;
import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IAdaptable;
import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
import org.jboss.tools.deltacloud.core.client.Instance.State;
-import org.jboss.tools.deltacloud.ui.views.CVInstanceElement;
/**
* A property tester for the command framework that answers if the given
@@ -26,8 +26,8 @@
@Override
public boolean test(Object receiver, String property, Object[] args, Object
expectedValue) {
- CVInstanceElement cvInstance = (CVInstanceElement) receiver;
- DeltaCloudInstance instance = (DeltaCloudInstance) cvInstance.getElement();
+ Assert.isTrue(receiver instanceof IAdaptable);
+ DeltaCloudInstance instance = (DeltaCloudInstance) ((IAdaptable)
receiver).getAdapter(DeltaCloudInstance.class);
Assert.isTrue(expectedValue instanceof Boolean);
Boolean isExpectedValue = (Boolean) expectedValue;
boolean isStopped = State.STOPPED.toString().equals(instance.getState());
Show replies by date