Я должен обновить плагин Eclipse 3.4.0 до 3.5.1 (Galileo) для Eclipse (редактор).
Проблема с помощником по содержимому.
Там, где я набираю CTRL + SPACE, ничего не происходит. Но когда я изменяю привязку CTRL + SPACE к другой привязке в Eclipse (Preferences-> Keys), она работает (CTRL + SPACE работает для моего редактора).
Вот слушатель:
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() ;
}
}
}
Когда CTRL + SPACE связан в Eclipse, StateMask остается 0, но когда я изменяю его, StateMask равен 262144 (SWT.CTRL).
Я читал это: http://wiki.eclipse.org/FAQ_How_do_I_add_Content_Assist_to_my_editor%3F но я не все понимаю. Возможно, мне нужно добавить метод createActions (но я не знаю, где).
Спасибо за вашу помощь.