Bug 46662 - [CommandMgmt] Offer KeySupport as public API?
Summary: [CommandMgmt] Offer KeySupport as public API?
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: 3.0 M8   Edit
Assignee: Douglas Pollock CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 31731
Blocks: 45096
  Show dependency tree
 
Reported: 2003-11-14 06:18 EST by Martin Aeschlimann CLA
Modified: 2004-03-25 17:17 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Aeschlimann CLA 2003-11-14 06:18:27 EST
20031111

I'm working on a dialog that works similar to the 'CycleEditorAction'.
A key sequence (configured in by the keybinding support) opens a (lightweight)
dialog. Pressing the same key sequence again toggles the view in the dialog.

I mimic'ed the code in CyclePartAction.addKeyListener, line 300.
The transformation of key events to KeySequence uses an internal class KeySupport.
So here is my questions:
- Is there a different way for me to compare incomimg events with a KeySequence
that I got from the command manager?
- Is it planed for KeySupport to become public API?
- Is that what I do recommended? Should I process events myself or would
platform offer an infrastructure that does that (so that Emacs style key
bindings would be supported) and I only work with KeySequence?
Comment 1 Chris McLaren CLA 2003-11-27 15:29:52 EST
KeySupport is now API, but because we want our Keys API to work standalone if 
necessary with someone using just SWT. 

What your doing will work for now, but ideally you are waiting for support 
from keybindings in dialogs so you don't have to do anything special. 

Currently, we are controlling all key events in the top level shell and 
automatically executing the associated action. Soon, keybindings will work in 
other shells as well, and via your shell you will have the ability to register 
handlers for commands you want active in that shell, and we will process the 
key automatically for you and call your handler. 

CyclePartAction is working in a hacky way right now until this support is 
available.

I am going to pass this to Doug to attach to his bugs in the area 
of 'keybindings in dialogs and other shells'
Comment 2 Douglas Pollock CLA 2003-12-05 15:44:25 EST
Are you using KeySupport right now, or may I rename it to SWTSupport?
Comment 3 Martin Aeschlimann CLA 2003-12-07 07:45:40 EST
You can rename it. I copied the funcionality so I'm not referening anything 
internal.
Comment 4 Dani Megert CLA 2004-03-23 10:46:48 EST
Should this now work with the new key binding support for dialogs (bug 31731).
If so, can you outline how. If not, can this be provided early in M9 since we
have dependent bugs which we would like to fix.
Comment 5 Douglas Pollock CLA 2004-03-24 13:45:22 EST
Okay, this is a brief summary of the steps to take.  This stuff is still very 
new, so I'm not guaranteeing there won't be some quirks.  If there are, please 
file separate bugs.  Also, feel free to message me on IRC 
(irc.freenode.net#eclipse-dev) or on Sametime (IRC is preferred). 
 
1.) The key binding 'Ctrl+Space' must be bound to a context that will be active 
when dialogs are open.  Automatically, the "org.eclipse.ui.dialogAndWindow" 
context will be active, and I'd recommend this as a good starting point.  
However, it is possible to create your own context or place the key binding 
elsewhere. 
2.) Register a handler that will be available when your dialogs are open.  This 
can be done in XML (see the examples ("<handlerSubmission>") in the 
"plugin.xml" of "org.eclipse.ui").  It is also possible to do this by asking 
the workbench for its "commandSupport" and adding handler submissions directly.  
[Note: the ActionHandler class can be used to re-use an existing action, if you 
prefer not to subclass AbstractHandler or implement IHandler.] 
 
 
If you have specific types of conditions that you'd like to test with 
EnabledSubmission (contexts) or HandlerSubmission (handlers) -- but those 
conditions aren't currently available -- then we'd like to hear about them.  
For example, we've considered things like providing a Shell test or a "window 
type" (i.e., dialog, window, neither, both) test to HandlerSubmission.  Again, 
IRC or Bugzilla are the best way to make these known. 
 
 
I've opened Bug 55977 to capture the work to move CyclePartAction to the new 
key bindings in dialogs API. 
 
Comment 6 Douglas Pollock CLA 2004-03-24 15:10:03 EST
Dani, Martin: Before I close this bug as verified, I'd like some feedback as to 
whether my explanation seems okay to you or not.  If you don't want to commit 
to answer yet (i.e., you want to play around with it a bit), don't worry about 
it.  This bug can stay unverified into M9. 
Comment 7 Dani Megert CLA 2004-03-25 03:12:04 EST
I took the key binding support out of the Quick controls and will cleanly add it
at the beginning of M9 since I am still waiting for an answer in bug 54815. But
maybe you can answer it here. What I would like to do is

1. get the key binding(s) for a specific command
     independent of whether it (or its scope) is currently active, i.e. I simply 
     give the command name.
2. bind an action to that command
3. when the user presses the key sequence my action gets activated.

No other side effects, no other active actions, simply the action(s) that I
defined for my shell
Comment 8 Douglas Pollock CLA 2004-03-25 10:08:41 EST
Dani: I've appended comments to Bug 54815. 
Comment 9 Douglas Pollock CLA 2004-03-25 17:17:44 EST
I believe the remaining discussion has moved to other bugs.  Marking as 
verified in I200403251200.