Bug 387268 - Keybindings seem to be seriously broken
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/SimpleGraphicalEditor.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/SimpleGraphicalEditor.java
index 3813c8e..1797885 100644
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/SimpleGraphicalEditor.java
+++ b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/SimpleGraphicalEditor.java
@@ -39,7 +39,6 @@
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.commands.ActionHandler;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -77,17 +76,17 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Menu;
+import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IPageLayout;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.IWorkbenchCommandConstants;
import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.ActionContext;
-import org.eclipse.ui.handlers.IHandlerService;
import org.eclipse.wst.sse.core.internal.PropagatingAdapter;
import org.eclipse.wst.sse.core.internal.provisional.IModelStateListener;
import org.eclipse.wst.sse.core.internal.provisional.INodeAdapterFactory;
@@ -264,16 +263,15 @@
((UpdateAction) action).update();
}
- private void activateActionHandler(final IAction action) {
+ private void setGlobalActionHandler(final IAction action) {
if (action != null) {
- final IWorkbenchPartSite site = getSite();
- if (site != null) {
- final IHandlerService service =
- (IHandlerService) site.getService(IHandlerService.class);
- if (service != null) {
- final String commandId = action.getId();
- if (commandId != null) {
- service.activateHandler(commandId, new ActionHandler(action));
+ final String actionId = action.getId();
+ if (actionId != null && actionId.length() > 0) {
+ final IEditorSite site = getEditorSite();
+ if (site != null) {
+ final IActionBars bars = site.getActionBars();
+ if (bars != null) {
+ bars.setGlobalActionHandler(actionId, action);
}
}
}
@@ -300,7 +298,7 @@
.getImageDescriptor(ISharedImages.IMG_TOOL_UNDO_DISABLED));
action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_UNDO);
action.setId(IWorkbenchCommandConstants.EDIT_UNDO);
- activateActionHandler(action);
+ setGlobalActionHandler(action);
registry.registerAction(action);
action = new DesignerUndoRedoAction(false, this);
@@ -310,7 +308,7 @@
.getImageDescriptor(ISharedImages.IMG_TOOL_REDO_DISABLED));
action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_REDO);
action.setId(IWorkbenchCommandConstants.EDIT_REDO);
- activateActionHandler(action);
+ setGlobalActionHandler(action);
registry.registerAction(action);
action = new DeleteAction(this);
@@ -320,7 +318,7 @@
.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_DISABLED));
action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_DELETE);
action.setId(IWorkbenchCommandConstants.EDIT_DELETE);
- activateActionHandler(action);
+ setGlobalActionHandler(action);
this.getSelectionActions().add(action.getId());
registry.registerAction(action);
@@ -331,7 +329,7 @@
.getImageDescriptor(ISharedImages.IMG_TOOL_COPY_DISABLED));
action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_COPY);
action.setId(IWorkbenchCommandConstants.EDIT_COPY);
- activateActionHandler(action);
+ setGlobalActionHandler(action);
this.getSelectionActions().add(action.getId());
registry.registerAction(action);
@@ -342,7 +340,7 @@
.getImageDescriptor(ISharedImages.IMG_TOOL_CUT_DISABLED));
action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_CUT);
action.setId(IWorkbenchCommandConstants.EDIT_CUT);
- activateActionHandler(action);
+ setGlobalActionHandler(action);
this.getSelectionActions().add(action.getId());
registry.registerAction(action);
@@ -353,7 +351,7 @@
.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_DISABLED));
action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_PASTE);
action.setId(IWorkbenchCommandConstants.EDIT_PASTE);
- activateActionHandler(action);
+ setGlobalActionHandler(action);
this.getSelectionActions().add(action.getId());
registry.registerAction(action);
}