Author: adietish
Date: 2010-11-11 15:42:10 -0500 (Thu, 11 Nov 2010)
New Revision: 26472
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/DeltaCloudImageAdapterFactory.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/DeltaCloudInstanceAdapterFactory.java
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/CVInstanceElementAdapterFactory.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/FilterInstancesHandler.java
Log:
[JBIDE-7558] enabled instance filter
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml 2010-11-11 20:29:54
UTC (rev 26471)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml 2010-11-11 20:42:10
UTC (rev 26472)
@@ -264,7 +264,7 @@
<activeWhen>
<with
variable="selection">
- <iterate>
+ <iterate operator="and">
<instanceof
value="org.jboss.tools.deltacloud.ui.views.CVImageElement">
</instanceof>
@@ -282,9 +282,9 @@
<activeWhen>
<with
variable="selection">
- <iterate>
+ <iterate operator="and">
<instanceof
-
value="org.jboss.tools.deltacloud.ui.views.CVImageElement" />
+
value="org.jboss.tools.deltacloud.ui.views.CloudViewElement" />
</iterate>
</with>
</activeWhen>
@@ -295,11 +295,11 @@
<activeWhen>
<with
variable="selection">
- i <iterate>
+ i <iterate operator="and">
<adapt
-
type="org.jboss.tools.deltacloud.core.DeltaCloudInstance">
+
type="org.jboss.tools.deltacloud.core.DeltaCloud">
<instanceof
-
value="org.jboss.tools.deltacloud.core.DeltaCloudInstance" />
+ value="org.jboss.tools.deltacloud.core.DeltaCloud"
/>
</adapt>
</iterate>
</with>
@@ -599,34 +599,12 @@
label="%command.filterimages.label"
style="push"
tooltip="%command.filterimages.tooltip">
- <visibleWhen
- checkEnabled="true">
- <with
- variable="selection">
- <iterate>
- <instanceof
- value="org.jboss.tools.deltacloud.core">
- </instanceof>
- </iterate>
- </with>
- </visibleWhen>
</command>
<command
commandId="org.jboss.tools.deltacloud.ui.filterinstances"
label="%command.filterinstances.label"
style="push"
tooltip="%command.filterinstances.tooltip">
- <visibleWhen
- checkEnabled="true">
- <with
- variable="selection">
- <iterate>
- <instanceof
-
value="org.jboss.tools.deltacloud.ui.views.CloudViewElement">
- </instanceof>
- </iterate>
- </with>
- </visibleWhen>
</command>
</menuContribution>
<!-- DeltaCloudView local menu ========================================= -->
@@ -727,6 +705,20 @@
type="org.jboss.tools.deltacloud.core.DeltaCloudInstance">
</adapter>
</factory>
+ <factory
+ adaptableType="org.jboss.tools.deltacloud.core.DeltaCloudInstance"
+
class="org.jboss.tools.deltacloud.ui.DeltaCloudInstanceAdapterFactory">
+ <adapter
+ type="org.jboss.tools.deltacloud.core.DeltaCloud">
+ </adapter>
+ </factory>
+ <factory
+ adaptableType="org.jboss.tools.deltacloud.core.DeltaCloudImage"
+
class="org.jboss.tools.deltacloud.ui.DeltaCloudImageAdapterFactory">
+ <adapter
+ type="org.jboss.tools.deltacloud.core.DeltaCloud">
+ </adapter>
+ </factory>
</extension>
</plugin>
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/CVInstanceElementAdapterFactory.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/CVInstanceElementAdapterFactory.java 2010-11-11
20:29:54 UTC (rev 26471)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/CVInstanceElementAdapterFactory.java 2010-11-11
20:42:10 UTC (rev 26472)
@@ -1,20 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.deltacloud.ui;
import org.eclipse.core.runtime.IAdapterFactory;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
import org.jboss.tools.internal.deltacloud.ui.utils.UIUtils;
public class CVInstanceElementAdapterFactory implements IAdapterFactory {
+ @SuppressWarnings("rawtypes")
private static final Class[] ADAPTERS = new Class[]{
- DeltaCloudInstance.class
+ DeltaCloudInstance.class,
+ DeltaCloud.class
};
+ @SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public Object getAdapter(Object adaptableObject, Class adapterType) {
- return UIUtils.adapt(adaptableObject, DeltaCloudInstance.class);
+ return UIUtils.adapt(adaptableObject, adapterType);
}
+ @SuppressWarnings("rawtypes")
@Override
public Class[] getAdapterList() {
return ADAPTERS;
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/DeltaCloudImageAdapterFactory.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/DeltaCloudImageAdapterFactory.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/DeltaCloudImageAdapterFactory.java 2010-11-11
20:42:10 UTC (rev 26472)
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.deltacloud.ui;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudImage;
+
+public class DeltaCloudImageAdapterFactory implements IAdapterFactory {
+
+ @SuppressWarnings("rawtypes")
+ private static final Class[] ADAPTERS = new Class[]{
+ DeltaCloud.class
+ };
+
+ @SuppressWarnings("rawtypes")
+ @Override
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (adaptableObject instanceof DeltaCloudImage) {
+ return ((DeltaCloudImage) adaptableObject).getDeltaCloud();
+ } else {
+ return null;
+ }
+ }
+
+ @SuppressWarnings("rawtypes")
+ @Override
+ public Class[] getAdapterList() {
+ return ADAPTERS;
+ }
+
+}
Property changes on:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/DeltaCloudImageAdapterFactory.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/DeltaCloudInstanceAdapterFactory.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/DeltaCloudInstanceAdapterFactory.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/DeltaCloudInstanceAdapterFactory.java 2010-11-11
20:42:10 UTC (rev 26472)
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.deltacloud.ui;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
+
+public class DeltaCloudInstanceAdapterFactory implements IAdapterFactory {
+
+ @SuppressWarnings("rawtypes")
+ private static final Class[] ADAPTERS = new Class[]{
+ DeltaCloud.class
+ };
+
+ @SuppressWarnings("rawtypes")
+ @Override
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (adaptableObject instanceof DeltaCloudInstance) {
+ return ((DeltaCloudInstance) adaptableObject).getDeltaCloud();
+ } else {
+ return null;
+ }
+ }
+
+ @SuppressWarnings("rawtypes")
+ @Override
+ public Class[] getAdapterList() {
+ return ADAPTERS;
+ }
+
+}
Property changes on:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/DeltaCloudInstanceAdapterFactory.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
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 2010-11-11
20:29:54 UTC (rev 26471)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/FilterInstancesHandler.java 2010-11-11
20:42:10 UTC (rev 26472)
@@ -22,7 +22,7 @@
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.handlers.HandlerUtil;
-import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
import org.jboss.tools.internal.deltacloud.ui.utils.UIUtils;
import org.jboss.tools.internal.deltacloud.ui.wizards.InstanceFilter;
@@ -35,20 +35,20 @@
public Object execute(ExecutionEvent event) throws ExecutionException {
ISelection selection = HandlerUtil.getCurrentSelection(event);
if (selection instanceof IStructuredSelection) {
- DeltaCloudInstance deltaCloudInstance = UIUtils.getFirstAdaptedElement(selection,
DeltaCloudInstance.class);
- createInstancesFilter(deltaCloudInstance, HandlerUtil.getActiveShell(event));
+ DeltaCloud deltaCloud = UIUtils.getFirstAdaptedElement(selection, DeltaCloud.class);
+ createInstancesFilter(deltaCloud, HandlerUtil.getActiveShell(event));
}
return Status.OK_STATUS;
}
- private void createInstancesFilter(final DeltaCloudInstance instance, final Shell shell)
{
- if (instance != null) {
+ private void createInstancesFilter(final DeltaCloud cloud, final Shell shell) {
+ if (cloud != null) {
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
- IWizard wizard = new InstanceFilter(instance.getDeltaCloud());
+ IWizard wizard = new InstanceFilter(cloud);
WizardDialog dialog = new WizardDialog(shell, wizard);
dialog.create();
dialog.open();