void () { myNameSuggestionsField = new NameSuggestionsField(new String[] { myTag.getName() }, myProject, FileTypes.PLAIN_TEXT, myEditor); myNameChangedListener = () -> validateButtons(); myNameSuggestionsField.addDataChangedListener(myNameChangedListener); myNameSuggestionsField.getComponent().registerKeyboardAction(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { completeVariable(myNameSuggestionsField.getEditor()); } }, KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, InputEvent.CTRL_MASK), JComponent.WHEN_IN_FOCUSED_WINDOW); }