I have added a key listener to a tree in SWT and when i press Alt+Enter the state of the key event is keyCode = 65536 and statemask = 0, when it should have been keyCode=’\r’ and statemask=65536.
Below is the code snippet i have written-
mViewer.getTree().addListener(SWT.KeyDown, new Listener() {
@Override
public void handleEvent(Event e) {
if(e.keyCode == SWT.CR && e.stateMask == SWT.ALT) {
e.doit = false;
}
}
});
Eclipse workbench filters some of the events before delegating the events to the listeners in the components. Is there a way i can disable the alt+enter to not execute the show properties in eclipse on one of the treeviewers?
Best Regards,
Keshav
You can override a specific global command for a specific Viewer is many different ways:
Displayfilter to do the same – the filter can be added/removed at the focus in/out on the control of the Viewer.I prefer this last solution as I can override specific key bindings for the Viewer from any plug-in using the normal binding extension point…