简体   繁体   中英

Eclipse plug-in binding CTRL+SPACE not working

I've to update an eclipse plug-in (an editor) from Eclipse 3.4.0 to 3.5.1 (Galileo).

There is a problem with the content assist.

Where I type CTRL+SPACE, nothing happen. But when I change the binding of CTRL+SPACE to another binding in Eclipse (Preferences->Keys), it works (CTRL+SPACE works for my editor).

Here is the Listener:

public class CompletionVerifyKeyListener implements VerifyKeyListener{

    private ISourceViewer sourceViewer = null ;
    private ITextListener textListener = null ;
    private QuickAssistAssistant qaa = null ;


    public CompletionVerifyKeyListener(ISourceViewer sourceViewer, ITextListener textListener, QuickAssistAssistant qaa) {
        this.sourceViewer = sourceViewer ;
        this.textListener = textListener ;
        this.qaa = qaa ;
    }

    @Override
    public void verifyKey(VerifyEvent arg0) {

        System.out.println("Code: " + arg0.keyCode);
        System.out.println("StateMask: " + arg0.stateMask);

        if (arg0.keyCode == 32 && (arg0.stateMask != 0)){
            this.sourceViewer.addTextListener(this.textListener) ;
            AutoCompletion ac = new AutoCompletion(this.sourceViewer, this.qaa) ;
            ac.showIfAvailable() ;
        }
    }

}

When CTRL+SPACE is binded in Eclipse, the StateMask remains 0 but when I change it, StateMask is 262144 (SWT.CTRL).

I've read this: http://wiki.eclipse.org/FAQ_How_do_I_add_Content_Assist_to_my_editor%3F but I don't understand all. Maybe I've to add the createActions method (but I don't know where).

Thanks for your help.

Probably the Ctrl+Space is conflicting with another command. Did you see anything in the Error Log view about the conflicts?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM