Author: adietish
Date: 2012-01-30 04:02:53 -0500 (Mon, 30 Jan 2012)
New Revision: 38262
Added:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/icons/copy_edit_co.gif
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/UIUtils.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationDetailsDialog.java
Log:
[JBIDE-10724] adding copy command to context menu
Added:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/icons/copy_edit_co.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/icons/copy_edit_co.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml 2012-01-30
08:56:39 UTC (rev 38261)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml 2012-01-30
09:02:53 UTC (rev 38262)
@@ -270,5 +270,24 @@
id="org.jboss.tools.openshift.express.ui.server.fragment"
typeIds="org.jboss.tools.openshift.express.openshift.server.type">
</fragment>
- </extension>
+ </extension>
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ id="org.jboss.tools.openshift.express.internal.ui.CopyCommand"
+ name="New Bookmarks Folder">
+ </command>
+ </extension>
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+
locationURI="popup:org.jboss.tools.openshift.express.internal.ui.wizard.ApplicationDetailsDialog">
+ <command
+
commandId="org.jboss.tools.openshift.express.internal.ui.CopyCommand"
+ icon="icons/copy_edit_co.gif"
+ label="Copy"
+ style="push">
+ </command>
+ </menuContribution>
+ </extension>
</plugin>
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/UIUtils.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/UIUtils.java 2012-01-30
08:56:39 UTC (rev 38261)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/UIUtils.java 2012-01-30
09:02:53 UTC (rev 38262)
@@ -10,9 +10,22 @@
******************************************************************************/
package org.jboss.tools.openshift.express.internal.ui.utils;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.action.ContributionManager;
+import org.eclipse.jface.action.GroupMarker;
+import org.eclipse.jface.action.IContributionManager;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.FocusAdapter;
import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.menus.IMenuService;
/**
* @author André Dietisheim
@@ -30,4 +43,53 @@
}
+ /**
+ * Register a {@link ContributionManager}. The contribution manager gets unregistered on
control disposal
+ *
+ * @param id the id
+ * @param contributionManager the contribution manager
+ * @param control the control
+ *
+ * @see ContributionManager
+ * @see IMenuService
+ * @see DisposeListener
+ */
+ public static void registerContributionManager( final String id, final
IContributionManager contributionManager,
+ final Control control )
+ {
+ Assert.isNotNull( id );
+ Assert.isNotNull( contributionManager );
+ Assert.isTrue( control != null && !control.isDisposed() );
+
+ final IMenuService menuService = ( IMenuService ) PlatformUI.getWorkbench().getService(
IMenuService.class );
+ menuService.populateContributionManager( ( ContributionManager ) contributionManager,
id );
+ contributionManager.update( true );
+ control.addDisposeListener( new DisposeListener()
+ {
+ public void widgetDisposed( DisposeEvent e )
+ {
+ menuService.releaseContributions( ( ContributionManager ) contributionManager );
+ }
+ } );
+ }
+
+ /**
+ * Creates context menu to a given control.
+ *
+ * @param control the control
+ *
+ * @return the i menu manager
+ */
+ public static IMenuManager createContextMenu( final Control control )
+ {
+ Assert.isTrue( control != null && !control.isDisposed() );
+
+ MenuManager menuManager = new MenuManager();
+ menuManager.add( new GroupMarker( IWorkbenchActionConstants.MB_ADDITIONS ) );
+
+ Menu menu = menuManager.createContextMenu( control );
+ control.setMenu( menu );
+ return menuManager;
+ }
+
}
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationDetailsDialog.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationDetailsDialog.java 2012-01-30
08:56:39 UTC (rev 38261)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationDetailsDialog.java 2012-01-30
09:02:53 UTC (rev 38262)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.openshift.express.internal.ui.wizard;
+import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.jface.layout.GridDataFactory;
@@ -30,6 +31,7 @@
import org.jboss.tools.openshift.express.internal.ui.OpenShiftImages;
import
org.jboss.tools.openshift.express.internal.ui.propertytable.PropertyNameCellLabelProvider;
import
org.jboss.tools.openshift.express.internal.ui.propertytable.PropertyValueCellLabelProvider;
+import org.jboss.tools.openshift.express.internal.ui.utils.UIUtils;
import com.openshift.express.client.IApplication;
@@ -39,6 +41,7 @@
*/
public class ApplicationDetailsDialog extends TitleAreaDialog {
+ private static final String CONTEXT_MENU =
"popup:org.jboss.tools.openshift.express.internal.ui.wizard.ApplicationDetailsDialog";
private IApplication application;
public ApplicationDetailsDialog(IApplication application, Shell parentShell) {
@@ -65,7 +68,9 @@
GridLayoutFactory.fillDefaults().margins(10, 10).applyTo(dialogArea);
TreeViewer viewer = createApplicationDetailsTable(dialogArea);
fillApplicationDetailsTable(viewer);
-
+ IMenuManager contextMenu = UIUtils.createContextMenu(viewer.getControl());
+ UIUtils.registerContributionManager(CONTEXT_MENU, contextMenu, viewer.getControl());
+
Label buttonsSeparator = new Label(parent, SWT.HORIZONTAL | SWT.SEPARATOR);
GridDataFactory.fillDefaults()
.align(SWT.FILL, SWT.TOP).grab(true, false).applyTo(buttonsSeparator);