Search code examples
eclipsepreferenceskey-bindings

How to read eclipse default key binding values which are in General-Keys-Keys Preference page


I am using below code to get the updated preferences which are existed in workbench.prefs file.

private  String nodeValue = "org.eclipse.ui.commands";

IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
String updatedKeyString = store.getString(nodeValue);

But now I need to get default values for key binding's which are in General-Keys-Keys preference page.


Solution

  • You can get the current key bindings from the binding service:

    IBindingService bindingService = PlatformUI.getWorkbench().getAdapter(IBindingService.class);
    
    Binding [] bindings = bindingService.getBindings();