Author: adietish
Date: 2011-03-29 04:52:31 -0400 (Tue, 29 Mar 2011)
New Revision: 30090
Added:
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/ManageKeysHandler.java
Modified:
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml
Log:
[JBIDE-7772] added "Manage Keys" to cloud context menu in cloud viewer
Modified:
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml
===================================================================
---
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml 2011-03-29
08:50:25 UTC (rev 30089)
+++
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml 2011-03-29
08:52:31 UTC (rev 30090)
@@ -292,6 +292,32 @@
</extension>
<extension
point="org.eclipse.ui.handlers">
+ <!-- Manage Keys command handler -->
+ <handler
+ class="org.jboss.tools.deltacloud.ui.commands.ManageKeysHandler"
+ commandId="org.jboss.tools.deltacloud.ui.managekeys">
+ <activeWhen>
+ <with
+ variable="selection">
+ <iterate operator="and">
+ <adapt
+ type="org.jboss.tools.deltacloud.core.DeltaCloud">
+ <test property="org.jboss.tools.deltacloud.ui.commands.isValid"
+ value="true"/>
+ </adapt>
+ </iterate>
+ </with>
+ </activeWhen>
+ <enabledWhen>
+ <with
+ variable="selection">
+ <count value="1" />
+ </with>
+ </enabledWhen>
+ </handler>
+ </extension>
+ <extension
+ point="org.eclipse.ui.handlers">
<!-- Filter handlers -->
<handler
class="org.jboss.tools.deltacloud.ui.commands.FilterImagesHandler"
@@ -356,6 +382,20 @@
name="additions"
visible="true" />
</menuContribution>
+ <!-- manage keys command -->
+ <menuContribution
+ allPopups="true"
+
locationURI="popup:org.jboss.tools.deltacloud.ui.views.DeltaCloudView?after=keys">
+ <!-- connection commands -->
+ <command
+ commandId="org.jboss.tools.deltacloud.ui.managekeys"
+ icon="icons/keys.gif"
+ disabledIcon="icons/keysd.gif"
+ label="%command.managekeys.label"
+ style="push"
+ tooltip="%command.managekeys.tooltip">
+ </command>
+ </menuContribution>
<!-- instance commands -->
<menuContribution
allPopups="true"
@@ -496,6 +536,9 @@
name="connections"
visible="true" />
<separator
+ name="keys"
+ visible="true" />
+ <separator
name="images"
visible="true" />
<separator
@@ -756,6 +799,12 @@
id="org.jboss.tools.deltacloud.ui.destroyinstance"
name="%command.destroyinstance.name">
</command>
+ <!-- manage keys command -->
+ <command
+ description="%command.managekeys.description"
+ id="org.jboss.tools.deltacloud.ui.managekeys"
+ name="%command.managekeys.name">
+ </command>
<!-- filter commands -->
<command
description="%command.filterimages.description"
Added:
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/ManageKeysHandler.java
===================================================================
---
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/ManageKeysHandler.java
(rev 0)
+++
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/ManageKeysHandler.java 2011-03-29
08:52:31 UTC (rev 30090)
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * 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.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.internal.deltacloud.ui.utils.WizardUtils;
+import org.jboss.tools.internal.deltacloud.ui.utils.WorkbenchUtils;
+import org.jboss.tools.internal.deltacloud.ui.wizards.ManageKeysWizard;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class ManageKeysHandler extends AbstractHandler implements IHandler {
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+ if (selection instanceof IStructuredSelection) {
+ DeltaCloud cloud = WorkbenchUtils.getFirstAdaptedElement(selection,
DeltaCloud.class);
+ openManageKeysWizard(cloud, HandlerUtil.getActiveShell(event));
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ private void openManageKeysWizard(final DeltaCloud cloud, final Shell shell) {
+ if (cloud != null) {
+ Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ WizardUtils.openWizardDialog(new ManageKeysWizard(cloud), shell);
+ }
+ });
+ }
+ }
+}
Property changes on:
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/ManageKeysHandler.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain