Author: adietish
Date: 2011-03-16 12:34:57 -0400 (Wed, 16 Mar 2011)
New Revision: 29822
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/FilterImagesHandler.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/FilterInstancesHandler.java
Log:
[JBIDE-8594] enabled handlers when image-/instance-view is active or cloud is selected in
cloud viewer, changed handlers to be able to adapt image-/instance-view to DeltaCloud
instance
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2011-03-16 16:14:16
UTC (rev 29821)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2011-03-16 16:34:57
UTC (rev 29822)
@@ -1,5 +1,10 @@
2011-03-16 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
+ * plugin.xml:
+ * src/org/jboss/tools/deltacloud/ui/commands/FilterImagesHandler.java (execute):
+ * src/org/jboss/tools/deltacloud/ui/commands/FilterInstancesHandler.java (execute):
+ [JBIDE-8594] enabled handlers when image-/instance-view is active or cloud is selected
in cloud viewer,
+ changed handlers to be able to adapt image-/instance-view to DeltaCloud instance
* src/org/jboss/tools/deltacloud/ui/views/cloudelements/InstanceView.java:
* src/org/jboss/tools/deltacloud/ui/views/cloudelements/ImageView.java:
*
src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml 2011-03-16 16:14:16
UTC (rev 29821)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml 2011-03-16 16:34:57
UTC (rev 29822)
@@ -330,41 +330,31 @@
<handler
class="org.jboss.tools.deltacloud.ui.commands.FilterImagesHandler"
commandId="org.jboss.tools.deltacloud.ui.filterimages">
- <activeWhen>
- <with
- variable="selection">
- <iterate operator="and">
- <adapt
-
type="org.jboss.tools.deltacloud.core.DeltaCloud">
- </adapt>
- </iterate>
- </with>
- </activeWhen>
<enabledWhen>
- <with
- variable="selection">
- <count value="+" />
- </with>
+ <or>
+ <with
+ variable="selection">
+ <count value="1" />
+ </with>
+ <with variable="activePartId">
+ <equals
value="org.jboss.tools.deltacloud.ui.views.ImageView"/>
+ </with>
+ </or>
</enabledWhen>
</handler>
<handler
class="org.jboss.tools.deltacloud.ui.commands.FilterInstancesHandler"
commandId="org.jboss.tools.deltacloud.ui.filterinstances">
- <activeWhen>
- <with
- variable="selection">
- <iterate operator="and">
- <adapt
-
type="org.jboss.tools.deltacloud.core.DeltaCloud">
- </adapt>
- </iterate>
- </with>
- </activeWhen>
<enabledWhen>
- <with
- variable="selection">
- <count value="+" />
- </with>
+ <or>
+ <with
+ variable="selection">
+ <count value="1" />
+ </with>
+ <with variable="activePartId">
+ <equals
value="org.jboss.tools.deltacloud.ui.views.InstanceView"/>
+ </with>
+ </or>
</enabledWhen>
</handler>
</extension>
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/FilterImagesHandler.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/FilterImagesHandler.java 2011-03-16
16:14:16 UTC (rev 29821)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/FilterImagesHandler.java 2011-03-16
16:34:57 UTC (rev 29822)
@@ -34,8 +34,14 @@
public Object execute(ExecutionEvent event) throws ExecutionException {
ISelection selection = HandlerUtil.getCurrentSelection(event);
if (selection instanceof IStructuredSelection) {
- DeltaCloud cloud = WorkbenchUtils.getFirstAdaptedElement(selection,
DeltaCloud.class);
- createImagesFilter(cloud, HandlerUtil.getActiveShell(event));
+ DeltaCloud deltaCloud = WorkbenchUtils.getFirstAdaptedElement(selection,
DeltaCloud.class);
+ if (deltaCloud != null) {
+ createImagesFilter(deltaCloud, HandlerUtil.getActiveShell(event));
+ } else {
+ // no item selected: try active part
+ deltaCloud = WorkbenchUtils.adapt(HandlerUtil.getActivePart(event),
DeltaCloud.class);
+ createImagesFilter(deltaCloud, HandlerUtil.getActiveShell(event));
+ }
}
return Status.OK_STATUS;
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/FilterInstancesHandler.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/FilterInstancesHandler.java 2011-03-16
16:14:16 UTC (rev 29821)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/FilterInstancesHandler.java 2011-03-16
16:34:57 UTC (rev 29822)
@@ -35,7 +35,13 @@
ISelection selection = HandlerUtil.getCurrentSelection(event);
if (selection instanceof IStructuredSelection) {
DeltaCloud deltaCloud = WorkbenchUtils.getFirstAdaptedElement(selection,
DeltaCloud.class);
- createInstancesFilter(deltaCloud, HandlerUtil.getActiveShell(event));
+ if (deltaCloud != null) {
+ createInstancesFilter(deltaCloud, HandlerUtil.getActiveShell(event));
+ } else {
+ // no item selected: try active part
+ deltaCloud = WorkbenchUtils.adapt(HandlerUtil.getActivePart(event),
DeltaCloud.class);
+ createInstancesFilter(deltaCloud, HandlerUtil.getActiveShell(event));
+ }
}
return Status.OK_STATUS;