Search in sources :

Example 6 with ParseException

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:
    }
}
Also used : KeyStroke(org.eclipse.jface.bindings.keys.KeyStroke) ParseException(org.eclipse.jface.bindings.keys.ParseException)

Aggregations

ParseException (org.eclipse.jface.bindings.keys.ParseException)6 KeyStroke (org.eclipse.jface.bindings.keys.KeyStroke)3 ContentProposalAdapter (org.eclipse.jface.fieldassist.ContentProposalAdapter)3 TextContentAdapter (org.eclipse.jface.fieldassist.TextContentAdapter)2 JavaContentProposal (bndtools.utils.JavaContentProposal)1 JavaContentProposalLabelProvider (bndtools.utils.JavaContentProposalLabelProvider)1 DatabaseManagementDialog (net.heartsome.cat.ts.test.ui.dialogs.DatabaseManagementDialog)1 MemoryDatabaseManagementDialog (net.heartsome.cat.ts.test.ui.dialogs.MemoryDatabaseManagementDialog)1 IStatus (org.eclipse.core.runtime.IStatus)1 Status (org.eclipse.core.runtime.Status)1 IJavaProject (org.eclipse.jdt.core.IJavaProject)1 IType (org.eclipse.jdt.core.IType)1 JavaModelException (org.eclipse.jdt.core.JavaModelException)1 ControlDecoration (org.eclipse.jface.fieldassist.ControlDecoration)1 FieldDecoration (org.eclipse.jface.fieldassist.FieldDecoration)1 IContentProposal (org.eclipse.jface.fieldassist.IContentProposal)1 IContentProposalListener (org.eclipse.jface.fieldassist.IContentProposalListener)1 LabelProvider (org.eclipse.jface.viewers.LabelProvider)1 ModifyEvent (org.eclipse.swt.events.ModifyEvent)1 ModifyListener (org.eclipse.swt.events.ModifyListener)1