Author: adietish
Date: 2010-10-14 07:22:55 -0400 (Thu, 14 Oct 2010)
New Revision: 25818
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceHandler.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/DestroyInstanceHandler.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RebootInstanceHandler.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/StartInstanceHandler.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/StopInstanceHandler.java
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/Deltacloud Tools.launch
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java
Log:
[JBIDE-7329] implemented instance actions with the commands framework
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/Deltacloud Tools.launch
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/Deltacloud
Tools.launch 2010-10-14 10:17:19 UTC (rev 25817)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/Deltacloud
Tools.launch 2010-10-14 11:22:55 UTC (rev 25818)
@@ -23,8 +23,8 @@
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS"
value="-Dosgi.requiredJavaVersion=1.5 -XX:MaxPermSize=256m -Xms40m
-Xmx1024m"/>
<stringAttribute key="pde.version" value="3.3"/>
<stringAttribute key="product" value="org.eclipse.sdk.ide"/>
-<stringAttribute key="selected_target_plugins"
value="org.eclipse.help.webapp@default:default,org.eclipse.wst.common.uriresolver@default:default,org.eclipse.core.filesystem@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.wst.validation@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.equinox.http.jetty@default:default,org.eclipse.ecf.ssl@default:false,org.eclipse.equinox.p2.engine@default:default,org.eclipse.swtbot.ant.optional.junit4@default:false,org.eclipse.ltk.core.refactoring@default:default,org.eclipse.jface@default:default,org.eclipse.wst.common.emfworkbench.integration@default:default,org.apache.lucene@default:default,org.eclipse.wst.common.environment@default:default,org.apache.commons.logging*1.0.4.v201005080501@default:default,org.mortbay.jetty.util@default:default,org.apache.commons.codec*1.3.0.v20100518-1140@default:default,org.eclipse.equinox.common@2:true,org.eclipse.compare@default:default,org.e!
clipse.ecf.provider.filetransfer@default:default,org.eclipse.ui.console@default:default,org.eclipse.jdt.compiler.apt@default:false,org.eclipse.equinox.http.servlet@default:default,org.eclipse.jface.text@default:default,org.eclipse.equinox.p2.repository@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.team.core@default:default,org.eclipse.help@default:default,org.eclipse.swt@default:default,org.mortbay.jetty.server@default:default,org.eclipse.core.jobs@default:default,org.eclipse.ui.workbench@default:default,org.eclipse.ui.navigator.resources@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.core.runtime.compatibility@default:default,org.eclipse.swt.gtk.linux.x86_64@default:false,org.apache.commons.httpclient*3.1.0.v201005080502@default:default,org.eclipse.ant.core@default:default,org.eclipse.wst.common.project.facet.core@default:default,org.apache.xml.serializer@default:default,org.eclipse.ui.cheatsheets@def!
ault:default,org.eclipse.debug.core@default:default,org.eclips!
e.wst.xm
l.core@default:default,org.eclipse.jdt.ui@default:default,org.apache.xml.resolver@default:default,org.jboss.tools.common@default:default,org.eclipse.wst.common.emf@default:default,org.junit4@default:default,org.eclipse.jdt.core.manipulation@default:default,org.eclipse.core.runtime@default:true,org.eclipse.ltk.ui.refactoring@default:default,org.eclipse.jem.util@default:default,org.apache.ant@default:default,org.eclipse.osgi.services@default:default,org.eclipse.swtbot.ant.optional.junit3@default:false,org.apache.lucene.analysis@default:default,org.eclipse.help.appserver@default:default,org.eclipse.core.net@default:default,org.eclipse.ui.views.properties.tabbed@default:default,org.eclipse.rse.services@default:default,org.eclipse.core.resources@default:default,org.eclipse.ui@default:default,org.eclipse.emf.common@default:default,javax.servlet.jsp@default:default,org.jboss.tools.xulrunner.initializer@default:false,org.eclipse.equinox.p2.metadata.repository@default:default,org.ecl!
ipse.debug.ui@default:default,org.junit*4.8.1.v4_8_1_v20100427-1100@default:default,org.eclipse.core.filesystem.linux.x86_64@default:false,org.eclipse.ecf.provider.filetransfer.ssl@default:false,org.eclipse.help.base@default:default,org.eclipse.equinox.security@default:default,org.eclipse.ui.views@default:default,org.eclipse.ui.editors@default:default,org.eclipse.sdk@default:default,org.eclipse.ui.forms@default:default,org.eclipse.compare.core@default:default,javax.xml@default:default,org.eclipse.core.net.linux.x86_64@default:false,org.eclipse.jdt.core@default:default,org.eclipse.emf.ecore.change@default:default,org.eclipse.text@default:default,org.eclipse.osgi.util@default:default,org.eclipse.core.filebuffers@default:default,org.eclipse.wst.sse.core@default:default,org.eclipse.osgi@-1:true,org.eclipse.core.databinding@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.equinox.http.registry@default:default,org.eclipse.ui.ide@default:default,org.apache.jasper@!
default:default,org.eclipse.search@default:default,org.apache.!
commons.
el@default:default,javax.servlet@default:default,org.eclipse.ui.navigator@default:default,org.eclipse.team.ui@default:default,org.eclipse.core.variables@default:default,com.instantiations.designer.jdt.fragment@default:false,org.eclipse.ui.workbench.texteditor@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.ui.ide.application@default:default,org.eclipse.rse.core@default:default,org.eclipse.jdt.compiler.tool@default:false,org.eclipse.equinox.registry@default:default,org.eclipse.wst.common.core@default:default,org.eclipse.jdt.launching@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.p2.metadata@default:default,org.eclipse.jdt.debug@default:default,org.eclipse.core.databinding.beans@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.emf.edit@default:default,org.hamcrest.core@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.update.configurator@3:true,org.eclipse.equinox.jsp.jasper.r!
egistry@default:default,org.eclipse.equinox.concurrent@default:default,org.eclipse.wst.common.frameworks@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.help.ui@default:default,org.eclipse.equinox.jsp.jasper@default:default,org.eclipse.core.commands@default:default,org.eclipse.equinox.p2.core@default:default,org.eclipse.core.expressions@default:default,org.eclipse.ecf.identity@default:default,com.ibm.icu@default:default,org.eclipse.jface.databinding@default:default,org.apache.xerces@default:default,org.eclipse.ecf@default:default,org.eclipse.equinox.security.ui@default:default"/>
-<stringAttribute key="selected_workspace_plugins"
value="org.jboss.tools.deltacloud.docs@default:default,org.jboss.tools.usage@default:default,org.jboss.tools.deltacloud.core@default:default,org.jboss.tools.deltacloud.ui@default:default"/>
+<stringAttribute key="selected_target_plugins"
value="org.eclipse.wst.common.emfworkbench.integration@default:default,org.eclipse.ui.views.properties.tabbed@default:default,org.apache.commons.codec*1.3.0.v20100518-1140@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.equinox.security.ui@default:default,org.eclipse.equinox.p2.metadata@default:default,org.eclipse.swt@default:default,org.eclipse.core.net.linux.x86_64@default:false,org.eclipse.ecf.ssl@default:false,org.eclipse.jdt.compiler.tool@default:false,org.eclipse.swtbot.ant.optional.junit4@default:false,org.eclipse.core.runtime.compatibility@default:default,org.junit*4.8.1.v4_8_1_v20100427-1100@default:default,org.eclipse.rse.services@default:default,org.eclipse.wst.common.uriresolver@default:default,org.eclipse.osgi@-1:true,org.eclipse.core.net@default:default,org.eclipse.equinox.http.jetty@default:default,org.eclipse.core.runtime@default:true,org.jbos!
s.tools.common@default:default,org.eclipse.wst.common.core@default:default,javax.servlet@default:default,org.eclipse.debug.ui@default:default,org.mortbay.jetty.server@default:default,org.eclipse.ecf.provider.filetransfer.ssl@default:false,org.eclipse.core.filesystem.linux.x86_64@default:false,org.eclipse.core.runtime.compatibility.auth@default:default,org.apache.commons.httpclient*3.1.0.v201005080502@default:default,javax.servlet.jsp@default:default,org.eclipse.ui.navigator@default:default,org.apache.commons.logging*1.0.4.v201005080501@default:default,org.eclipse.core.databinding@default:default,org.eclipse.swtbot.ant.optional.junit3@default:false,org.eclipse.wst.sse.core@default:default,org.eclipse.wst.xml.core@default:default,org.apache.xerces@default:default,org.apache.ant@default:default,org.hamcrest.core@default:default,org.eclipse.jface@default:default,org.eclipse.equinox.concurrent@default:default,org.eclipse.core.resources@default:default,org.eclipse.equinox.prefere!
nces@default:default,org.eclipse.jface.databinding@default:def!
ault,com
.instantiations.designer.jdt.fragment@default:false,org.eclipse.emf.ecore@default:default,org.eclipse.help.base@default:default,javax.xml@default:default,org.eclipse.wst.common.project.facet.core@default:default,org.eclipse.help.webapp@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.core.filesystem@default:default,org.eclipse.help.ui@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.ecf.identity@default:default,org.eclipse.jface.text@default:default,org.eclipse.wst.common.environment@default:default,org.eclipse.equinox.jsp.jasper.registry@default:default,org.eclipse.equinox.registry@default:default,com.ibm.icu@default:default,org.eclipse.search@default:default,org.eclipse.core.variables@default:default,org.eclipse.core.expressions@default:default,org.eclipse.jdt.core@default:default,org.eclipse.core.filebuffers@default:default,org.junit4@default:default,org.apache.lucene.analysis@default:default,org.mortbay.jetty.!
util@default:default,org.eclipse.compare@default:default,org.eclipse.ui.ide@default:default,org.eclipse.jdt.core.manipulation@default:default,org.eclipse.ui.cheatsheets@default:default,org.eclipse.wst.common.frameworks@default:default,org.eclipse.equinox.http.servlet@default:default,org.eclipse.ui.views@default:default,org.eclipse.ecf.provider.filetransfer@default:default,org.eclipse.jem.util@default:default,org.eclipse.sdk@default:default,org.eclipse.ui.ide.application@default:default,org.eclipse.wst.validation@default:default,org.eclipse.swt.gtk.linux.x86_64@default:false,org.eclipse.equinox.p2.metadata.repository@default:default,org.eclipse.core.databinding.beans@default:default,org.eclipse.equinox.http.registry@default:default,org.eclipse.core.jobs@default:default,org.eclipse.equinox.p2.repository@default:default,org.eclipse.ant.core@default:default,org.eclipse.core.commands@default:default,org.eclipse.equinox.security@default:default,org.apache.lucene@default:default,o!
rg.eclipse.jdt.debug@default:default,org.eclipse.ui.forms@defa!
ult:defa
ult,org.eclipse.ltk.ui.refactoring@default:default,org.eclipse.ecf@default:default,org.eclipse.team.ui@default:default,org.eclipse.help.appserver@default:default,org.eclipse.osgi.util@default:default,org.apache.jasper@default:default,org.eclipse.equinox.jsp.jasper@default:default,org.eclipse.update.configurator@3:true,org.eclipse.help@default:default,org.eclipse.ui.navigator.resources@default:default,org.jboss.tools.xulrunner.initializer@default:false,org.eclipse.equinox.app@default:default,org.eclipse.jdt.ui@default:default,org.eclipse.ui.workbench.texteditor@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.emf.edit@default:default,org.eclipse.ui@default:default,org.apache.xml.resolver@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.emf.ecore.change@default:default,org.eclipse.equinox.p2.engine@default:default,org.eclipse.jdt.compiler.apt@default:false,org.eclipse.ui.console@default:default,org.eclipse.rse!
.core@default:default,org.eclipse.text@default:default,org.eclipse.ltk.core.refactoring@default:default,org.eclipse.osgi.services@default:default,org.eclipse.ui.workbench@default:default,org.eclipse.emf.common@default:default,org.eclipse.team.core@default:default,org.eclipse.compare.core@default:default,org.apache.commons.el@default:default,org.apache.xml.serializer@default:default,org.eclipse.wst.common.emf@default:default,org.eclipse.equinox.common@2:true,org.eclipse.jdt.launching@default:default,org.eclipse.ui.editors@default:default,org.eclipse.equinox.p2.core@default:default,org.eclipse.debug.core@default:default"/>
+<stringAttribute key="selected_workspace_plugins"
value="org.jboss.tools.deltacloud.docs@default:default,org.jboss.tools.deltacloud.ui@default:default,org.jboss.tools.deltacloud.core@default:default,org.jboss.tools.usage@default:default"/>
<booleanAttribute key="show_selected_only" value="false"/>
<stringAttribute key="templateConfig"
value="${target_home}/configuration/config.ini"/>
<booleanAttribute key="tracing" value="false"/>
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml 2010-10-14 10:17:19
UTC (rev 25817)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml 2010-10-14 11:22:55
UTC (rev 25818)
@@ -102,6 +102,7 @@
name="%Preferences.name">
</page>
</extension>
+ <!-- connection command handlers -->
<extension
point="org.eclipse.ui.handlers">
<handler
@@ -111,7 +112,7 @@
<handler
class="org.jboss.tools.deltacloud.ui.commands.EditConnectionHandler"
commandId="org.jboss.tools.deltacloud.ui.editconnection">
- <enabledWhen>
+ <activeWhen>
<with
variable="selection">
<iterate>
@@ -120,12 +121,12 @@
</instanceof>
</iterate>
</with>
- </enabledWhen>
+ </activeWhen>
</handler>
<handler
class="org.jboss.tools.deltacloud.ui.commands.DisconnectCloudHandler"
commandId="org.eclipse.ui.edit.delete">
- <enabledWhen>
+ <activeWhen>
<with
variable="selection">
<iterate>
@@ -134,8 +135,80 @@
</instanceof>
</iterate>
</with>
- </enabledWhen>
+ </activeWhen>
</handler>
+ <!-- instance command handlers -->
+ <handler
+
class="org.jboss.tools.deltacloud.ui.commands.StartInstanceHandler"
+ commandId="org.jboss.tools.deltacloud.ui.startinstance">
+ <activeWhen>
+ <with
+ variable="selection">
+ <iterate operator="and">
+ <instanceof
+
value="org.jboss.tools.deltacloud.ui.views.CVInstanceElement">
+ </instanceof>
+ </iterate>
+ </with>
+ </activeWhen>
+ </handler>
+ <handler
+ class="org.jboss.tools.deltacloud.ui.commands.StopInstanceHandler"
+ commandId="org.jboss.tools.deltacloud.ui.stopinstance">
+ <activeWhen>
+ <with
+ variable="selection">
+ <iterate>
+ <instanceof
+
value="org.jboss.tools.deltacloud.ui.views.CVInstanceElement">
+ </instanceof>
+ </iterate>
+ </with>
+ </activeWhen>
+ </handler>
+ <handler
+
class="org.jboss.tools.deltacloud.ui.commands.RebootInstanceHandler"
+ commandId="org.jboss.tools.deltacloud.ui.rebootinstance">
+ <activeWhen>
+ <with
+ variable="selection">
+ <iterate>
+ <instanceof
+
value="org.jboss.tools.deltacloud.ui.views.CVInstanceElement">
+ </instanceof>
+ </iterate>
+ </with>
+ </activeWhen>
+ </handler>
+ <handler
+
class="org.jboss.tools.deltacloud.ui.commands.DestroyInstanceHandler"
+ commandId="org.jboss.tools.deltacloud.ui.destroyinstance">
+ <activeWhen>
+ <with
+ variable="selection">
+ <iterate>
+ <instanceof
+
value="org.jboss.tools.deltacloud.ui.views.CVInstanceElement">
+ </instanceof>
+ </iterate>
+ </with>
+ </activeWhen>
+ </handler>
+ <!-- image command handlers -->
+ <handler
+
class="org.jboss.tools.deltacloud.ui.commands.CreateInstanceHandler"
+ commandId="org.jboss.tools.deltacloud.ui.createinstance">
+ <activeWhen>
+ <with
+ variable="selection">
+ <iterate>
+ <instanceof
+
value="org.jboss.tools.deltacloud.ui.views.CVImageElement">
+ </instanceof>
+ </iterate>
+ </with>
+ </activeWhen>
+ </handler>
</extension>
<extension
point="org.eclipse.ui.menus">
@@ -145,17 +218,114 @@
<command
commandId="org.eclipse.ui.edit.delete"
label="Disconnect Cloud"
- style="push">
+ style="push"
+ tooltip="Disconnect Cloud">
</command>
<command
commandId="org.jboss.tools.deltacloud.ui.newconnection"
label="New Connection"
- style="push">
+ style="push"
+ tooltip="New Connection">
</command>
<command
commandId="org.jboss.tools.deltacloud.ui.editconnection"
label="Edit Connection"
+ style="push"
+ tooltip="Edit Conncetion">
+ </command>
+ <!-- image commands -->
+ <command
+ commandId="org.jboss.tools.deltacloud.ui.createinstance"
+ icon="icons/instance.gif"
+ label="Launch Instance"
+ style="push"
+ tooltip="Launch Instance">
+ <visibleWhen
+ checkEnabled="true">
+ <with
+ variable="selection">
+ <iterate>
+ <instanceof
+
value="org.jboss.tools.deltacloud.ui.views.CVImageElement">
+ </instanceof>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
+ <!-- instance commands -->
+ <command
+ commandId="org.jboss.tools.deltacloud.ui.startinstance"
+ disabledIcon="icons/runningd.gif"
+ icon="icons/running.gif"
+ label="Start"
+ style="push"
+ tooltip="Start">
+ <visibleWhen
+ checkEnabled="true">
+ <with
+ variable="selection">
+ <iterate>
+ <instanceof
+
value="org.jboss.tools.deltacloud.ui.views.CVInstanceElement">
+ </instanceof>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.jboss.tools.deltacloud.ui.stopinstance"
+ disabledIcon="icons/stoppedd.gif"
+ icon="icons/stopped.gif"
+ label="Stop"
+ style="push"
+ tooltip="Stop">
+ <visibleWhen
+ checkEnabled="true">
+ <with
+ variable="selection">
+ <iterate>
+ <instanceof
+
value="org.jboss.tools.deltacloud.ui.views.CVInstanceElement">
+ </instanceof>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.jboss.tools.deltacloud.ui.rebootinstance"
+ disabledIcon="icons/rebootd.gif"
+ icon="icons/reboot.gif"
+ label="Reboot"
+ style="push"
+ tooltip="Reboot">
+ <visibleWhen
+ checkEnabled="true">
+ <with
+ variable="selection">
+ <iterate>
+ <instanceof
+
value="org.jboss.tools.deltacloud.ui.views.CVInstanceElement">
+ </instanceof>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.jboss.tools.deltacloud.ui.destroyinstance"
+ hoverIcon="Destroy"
+ label="Destroy"
style="push">
+ <visibleWhen
+ checkEnabled="true">
+ <with
+ variable="selection">
+ <iterate>
+ <instanceof
+
value="org.jboss.tools.deltacloud.ui.views.CVInstanceElement">
+ </instanceof>
+ </iterate>
+ </with>
+ </visibleWhen>
</command>
</menuContribution>
</extension>
@@ -170,6 +340,33 @@
id="org.jboss.tools.deltacloud.ui.editconnection"
name="Edit Connection">
</command>
+ <!-- image commands -->
+ <command
+ description="Launches an instance"
+ id="org.jboss.tools.deltacloud.ui.createinstance"
+ name="Launch Instance">
+ </command>
+ <!-- instance commands -->
+ <command
+ description="Starts a cloud instance"
+ id="org.jboss.tools.deltacloud.ui.startinstance"
+ name="Start">
+ </command>
+ <command
+ description="Stops a cloud instance"
+ id="org.jboss.tools.deltacloud.ui.stopinstance"
+ name="Stop">
+ </command>
+ <command
+ description="Reboots a cloud instance"
+ id="org.jboss.tools.deltacloud.ui.rebootinstance"
+ name="Reboot">
+ </command>
+ <command
+ description="Stops a cloud instance"
+ id="org.jboss.tools.deltacloud.ui.destroyinstance"
+ name="Destroy">
+ </command>
</extension>
</plugin>
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceHandler.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceHandler.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceHandler.java 2010-10-14
11:22:55 UTC (rev 25818)
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * 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.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudImage;
+import org.jboss.tools.deltacloud.ui.views.CVCategoryElement;
+import org.jboss.tools.deltacloud.ui.views.CVCloudElement;
+import org.jboss.tools.deltacloud.ui.views.CVImageElement;
+import org.jboss.tools.internal.deltacloud.ui.utils.UIUtils;
+import org.jboss.tools.internal.deltacloud.ui.wizards.NewInstance;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class CreateInstanceHandler extends AbstractHandler implements IHandler {
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+ if (selection instanceof IStructuredSelection) {
+ CVImageElement cvImage = UIUtils.getFirstElement(selection, CVImageElement.class);
+ createInstance(cvImage, HandlerUtil.getActiveShell(event));
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ private void createInstance(CVImageElement cvImage, Shell shell) {
+ if (cvImage != null) {
+ DeltaCloudImage image = (DeltaCloudImage) cvImage.getElement();
+ CVCategoryElement images = (CVCategoryElement) cvImage.getParent();
+ CVCloudElement cloudElement = (CVCloudElement) images.getParent();
+ DeltaCloud cloud = (DeltaCloud) cloudElement.getElement();
+ IWizard wizard = new NewInstance(cloud, image);
+ WizardDialog dialog = new WizardDialog(shell, wizard);
+ dialog.create();
+ dialog.open();
+ }
+ }
+}
Property changes on:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceHandler.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/DestroyInstanceHandler.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/DestroyInstanceHandler.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/DestroyInstanceHandler.java 2010-10-14
11:22:55 UTC (rev 25818)
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * 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.DeltaCloudInstance;
+import org.jboss.tools.deltacloud.ui.views.CVCloudElement;
+import org.jboss.tools.deltacloud.ui.views.CVInstanceElement;
+import org.jboss.tools.deltacloud.ui.views.CVMessages;
+import org.jboss.tools.deltacloud.ui.views.CloudViewElement;
+import org.jboss.tools.deltacloud.ui.views.PerformDestroyInstanceActionThread;
+import org.jboss.tools.internal.deltacloud.ui.utils.UIUtils;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class DestroyInstanceHandler extends AbstractHandler implements IHandler {
+
+ private final static String DESTROYING_INSTANCE_TITLE =
"DestroyingInstance.title"; //$NON-NLS-1$
+ private final static String DESTROYING_INSTANCE_MSG =
"DestroyingInstance.msg"; //$NON-NLS-1$
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+ if (selection instanceof IStructuredSelection) {
+ CVInstanceElement cvInstance = UIUtils.getFirstElement(selection,
CVInstanceElement.class);
+ rebootInstance(cvInstance);
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ private void rebootInstance(CVInstanceElement cvInstance) {
+ if (cvInstance != null) {
+ DeltaCloudInstance instance = (DeltaCloudInstance) cvInstance.getElement();
+ CloudViewElement element = cvInstance;
+ while (!(element instanceof CVCloudElement))
+ element = (CloudViewElement) element.getParent();
+ CVCloudElement cvcloud = (CVCloudElement) element;
+ DeltaCloud cloud = (DeltaCloud) cvcloud.getElement();
+ PerformDestroyInstanceActionThread t = new PerformDestroyInstanceActionThread(cloud,
instance,
+ CVMessages.getString(DESTROYING_INSTANCE_TITLE),
+ CVMessages.getFormattedString(DESTROYING_INSTANCE_MSG, new String[] {
instance.getName() }));
+ t.setUser(true);
+ t.schedule();
+ }
+ }
+}
Property changes on:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/DestroyInstanceHandler.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RebootInstanceHandler.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RebootInstanceHandler.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RebootInstanceHandler.java 2010-10-14
11:22:55 UTC (rev 25818)
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * 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.DeltaCloudInstance;
+import org.jboss.tools.deltacloud.ui.views.CVCloudElement;
+import org.jboss.tools.deltacloud.ui.views.CVInstanceElement;
+import org.jboss.tools.deltacloud.ui.views.CVMessages;
+import org.jboss.tools.deltacloud.ui.views.CloudViewElement;
+import org.jboss.tools.deltacloud.ui.views.PerformInstanceActionThread;
+import org.jboss.tools.internal.deltacloud.ui.utils.UIUtils;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class RebootInstanceHandler extends AbstractHandler implements IHandler {
+
+ private final static String REBOOTING_INSTANCE_TITLE =
"RebootingInstance.title"; //$NON-NLS-1$
+ private final static String REBOOTING_INSTANCE_MSG = "RebootingInstance.msg";
//$NON-NLS-1$
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+ if (selection instanceof IStructuredSelection) {
+ CVInstanceElement cvInstance = UIUtils.getFirstElement(selection,
CVInstanceElement.class);
+ rebootInstance(cvInstance);
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ private void rebootInstance(CVInstanceElement cvInstance) {
+ if (cvInstance != null) {
+ DeltaCloudInstance instance = (DeltaCloudInstance) cvInstance.getElement();
+ CloudViewElement element = cvInstance;
+ while (!(element instanceof CVCloudElement))
+ element = (CloudViewElement) element.getParent();
+ CVCloudElement cvcloud = (CVCloudElement) element;
+ DeltaCloud cloud = (DeltaCloud) cvcloud.getElement();
+ PerformInstanceActionThread t = new PerformInstanceActionThread(cloud, instance,
+ DeltaCloudInstance.REBOOT,
+ CVMessages.getString(REBOOTING_INSTANCE_TITLE),
+ CVMessages.getFormattedString(REBOOTING_INSTANCE_MSG, new String[] {
instance.getName() }),
+ DeltaCloudInstance.RUNNING);
+ t.setUser(true);
+ t.schedule();
+ }
+ }
+}
Property changes on:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RebootInstanceHandler.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/StartInstanceHandler.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/StartInstanceHandler.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/StartInstanceHandler.java 2010-10-14
11:22:55 UTC (rev 25818)
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * 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.DeltaCloudInstance;
+import org.jboss.tools.deltacloud.ui.views.CVCloudElement;
+import org.jboss.tools.deltacloud.ui.views.CVInstanceElement;
+import org.jboss.tools.deltacloud.ui.views.CVMessages;
+import org.jboss.tools.deltacloud.ui.views.CloudViewElement;
+import org.jboss.tools.deltacloud.ui.views.PerformInstanceActionThread;
+import org.jboss.tools.internal.deltacloud.ui.utils.UIUtils;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class StartInstanceHandler extends AbstractHandler implements IHandler {
+
+ private final static String STARTING_INSTANCE_TITLE =
"StartingInstance.title"; //$NON-NLS-1$
+ private final static String STARTING_INSTANCE_MSG = "StartingInstance.msg";
//$NON-NLS-1$
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+ if (selection instanceof IStructuredSelection) {
+ CVInstanceElement cvinstance = UIUtils.getFirstElement(selection,
CVInstanceElement.class);
+ startInstance(cvinstance);
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ private void startInstance(CVInstanceElement cvInstance) {
+ DeltaCloudInstance instance = (DeltaCloudInstance) cvInstance.getElement();
+ CloudViewElement element = cvInstance;
+ while (!(element instanceof CVCloudElement)) {
+ element = (CloudViewElement) element.getParent();
+ }
+ CVCloudElement cvcloud = (CVCloudElement) element;
+ DeltaCloud cloud = (DeltaCloud) cvcloud.getElement();
+ PerformInstanceActionThread t = new PerformInstanceActionThread(cloud, instance,
+ DeltaCloudInstance.START,
+ CVMessages.getString(STARTING_INSTANCE_TITLE),
+ CVMessages.getFormattedString(STARTING_INSTANCE_MSG, new String[] {
instance.getName() }),
+ DeltaCloudInstance.RUNNING);
+ t.setUser(true);
+ t.schedule();
+ }
+}
Property changes on:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/StartInstanceHandler.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/StopInstanceHandler.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/StopInstanceHandler.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/StopInstanceHandler.java 2010-10-14
11:22:55 UTC (rev 25818)
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * 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.DeltaCloudInstance;
+import org.jboss.tools.deltacloud.ui.views.CVCloudElement;
+import org.jboss.tools.deltacloud.ui.views.CVInstanceElement;
+import org.jboss.tools.deltacloud.ui.views.CVMessages;
+import org.jboss.tools.deltacloud.ui.views.CloudViewElement;
+import org.jboss.tools.deltacloud.ui.views.PerformInstanceActionThread;
+import org.jboss.tools.internal.deltacloud.ui.utils.UIUtils;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class StopInstanceHandler extends AbstractHandler implements IHandler {
+
+ private final static String STOPPING_INSTANCE_TITLE =
"StoppingInstance.title"; //$NON-NLS-1$
+ private final static String STOPPING_INSTANCE_MSG = "StoppingInstance.msg";
//$NON-NLS-1$
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+ if (selection instanceof IStructuredSelection) {
+ CVInstanceElement cvInstance = UIUtils.getFirstElement(selection,
CVInstanceElement.class);
+ stopInstance(cvInstance);
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ private void stopInstance(CVInstanceElement cvInstance) {
+ if (cvInstance != null) {
+ DeltaCloudInstance instance = (DeltaCloudInstance) cvInstance.getElement();
+ CloudViewElement element = cvInstance;
+ while (!(element instanceof CVCloudElement))
+ element = (CloudViewElement) element.getParent();
+ CVCloudElement cvcloud = (CVCloudElement) element;
+ DeltaCloud cloud = (DeltaCloud) cvcloud.getElement();
+ PerformInstanceActionThread t = new PerformInstanceActionThread(cloud, instance,
+ DeltaCloudInstance.STOP,
+ CVMessages.getString(STOPPING_INSTANCE_TITLE),
+ CVMessages.getFormattedString(STOPPING_INSTANCE_MSG, new String[] {
instance.getName() }),
+ DeltaCloudInstance.STOPPED);
+ t.setUser(true);
+ t.schedule();
+ }
+ }
+}
Property changes on:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/StopInstanceHandler.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java 2010-10-14
10:17:19 UTC (rev 25817)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java 2010-10-14
11:22:55 UTC (rev 25818)
@@ -62,18 +62,10 @@
private static final String REFRESH = "Refresh.label"; //$NON-NLS-1$
private static final String CREATE_INSTANCE = "CreateInstance.label";
//$NON-NLS-1$
- private final static String START_LABEL = "Start.label"; //$NON-NLS-1$
- private final static String STOP_LABEL = "Stop.label"; //$NON-NLS-1$
- private final static String REBOOT_LABEL = "Reboot.label"; //$NON-NLS-1$
- private final static String DESTROY_LABEL = "Destroy.label"; //$NON-NLS-1$
- private final static String STARTING_INSTANCE_TITLE =
"StartingInstance.title"; //$NON-NLS-1$
- private final static String STARTING_INSTANCE_MSG = "StartingInstance.msg";
//$NON-NLS-1$
- private final static String STOPPING_INSTANCE_TITLE =
"StoppingInstance.title"; //$NON-NLS-1$
- private final static String STOPPING_INSTANCE_MSG = "StoppingInstance.msg";
//$NON-NLS-1$
- private final static String REBOOTING_INSTANCE_TITLE =
"RebootingInstance.title"; //$NON-NLS-1$
- private final static String REBOOTING_INSTANCE_MSG = "RebootingInstance.msg";
//$NON-NLS-1$
- private final static String DESTROYING_INSTANCE_TITLE =
"DestroyingInstance.title"; //$NON-NLS-1$
- private final static String DESTROYING_INSTANCE_MSG =
"DestroyingInstance.msg"; //$NON-NLS-1$
+// private final static String START_LABEL = "Start.label"; //$NON-NLS-1$
+// private final static String STOP_LABEL = "Stop.label"; //$NON-NLS-1$
+// private final static String REBOOT_LABEL = "Reboot.label"; //$NON-NLS-1$
+// private final static String DESTROY_LABEL = "Destroy.label"; //$NON-NLS-1$
private final static String IMAGE_FILTER = "ImageFilter.label"; //$NON-NLS-1$
private final static String INSTANCE_FILTER = "InstanceFilter.label";
//$NON-NLS-1$
public static final String COLLAPSE_ALL = "CollapseAll.label"; //$NON-NLS-1$
@@ -81,18 +73,11 @@
private TreeViewer viewer;
private Action refreshAction;
- private Action startAction;
- private Action stopAction;
- private Action rebootAction;
- private Action destroyAction;
private Action collapseall;
private Action doubleClickAction;
- private Action createInstance;
private Action imageFilterAction;
private Action instanceFilterAction;
- private Map<String, Action> instanceActions;
-
private CloudViewElement selectedElement;
/**
@@ -173,18 +158,6 @@
}
private void fillContextMenu(IMenuManager manager) {
- if (selectedElement instanceof CVImageElement) {
- manager.add(createInstance);
- } else if (selectedElement instanceof CVInstanceElement) {
- CVInstanceElement element = (CVInstanceElement) selectedElement;
- DeltaCloudInstance instance = (DeltaCloudInstance) element.getElement();
- List<String> actions = instance.getActions();
- for (String action : actions) {
- manager.add(instanceActions.get(action));
- }
- // manager.add(new
- // Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- }
manager.add(imageFilterAction);
manager.add(instanceFilterAction);
// Other plug-ins can contribute there actions here
@@ -196,19 +169,12 @@
}
private void makeActions() {
- createInstance = createInstanceAction();
refreshAction = createRefreshAction();
- startAction = createStartAction();
- stopAction = createStopAction();
- rebootAction = createRebootAction();
- destroyAction = createDestroyAction();
+// startAction = createStartAction();
+// stopAction = createStopAction();
+// rebootAction = createRebootAction();
+// destroyAction = createDestroyAction();
- instanceActions = new HashMap<String, Action>();
- instanceActions.put(DeltaCloudInstance.START, startAction);
- instanceActions.put(DeltaCloudInstance.STOP, stopAction);
- instanceActions.put(DeltaCloudInstance.REBOOT, rebootAction);
- instanceActions.put(DeltaCloudInstance.DESTROY, destroyAction);
-
imageFilterAction = createImageFilterAction();
instanceFilterAction = createInstanceFilterAction();
@@ -301,127 +267,127 @@
return imageFilterAction;
}
- private Action createDestroyAction() {
- Action destroyAction = new Action() {
- public void run() {
- ISelection selection = viewer.getSelection();
- Object obj = ((IStructuredSelection) selection).getFirstElement();
- if (obj instanceof CVInstanceElement) {
- CVInstanceElement cvinstance = (CVInstanceElement) obj;
- DeltaCloudInstance instance = (DeltaCloudInstance) cvinstance.getElement();
- CloudViewElement element = (CloudViewElement) obj;
- while (!(element instanceof CVCloudElement))
- element = (CloudViewElement) element.getParent();
- CVCloudElement cvcloud = (CVCloudElement) element;
- DeltaCloud cloud = (DeltaCloud) cvcloud.getElement();
- PerformDestroyInstanceActionThread t = new PerformDestroyInstanceActionThread(cloud,
instance,
- CVMessages.getString(DESTROYING_INSTANCE_TITLE),
- CVMessages.getFormattedString(DESTROYING_INSTANCE_MSG, new String[] {
instance.getName() }));
- t.setUser(true);
- t.schedule();
- }
- }
- };
- destroyAction.setText(CVMessages.getString(DESTROY_LABEL));
- destroyAction.setToolTipText(CVMessages.getString(DESTROY_LABEL));
- ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
- ImageDescriptor delete =
ImageDescriptor.createFromImage(sharedImages.getImage(ISharedImages.IMG_ETOOL_DELETE));
- ImageDescriptor delete_disabled = ImageDescriptor.createFromImage(sharedImages
- .getImage(ISharedImages.IMG_ETOOL_DELETE_DISABLED));
- destroyAction.setImageDescriptor(delete);
- destroyAction.setDisabledImageDescriptor(delete_disabled);
- return destroyAction;
- }
+// private Action createDestroyAction() {
+// Action destroyAction = new Action() {
+// public void run() {
+// ISelection selection = viewer.getSelection();
+// Object obj = ((IStructuredSelection) selection).getFirstElement();
+// if (obj instanceof CVInstanceElement) {
+// CVInstanceElement cvinstance = (CVInstanceElement) obj;
+// DeltaCloudInstance instance = (DeltaCloudInstance) cvinstance.getElement();
+// CloudViewElement element = (CloudViewElement) obj;
+// while (!(element instanceof CVCloudElement))
+// element = (CloudViewElement) element.getParent();
+// CVCloudElement cvcloud = (CVCloudElement) element;
+// DeltaCloud cloud = (DeltaCloud) cvcloud.getElement();
+// PerformDestroyInstanceActionThread t = new
PerformDestroyInstanceActionThread(cloud, instance,
+// CVMessages.getString(DESTROYING_INSTANCE_TITLE),
+// CVMessages.getFormattedString(DESTROYING_INSTANCE_MSG, new String[] {
instance.getName() }));
+// t.setUser(true);
+// t.schedule();
+// }
+// }
+// };
+// destroyAction.setText(CVMessages.getString(DESTROY_LABEL));
+// destroyAction.setToolTipText(CVMessages.getString(DESTROY_LABEL));
+// ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
+// ImageDescriptor delete =
ImageDescriptor.createFromImage(sharedImages.getImage(ISharedImages.IMG_ETOOL_DELETE));
+// ImageDescriptor delete_disabled = ImageDescriptor.createFromImage(sharedImages
+// .getImage(ISharedImages.IMG_ETOOL_DELETE_DISABLED));
+// destroyAction.setImageDescriptor(delete);
+// destroyAction.setDisabledImageDescriptor(delete_disabled);
+// return destroyAction;
+// }
- private Action createRebootAction() {
- Action rebootAction = new Action() {
- public void run() {
- ISelection selection = viewer.getSelection();
- Object obj = ((IStructuredSelection) selection).getFirstElement();
- if (obj instanceof CVInstanceElement) {
- CVInstanceElement cvinstance = (CVInstanceElement) obj;
- DeltaCloudInstance instance = (DeltaCloudInstance) cvinstance.getElement();
- CloudViewElement element = (CloudViewElement) obj;
- while (!(element instanceof CVCloudElement))
- element = (CloudViewElement) element.getParent();
- CVCloudElement cvcloud = (CVCloudElement) element;
- DeltaCloud cloud = (DeltaCloud) cvcloud.getElement();
- PerformInstanceActionThread t = new PerformInstanceActionThread(cloud, instance,
- DeltaCloudInstance.REBOOT,
- CVMessages.getString(REBOOTING_INSTANCE_TITLE),
- CVMessages.getFormattedString(REBOOTING_INSTANCE_MSG, new String[] {
instance.getName() }),
- DeltaCloudInstance.RUNNING);
- t.setUser(true);
- t.schedule();
- }
- }
- };
- rebootAction.setText(CVMessages.getString(REBOOT_LABEL));
- rebootAction.setToolTipText(CVMessages.getString(REBOOT_LABEL));
- rebootAction.setImageDescriptor(SWTImagesFactory.DESC_REBOOT);
- rebootAction.setDisabledImageDescriptor(SWTImagesFactory.DESC_REBOOTD);
- return rebootAction;
- }
+// private Action createRebootAction() {
+// Action rebootAction = new Action() {
+// public void run() {
+// ISelection selection = viewer.getSelection();
+// Object obj = ((IStructuredSelection) selection).getFirstElement();
+// if (obj instanceof CVInstanceElement) {
+// CVInstanceElement cvinstance = (CVInstanceElement) obj;
+// DeltaCloudInstance instance = (DeltaCloudInstance) cvinstance.getElement();
+// CloudViewElement element = (CloudViewElement) obj;
+// while (!(element instanceof CVCloudElement))
+// element = (CloudViewElement) element.getParent();
+// CVCloudElement cvcloud = (CVCloudElement) element;
+// DeltaCloud cloud = (DeltaCloud) cvcloud.getElement();
+// PerformInstanceActionThread t = new PerformInstanceActionThread(cloud, instance,
+// DeltaCloudInstance.REBOOT,
+// CVMessages.getString(REBOOTING_INSTANCE_TITLE),
+// CVMessages.getFormattedString(REBOOTING_INSTANCE_MSG, new String[] {
instance.getName() }),
+// DeltaCloudInstance.RUNNING);
+// t.setUser(true);
+// t.schedule();
+// }
+// }
+// };
+// rebootAction.setText(CVMessages.getString(REBOOT_LABEL));
+// rebootAction.setToolTipText(CVMessages.getString(REBOOT_LABEL));
+// rebootAction.setImageDescriptor(SWTImagesFactory.DESC_REBOOT);
+// rebootAction.setDisabledImageDescriptor(SWTImagesFactory.DESC_REBOOTD);
+// return rebootAction;
+// }
- private Action createStopAction() {
- Action stopAction = new Action() {
- public void run() {
- ISelection selection = viewer.getSelection();
- Object obj = ((IStructuredSelection) selection).getFirstElement();
- if (obj instanceof CVInstanceElement) {
- CVInstanceElement cvinstance = (CVInstanceElement) obj;
- DeltaCloudInstance instance = (DeltaCloudInstance) cvinstance.getElement();
- CloudViewElement element = (CloudViewElement) obj;
- while (!(element instanceof CVCloudElement))
- element = (CloudViewElement) element.getParent();
- CVCloudElement cvcloud = (CVCloudElement) element;
- DeltaCloud cloud = (DeltaCloud) cvcloud.getElement();
- PerformInstanceActionThread t = new PerformInstanceActionThread(cloud, instance,
- DeltaCloudInstance.STOP,
- CVMessages.getString(STOPPING_INSTANCE_TITLE),
- CVMessages.getFormattedString(STOPPING_INSTANCE_MSG, new String[] {
instance.getName() }),
- DeltaCloudInstance.STOPPED);
- t.setUser(true);
- t.schedule();
- }
- }
- };
- stopAction.setText(CVMessages.getString(STOP_LABEL));
- stopAction.setToolTipText(CVMessages.getString(STOP_LABEL));
- stopAction.setImageDescriptor(SWTImagesFactory.DESC_STOP);
- stopAction.setDisabledImageDescriptor(SWTImagesFactory.DESC_STOPD);
- return stopAction;
- }
+// private Action createStopAction() {
+// Action stopAction = new Action() {
+// public void run() {
+// ISelection selection = viewer.getSelection();
+// Object obj = ((IStructuredSelection) selection).getFirstElement();
+// if (obj instanceof CVInstanceElement) {
+// CVInstanceElement cvinstance = (CVInstanceElement) obj;
+// DeltaCloudInstance instance = (DeltaCloudInstance) cvinstance.getElement();
+// CloudViewElement element = (CloudViewElement) obj;
+// while (!(element instanceof CVCloudElement))
+// element = (CloudViewElement) element.getParent();
+// CVCloudElement cvcloud = (CVCloudElement) element;
+// DeltaCloud cloud = (DeltaCloud) cvcloud.getElement();
+// PerformInstanceActionThread t = new PerformInstanceActionThread(cloud, instance,
+// DeltaCloudInstance.STOP,
+// CVMessages.getString(STOPPING_INSTANCE_TITLE),
+// CVMessages.getFormattedString(STOPPING_INSTANCE_MSG, new String[] {
instance.getName() }),
+// DeltaCloudInstance.STOPPED);
+// t.setUser(true);
+// t.schedule();
+// }
+// }
+// };
+// stopAction.setText(CVMessages.getString(STOP_LABEL));
+// stopAction.setToolTipText(CVMessages.getString(STOP_LABEL));
+// stopAction.setImageDescriptor(SWTImagesFactory.DESC_STOP);
+// stopAction.setDisabledImageDescriptor(SWTImagesFactory.DESC_STOPD);
+// return stopAction;
+// }
- private Action createStartAction() {
- Action startAction = new Action() {
- public void run() {
- ISelection selection = viewer.getSelection();
- Object obj = ((IStructuredSelection) selection).getFirstElement();
- if (obj instanceof CVInstanceElement) {
- CVInstanceElement cvinstance = (CVInstanceElement) obj;
- DeltaCloudInstance instance = (DeltaCloudInstance) cvinstance.getElement();
- CloudViewElement element = (CloudViewElement) obj;
- while (!(element instanceof CVCloudElement))
- element = (CloudViewElement) element.getParent();
- CVCloudElement cvcloud = (CVCloudElement) element;
- DeltaCloud cloud = (DeltaCloud) cvcloud.getElement();
- PerformInstanceActionThread t = new PerformInstanceActionThread(cloud, instance,
- DeltaCloudInstance.START,
- CVMessages.getString(STARTING_INSTANCE_TITLE),
- CVMessages.getFormattedString(STARTING_INSTANCE_MSG, new String[] {
instance.getName() }),
- DeltaCloudInstance.RUNNING);
- t.setUser(true);
- t.schedule();
- }
- }
- };
- startAction.setText(CVMessages.getString(START_LABEL));
- startAction.setToolTipText(CVMessages.getString(START_LABEL));
- startAction.setImageDescriptor(SWTImagesFactory.DESC_START);
- startAction.setDisabledImageDescriptor(SWTImagesFactory.DESC_STARTD);
- return startAction;
- }
+// private Action createStartAction() {
+// Action startAction = new Action() {
+// public void run() {
+// ISelection selection = viewer.getSelection();
+// Object obj = ((IStructuredSelection) selection).getFirstElement();
+// if (obj instanceof CVInstanceElement) {
+// CVInstanceElement cvinstance = (CVInstanceElement) obj;
+// DeltaCloudInstance instance = (DeltaCloudInstance) cvinstance.getElement();
+// CloudViewElement element = (CloudViewElement) obj;
+// while (!(element instanceof CVCloudElement))
+// element = (CloudViewElement) element.getParent();
+// CVCloudElement cvcloud = (CVCloudElement) element;
+// DeltaCloud cloud = (DeltaCloud) cvcloud.getElement();
+// PerformInstanceActionThread t = new PerformInstanceActionThread(cloud, instance,
+// DeltaCloudInstance.START,
+// CVMessages.getString(STARTING_INSTANCE_TITLE),
+// CVMessages.getFormattedString(STARTING_INSTANCE_MSG, new String[] {
instance.getName() }),
+// DeltaCloudInstance.RUNNING);
+// t.setUser(true);
+// t.schedule();
+// }
+// }
+// };
+// startAction.setText(CVMessages.getString(START_LABEL));
+// startAction.setToolTipText(CVMessages.getString(START_LABEL));
+// startAction.setImageDescriptor(SWTImagesFactory.DESC_START);
+// startAction.setDisabledImageDescriptor(SWTImagesFactory.DESC_STARTD);
+// return startAction;
+// }
private Action createRefreshAction() {
Action refreshAction = new Action() {
@@ -501,30 +467,6 @@
// return removeCloud;
// }
- private Action createInstanceAction() {
- Action createInstance = new Action() {
- public void run() {
- ISelection selection = viewer.getSelection();
- Shell shell = viewer.getControl().getShell();
- Object obj = ((IStructuredSelection) selection).getFirstElement();
- if (obj instanceof CVImageElement) {
- CVImageElement imageElement = (CVImageElement) obj;
- DeltaCloudImage image = (DeltaCloudImage) imageElement.getElement();
- CVCategoryElement images = (CVCategoryElement) imageElement.getParent();
- CVCloudElement cloudElement = (CVCloudElement) images.getParent();
- DeltaCloud cloud = (DeltaCloud) cloudElement.getElement();
- IWizard wizard = new NewInstance(cloud, image);
- WizardDialog dialog = new WizardDialog(shell, wizard);
- dialog.create();
- dialog.open();
- }
- }
- };
- createInstance.setText(CVMessages.getString(CREATE_INSTANCE));
- createInstance.setToolTipText(CVMessages.getString(CREATE_INSTANCE));
- createInstance.setImageDescriptor(SWTImagesFactory.DESC_INSTANCE);
- return createInstance;
- }
private void hookDoubleClickAction() {
viewer.addDoubleClickListener(new IDoubleClickListener() {