Bug 42543 - [Commands] misc: Provide new API to hook actions to commands
Summary: [Commands] misc: Provide new API to hook actions to commands
Status: ASSIGNED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: All All
: P5 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2003-09-04 12:04 EDT by Michael Valenta CLA
Modified: 2019-09-06 16:17 EDT (History)
1 user (show)

See Also:


Attachments
Patch to RefactorActionGroup, SyncViewerActions, and SynchronizeView (6.02 KB, patch)
2003-09-11 16:27 EDT, Douglas Pollock CLA
no flags Details | Diff
Patch migrating to new architecture (18.97 KB, patch)
2003-09-17 16:06 EDT, Douglas Pollock CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Valenta CLA 2003-09-04 12:04:54 EDT
I've added the delete gobal action to the Live Sync view. In the process, I 
noticed that the navigator and others capture the keyPressed event to perform 
the deletion. I thought this was possible by registering a global handler 
(e.g. actionBars.setGlobalActionHandler(IWorkbenchActionConstants.DELETE, 
deleteAction);) but this doesn't seem to work. That is, I register the DEL key 
as Edit/Delete in the Key preferences page but it doesn't result in the 
expected behavior. The Del accelerator appears in the global edit menu but 
pressing the DEL key does not work. Performing the operation from the edit 
menu does work though. This is using build I20030903.
Comment 1 Chris McLaren CLA 2003-09-05 09:58:51 EDT
doug, please look at this for mike. i spoke to him yesterday about it.
Comment 2 Douglas Pollock CLA 2003-09-11 15:33:30 EDT
This is proving to be interesting.  First of all, it looks like only the text
editor is using the delete provided through the global key filter.  All the
other tables and trees are coding their own key handlers: TaskList, MarkerView,
BookmarkNavigator, and RefactorActionGroup.  In TaskList, for example, this use
of SWT.DEL has been in there since before September 24, 2002 (when a big
refactoring took place).

This seems to indicate that this isn't a regression, but that this has been like
this for quite some time.

The problem is that the CommandManager is never made aware of the command.
Comment 3 Douglas Pollock CLA 2003-09-11 16:27:46 EDT
Created attachment 6082 [details]
Patch to RefactorActionGroup, SyncViewerActions, and SynchronizeView

This removes the unnecessary code, and adds code to register the action with
the global key binding service.  Only code has been added to register the
delete action.	The move and rename have been left as an exercise for the
reader.  ;)  Plus, some decision might need to be made about where best to get
the command ID constants from.

This has been tested on I20030910 with the HEAD for platform-ui and
org.eclipse.team.ui.  I bound the delete key to 'F9' to make sure that the
native widget wasn't doing any work.  'F9' also worked in the text editor with
these changes.
Comment 4 Douglas Pollock CLA 2003-09-11 16:28:53 EDT
As always, Chris could provide more insight into how the key binding
architecture should work.  Hope this helps.
Comment 5 Douglas Pollock CLA 2003-09-11 16:36:59 EDT
Oh, one other thing.  The command "org.eclipse.ui.edit.delete" is not bound to
any key by default.  If you want it bound to the "Delete" key, then you should
file a separate enhancement request.  (or just ask someone on platform-ui with
commit rights).
Comment 6 Michael Valenta CLA 2003-09-16 14:11:27 EDT
I have applied the patch that Doug supplied. However, he raises some issues 
above that are still open. Reassigning to UI to consider.
Comment 7 Douglas Pollock CLA 2003-09-16 14:23:54 EDT
See Bug 43104
Comment 8 Michael Valenta CLA 2003-09-16 14:38:26 EDT
The issue I'm most concerned with is the hard-coded 
string "org.eclipse.ui.edit.delete" which is in out code. Does UI have a 
constant for this? If not, it should.
Comment 9 Douglas Pollock CLA 2003-09-17 16:06:32 EDT
Created attachment 6135 [details]
Patch migrating to new architecture

This patch does a few things.  It marks getKeyBindingService() as deprecated in
IWorkbenchPartSite, and replaces it with a new method getActionService(). 
MultiPageEditorSite is update to reflect these changes.

And, more importantly, IWorkbenchCommandConstants is added.  This declares as
constants all of the command identifiers that the UI plugin defines (in
plugin.xml).  It also gives as an explanatory note in the class comment which
explains how to hook both old-style and new-style actions as handlers for
global commands.
Comment 10 Douglas Pollock CLA 2003-09-17 16:11:04 EDT
Chris: look over this patch carefully.  This deprecates the old
getKeyBindingService() API -- providing direct access to IActionService.  If it
looks good, then I'll add comments for each of the declared command identifiers.
 Also I'm not sure about the comment for IEditorActionBarContributor; it's
copied from IWorkbenchActionConstants.

Don't apply the patch yet.
Comment 11 Michael Van Meekeren CLA 2004-05-04 14:40:14 EDT
Doug what is the status of this?
Comment 12 Douglas Pollock CLA 2004-05-04 15:27:33 EDT
Not for 3.0. 
Comment 13 Kevin Haaland CLA 2004-05-04 17:56:28 EDT
Lowering priority to P2 (P1 means that this is a "stop-ship" bug report)
Comment 14 Chris McLaren CLA 2005-12-12 16:57:34 EST
Reassigning to Platform-UI-Inbox (I left IBM 18 months ago..)
Comment 15 Michael Van Meekeren CLA 2006-04-21 13:21:14 EDT
Moving Dougs bugs
Comment 16 Paul Webster CLA 2006-09-28 10:58:42 EDT
There are currently no plans to work on this feature.

PW
Comment 17 Denis Roy CLA 2007-06-22 09:32:30 EDT
Changes requested on bug 193523
Comment 18 Paul Webster CLA 2009-09-09 14:09:55 EDT
We now have the IHandlerService to hook up actions, and an IWorkbenchCommandConstants to describe the commands we provide.

PW
Comment 19 Eclipse Webmaster CLA 2019-09-06 16:17:07 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.