use of org.eclipse.jface.bindings.keys.ParseException in project tdi-studio-se by Talend.
the class ReconcilerViewer method handleVerifyKeyPressed.
private void handleVerifyKeyPressed(VerifyEvent event) {
if (!event.doit) {
return;
}
try {
KeyStroke triggerKeyStroke = HotKeyUtil.getHotKey(HotKeyUtil.contentAssist);
if (triggerKeyStroke != null) {
// check the character field...
if ((triggerKeyStroke.getModifierKeys() == KeyStroke.NO_KEY && triggerKeyStroke.getNaturalKey() == event.character) || // keycode and state must match
(((triggerKeyStroke.getNaturalKey() == event.keyCode) || (Character.toLowerCase(triggerKeyStroke.getNaturalKey()) == event.keyCode) || (Character.toUpperCase(triggerKeyStroke.getNaturalKey()) == event.keyCode)) && ((triggerKeyStroke.getModifierKeys() & event.stateMask) == triggerKeyStroke.getModifierKeys()))) {
// We never propagate the keystroke for an explicit
// keystroke invocation of the popup
doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS);
event.doit = false;
return;
}
}
} catch (ParseException e) {
org.talend.commons.exception.ExceptionHandler.process(e);
}
if (event.stateMask != SWT.CTRL) {
return;
}
switch(event.character) {
case ' ':
doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS);
event.doit = false;
break;
case '.':
doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS);
event.doit = false;
break;
// CTRL-Y
case 'y' - 'a' + 1:
doOperation(ITextOperationTarget.REDO);
event.doit = false;
break;
// CTRL-Z
case 'z' - 'a' + 1:
doOperation(ITextOperationTarget.UNDO);
event.doit = false;
break;
default:
}
}
Aggregations