public ScriptCompletionContext installAutoCompletion() {
ScriptCompletionContext context = new ScriptCompletionContext(inputArea);
if (project != null) {
context.setGlobalDataElements(project.getGlobalDataElements());
}
AutoCompleterFactory factory = AutoCompleterFactory.codeEditorFactory();
// We don't want the auto completer to do anything about the focus,
// because it leads to annoying flickering if the completed token
// has an input argument that gets automatically highlighted. The
// token implementation returned by the FormulaBuilder's completion
// context handles the focus issues themselves.
factory.setGrabFocus(false);
AutoCompleter autoCompleter = factory.createAutoCompleter(context);
autoCompleter.install(inputArea.getTextPane());
return context;
}