Author: adietish
Date: 2010-11-12 12:39:42 -0500 (Fri, 12 Nov 2010)
New Revision: 26524
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RefreshImagesHandler.java
Removed:
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/DeltaCloudImageAdapterFactory.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/DeltaCloudInstanceAdapterFactory.java
Log:
[JBIDE-7558] corrected to use DeltaCloudImage (used CVImageElement before) so that it may
be used in DeltaCloudView and ImageView
added refresh images handler, added context menu to ImageView, removed old action code.
Now all views trigger the same handlers, no duplicate action codes left.
Deleted:
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-12
17:08:39 UTC (rev 26523)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/CVInstanceElementAdapterFactory.java 2010-11-12
17:39:42 UTC (rev 26524)
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * 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,
- DeltaCloud.class
- };
-
- @SuppressWarnings({ "rawtypes", "unchecked" })
- @Override
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- return UIUtils.adapt(adaptableObject, adapterType);
- }
-
- @SuppressWarnings("rawtypes")
- @Override
- public Class[] getAdapterList() {
- return ADAPTERS;
- }
-
-}
Deleted:
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 2010-11-12
17:08:39 UTC (rev 26523)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/DeltaCloudImageAdapterFactory.java 2010-11-12
17:39:42 UTC (rev 26524)
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * 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;
- }
-
-}
Deleted:
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 2010-11-12
17:08:39 UTC (rev 26523)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/DeltaCloudInstanceAdapterFactory.java 2010-11-12
17:39:42 UTC (rev 26524)
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * 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;
- }
-
-}
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RefreshImagesHandler.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RefreshImagesHandler.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RefreshImagesHandler.java 2010-11-12
17:39:42 UTC (rev 26524)
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * 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.commands;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudImage;
+import org.jboss.tools.internal.deltacloud.ui.utils.UIUtils;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class RefreshImagesHandler extends AbstractHandler implements IHandler {
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+ if (selection instanceof IStructuredSelection) {
+ DeltaCloudImage deltaCloudImage = UIUtils.getFirstAdaptedElement(selection,
DeltaCloudImage.class);
+ refresh(deltaCloudImage);
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ private void refresh(DeltaCloudImage deltaCloudImage) {
+ if (deltaCloudImage != null) {
+ DeltaCloud cloud = deltaCloudImage.getDeltaCloud();
+ if (cloud != null) {
+ cloud.loadChildren();
+ }
+ }
+ }
+}
Property changes on:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RefreshImagesHandler.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain