Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » how can get mapping between comman and keystroke
how can get mapping between comman and keystroke [message #211800] Tue, 16 March 2004 02:09 Go to next message
Eclipse UserFriend
Originally posted by: wangyz.1net.gr

Re: how can get mapping between comman and keystroke [message #211967 is a reply to message #211800] Tue, 16 March 2004 09:53 Go to previous message
Eclipse UserFriend
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...
>
>
Previous Topic:2 plugin development questions
Next Topic:How to add a builder to the project
Goto Forum:
  


Current Time: Fri May 09 23:04:50 EDT 2025

Powered by FUDForum. Page generated in 0.02303 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top