|
Re: how can get mapping between comman and keystroke [message #211967 is a reply to message #211800] |
Tue, 16 March 2004 09:53  |
Eclipse User |
|
|
|
Originally posted by: sandipchitale.comcast.net
This is how it could be done in 3.0M5:
TreeMap _bindings;
/**
*
*/
private void gatherKeyBindings() {
_bindings = new TreeMap();
// Get workbench
IWorkbench workbench = ...;
// Get command ids
Set commandIds = workbench.getCommandManager().getDefinedCommandIds();
for (Iterator iter = commandIds.iterator(); iter.hasNext();) {
String commandId = (String) iter.next();
// Get command for id
ICommand command =
workbench.getCommandManager().getCommand(commandId);
// Get Associated KeySequences
List keySequenceBindings = command.getKeySequenceBindings();
for (Iterator iterator =
keySequenceBindings.iterator();iterator.hasNext();)
{
IKeySequenceBinding keySequenceBinding =
(IKeySequenceBinding) iterator.next();
KeySequence keySequence = keySequenceBinding.getKeySequence();
// Add the mapping to TreeMap
_bindings.put(keySequence, command);
}
}
// Enumerate bindings in sorted fashion
Set keyBindings = _bindings.keySet();
for (Iterator iter = keyBindings.iterator(); iter.hasNext();) {
KeySequence keySequence = (KeySequence) iter.next();
ICommand command = (ICommand) _bindings.get(keySequence);
}
}
"f" <wangyz@1net.gr> wrote in message news:c36903$q1p$1@eclipse.org...
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.02303 seconds