Author: achabatar
Date: 2007-12-07 10:53:20 -0500 (Fri, 07 Dec 2007)
New Revision: 5225
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/EditorActionContributor.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/popup/PopupMenuProvider.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1415
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/EditorActionContributor.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/EditorActionContributor.java 2007-12-07
15:19:48 UTC (rev 5224)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/EditorActionContributor.java 2007-12-07
15:53:20 UTC (rev 5225)
@@ -11,6 +11,8 @@
package org.jboss.tools.hibernate.ui.veditor.editors;
import org.eclipse.gef.ui.actions.ActionBarContributor;
+import org.eclipse.gef.ui.actions.RedoRetargetAction;
+import org.eclipse.gef.ui.actions.UndoRetargetAction;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
@@ -23,10 +25,14 @@
workbenchAction.setImageDescriptor(ViewPlugin.getImageDescriptor(ViewPlugin.BUNDLE_IMAGE.getString("Explorer.refreshOrmGef")));
//$NON-NLS-1$
workbenchAction.setToolTipText(Messages.EditorActionContributor_Refresh_Visual_Mapping);
addAction(workbenchAction);
+ addRetargetAction(new UndoRetargetAction());
+ addRetargetAction(new RedoRetargetAction());
}
public void contributeToToolBar(IToolBarManager toolBarManager) {
toolBarManager.add(getAction(ActionFactory.REFRESH.getId()));
+ toolBarManager.add(getAction(ActionFactory.UNDO.getId()));
+ toolBarManager.add(getAction(ActionFactory.REDO.getId()));
}
protected void declareGlobalActionKeys() {
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/popup/PopupMenuProvider.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/popup/PopupMenuProvider.java 2007-12-07
15:19:48 UTC (rev 5224)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/popup/PopupMenuProvider.java 2007-12-07
15:53:20 UTC (rev 5225)
@@ -1,24 +1,17 @@
package org.jboss.tools.hibernate.ui.veditor.editors.popup;
-import org.eclipse.draw2d.geometry.Point;
import org.eclipse.gef.ContextMenuProvider;
-import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPartViewer;
import org.eclipse.gef.ui.actions.ActionRegistry;
import org.eclipse.gef.ui.actions.GEFActionConstants;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.actions.ActionFactory;
import org.jboss.tools.hibernate.ui.veditor.editors.actions.OpenMappingAction;
import org.jboss.tools.hibernate.ui.veditor.editors.actions.OpenSourceAction;
@@ -32,6 +25,9 @@
}
public void buildContextMenu(IMenuManager menu) {
+ // Add standard action groups to the menu
+ GEFActionConstants.addStandardActionGroups(menu);
+
menu.add(new Separator(GEFActionConstants.MB_ADDITIONS));
IAction action = getActionRegistry().getAction(OpenSourceAction.ACTION_ID);
@@ -41,8 +37,20 @@
action = getActionRegistry().getAction(OpenMappingAction.ACTION_ID);
appendToGroup(GEFActionConstants.MB_ADDITIONS, action);
createMenuItem(getMenu(), action);
+
+ // Add actions to the menu
+ menu.appendToGroup(
+ GEFActionConstants.GROUP_UNDO, // target group id
+ getAction(ActionFactory.UNDO.getId())); // action to add
+ menu.appendToGroup(
+ GEFActionConstants.GROUP_UNDO,
+ getAction(ActionFactory.REDO.getId()));
}
+ private IAction getAction(String actionId) {
+ return actionRegistry.getAction(actionId);
+ }
+
public void createMenuItem(Menu menu, IAction action) {
boolean enabled = action.isEnabled();
boolean hidden = false;