Bug 84623 - [KeyBindings] misc: Need programmatic access to keybinding service
Summary: [KeyBindings] misc: Need programmatic access to keybinding service
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1   Edit
Hardware: All All
: P3 enhancement with 6 votes (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 84656 (view as bug list)
Depends on: 154130
Blocks:
  Show dependency tree
 
Reported: 2005-02-07 15:10 EST by Randy Hudson CLA
Modified: 2019-09-06 15:32 EDT (History)
10 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Randy Hudson CLA 2005-02-07 15:10:27 EST
We need to be able to define keybindings for a set of commands which is not 
know at development time, but created by the end user. We want to create IDs 
for commands programmatically, and allow the user to configure the 
accelerators for the commands using our own UI instead of the current 
preference page.

The scenario is tools displayed in a palette. It should be possible to 
activate a tool using a user-defined keybinding instead of using the mouse. 
The keybinding will be set by the user using an existing palette customization 
dialog, not the Keys preference page. This allows the user to control all 
aspects of the palette in one place.
Comment 1 James Willans CLA 2005-02-08 04:55:32 EST
*** Bug 84656 has been marked as a duplicate of this bug. ***
Comment 2 Douglas Pollock CLA 2005-02-08 05:18:36 EST
Randy: for your case, would the parameter mechanism proposed in the 
"contributions proposal" (posted to platform-ui-dev) be sufficient? 
 
James: Does the same apply for you? 
Comment 3 James Willans CLA 2005-02-08 05:30:14 EST
Douglas:  I'm not sure, my reporting of this bug got linked into the bug
covering the proposal you mention, but Nick asked me to open a separate bug.  If
it was the case that we could programmatically define commands (which I think we
can now - can you confirm this) and programmatically define the keybindings on
these commands, then I think it would be adequate.
Comment 4 James Willans CLA 2005-02-08 10:25:45 EST
Following my previous comment, I realise that Commands cannot be
programmatically created.  Consequently parameterising Commands isn't going to
work for us since you would need to know prior to runtime precisely what
Commands are required in order to declare them in the plugin.xml.  

It is a shame that we can't choose to switch off the command manager and allow
the interpretation of IAction.setAccelerator(..) to set the key binding (and
handle the consequence of conlicting bindings and contexts).
Comment 5 Randy Hudson CLA 2005-02-08 11:08:52 EST
Same for me.  Parameters don't help.  BTW, I've opened a separate bug about 
View definitions not getting free command definitions.  The workbench know 
about all defined views, and should programmatically create commands so that 
the user can assign *ANY* view to a keybinding.  A 2.1-based plug-in defining a 
view should work without modification.  If you solve this problem, you've 
solved mine.
Comment 6 Douglas Pollock CLA 2005-02-10 11:05:53 EST
Randy: parameters will solve the "show view" problem. 
 
James: Your case is interesting.  It could be solved with parameters, but I'm 
not sure that is an ideal way to approach the situation.  We could make it so 
that advisor can replace (or completely disable) the commands architecture. 
Comment 7 Randy Hudson CLA 2005-02-10 11:27:47 EST
How?  I thought that all parameter values must be declared in a plugin.xml 
somewhere.
Comment 8 Douglas Pollock CLA 2005-02-10 11:30:13 EST
Randy: No.  It will be a callback into code.  It's also designed in such a way 
so that the callback will only be needed if the keys preference page is shown. 
Comment 9 James Willans CLA 2005-02-10 11:37:09 EST
(In reply to comment #6)
> James: Your case is interesting.  It could be solved with parameters, but I'm 
> not sure that is an ideal way to approach the situation.  We could make it so 
> that advisor can replace (or completely disable) the commands architecture.

That would be ideal.
Comment 10 James Willans CLA 2005-02-18 14:22:05 EST
Douglas : Are there any plans for this and (if so) what is the timeline?
Comment 11 Douglas Pollock CLA 2005-02-18 14:25:53 EST
I'm not sure if it will be ready for 3.1, though I will be trying.  If I set the
milestone, then it indicates that I am fairly confident of when it might ready.
Comment 12 James Willans CLA 2005-04-12 06:04:33 EDT
Douglas: This is becoming increasingly important to us, to the extent where we
may have to allocate internal resources to provide a solution.  We will submit
any solution as a patch against head for consideration to be included in the
release.  If there are any pointers you can give us on appropriate solutions
then this would be very helpful. 

(In reply to comment #11)
> I'm not sure if it will be ready for 3.1, though I will be trying.  If I set the
> milestone, then it indicates that I am fairly confident of when it might ready.

Comment 13 Douglas Pollock CLA 2005-04-12 11:34:23 EDT
The API freeze has passed.  This will not appear in 3.1.

As a note, parameters do exist.  Though I'm still not sure this will address
James' issues.
Comment 14 Randy Hudson CLA 2005-04-12 11:43:45 EDT
parameters aren't enough for me either since I don't want my keybindings to 
appear in the global preference page.
Comment 15 Douglas Pollock CLA 2005-04-12 11:54:59 EDT
Randy: if you want things to not appear in the keys preference page, then use a
listener on the widget. *HOWEVER*, this is not a recommended approach.  the
whole point of key bindings is to have them modifiable by the user.
Comment 16 Randy Hudson CLA 2005-04-12 14:00:33 EDT
The keybindings will be modifiable by the user in a preference dialog local the 
GEF palette.

The default preference page for editing keybindings is not appropriate in this 
case. It doesn't make sense to be able to edit every property for a palette 
entry except for its keybinding, and to have to go to some other ackward UI 
with global scope just to change one more property.  So, we want to place 
a "Key Sequence/Name"-like widget in our own preference dialog.
Comment 17 James Willans CLA 2005-07-19 11:38:48 EDT
Douglas: Just pinging this bug.  Can you let me know your current thoughts on
when this might get done?  If it is someway down the line then we could
potentially look at this internally and submit a patch, however we would
probably need some assistance in understanding the internals of the current
keybinding architecture.
Comment 18 Douglas Pollock CLA 2005-07-19 16:04:23 EDT
Parameters are available in 3.1.  KeySequenceText is public in JFace in 3.1.  I'm not sure what you still might want.  Could you be more specific?

Comment 19 Randy Hudson CLA 2005-07-19 16:20:02 EDT
(In reply to comment #18)
>  Could you be more specific?

I would like the ability to reimplement the keybinding preference page.
Comment 20 James Willans CLA 2005-07-21 10:30:10 EDT
Douglas: I'd not heard of KeySequenceText, but looking at the API this seems
only to be applicable to Text widgets (please correct me if I'm wrong).  See
comment #4 for our issue with parameters.

In a nutshell we want to add keybindings to context menus (for example CTRL +
'S'), unfortunately these keybindings are not known to the system until after
Eclipse has started.  We simply need a programmatic way of doing this.
Comment 21 Markus Keller CLA 2005-11-11 10:00:28 EST
This would be rather helpful for JDT/UI & Text as well. In certain situations
we'd like to temporarily register special handlers for keybindings.

For example in the Quick Outline (Ctrl+O), we would like to bind the toggle
handler to the keybinding that originally started the action (see bug 54815).

Programmatic access to activate keybindings would also open a way to solve bug
115460 by registering the keybindings in a temporary context that is active in
the dialog while the text field has focus.
Comment 22 Michael Van Meekeren CLA 2006-04-21 13:14:25 EDT
Moving Dougs bugs
Comment 23 Paul Webster CLA 2006-09-29 12:25:14 EDT
Programmatic access to most of the services is available in 3.2 (Commands, Contexts, and Handlers).  Descriptions are available on the wiki http://wiki.eclipse.org/index.php/Platform_UI_Command_Design

But there are notes in the design that IBindingService is not to provide programmatic addition and removal as general API for performance reasons.  I believe it is to specifically prevent adding and removing keybindings in response to some listener.

That being said, I believe that there is support in the API for "I'm writing my own keys preference page".  Check out the javadocs for IBindingService#savePreferences(Scheme activeScheme, Binding[] bindings).

PW
Comment 24 Paul Webster CLA 2007-02-06 21:07:12 EST
So I think IBindingService#savePreferences(Scheme activeScheme, Binding[] bindings) will address Randy and James.

Markus, we'll be looking at the CTRL+O opens the window and then CTRL+O toggles the superclass methods in 3.3M6

PW
Comment 25 Paul Webster CLA 2007-06-21 10:42:18 EDT
Still need to find a solution for CTRL+O and such toggles.
PW
Comment 26 Paul Webster CLA 2009-03-02 11:39:30 EST
Updated as per http://wiki.eclipse.org/Platform_UI/Bug_Triage
PW
Comment 27 Eclipse Webmaster CLA 2019-09-06 15:32:28 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.