Can one retrieve the keyboard shortcut bindings through the API? [message #72475] |
Sat, 10 June 2006 05:26 |
Eclipse User |
|
|
|
Originally posted by: pschlesi.NOSPAM.uci.edu
Hi all.
I'd like to be able to retrieve the Eclipse keyboard shortcut bindings -
the 178 or so keyboard shortcuts listed when you hit Ctrl-Shift-L twice
in a row. Is there any way to do that? Or do I have to manually retype
them?
Your help is much appreciated. Thank you in advance.
- Phil
|
|
|
Re: Can one retrieve the keyboard shortcut bindings through the API? [message #72567 is a reply to message #72475] |
Sun, 11 June 2006 21:18 |
Eclipse User |
|
|
|
Originally posted by: pschlesi.NOSPAM.uci.edu
Philip Schlesinger wrote:
> Hi all.
>
> I'd like to be able to retrieve the Eclipse keyboard shortcut bindings -
> the 178 or so keyboard shortcuts listed when you hit Ctrl-Shift-L twice
> in a row. Is there any way to do that? Or do I have to manually retype
> them?
>
> Your help is much appreciated. Thank you in advance.
>
> - Phil
Found it (this might come out a bit messy):
IBindingService bindingService = (IBindingService)
PlatformUI.getWorkbench().getAdapter(IBindingService.class);
bindingService.readRegistryAndPreferences( (ICommandService)
PlatformUI.getWorkbench().getAdapter(ICommandService.class) );
Binding[] bindingList = bindingService.getBindings();
PrintWriter out;
try {
out = new PrintWriter( new BufferedWriter( new FileWriter("c:/foo2.out")
) );
out.write(
" Trigger\tcontext\tlocale\tplatform\tscheme\ttype\tclass\tpar ameterized\n "
);
for (int i = 0; i < bindingList.length; ++i) {
out.write(bindingList[i].getTriggerSequence().toString());
out.write("\t" + bindingList[i].getContextId());
out.write("\t" + bindingList[i].getLocale());
out.write("\t" + bindingList[i].getPlatform());
out.write("\t" + bindingList[i].getSchemeId());
out.write("\t" + bindingList[i].getType());
out.write("\t" + bindingList[i].getClass().toString());
if (bindingList[i].getParameterizedCommand() != null)
out.write( "\t" +
bindingList[i].getParameterizedCommand().getCommand().getId( ) );
else
out.write("\t" + bindingList[i].getParameterizedCommand());
/* necessary because some ParameterizedCommands are just null, so will
get a NullPointerException in those cases if one tries the command for
the "true" value */
out.write("\n");
} // end for
out.close();
} catch (IOException e) {
e.printStackTrace();
}
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03336 seconds