forked from qt-creator/qt-creator
Android: Simplify code assist by using KeywordsCompletionProvider
Change-Id: I566e54e8cb539227019fd9cf94113924d1ac9822 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Vikas Pachdha <vikas.pachdha@qt.io>
This commit is contained in:
@@ -26,8 +26,8 @@
|
||||
#include "javaeditor.h"
|
||||
#include "javaindenter.h"
|
||||
#include "androidconstants.h"
|
||||
#include "javacompletionassistprovider.h"
|
||||
|
||||
#include <texteditor/codeassist/keywordscompletionassist.h>
|
||||
#include <coreplugin/editormanager/ieditorfactory.h>
|
||||
#include <texteditor/normalindenter.h>
|
||||
#include <texteditor/textdocument.h>
|
||||
@@ -59,6 +59,14 @@ static TextEditor::TextDocument *createJavaDocument()
|
||||
|
||||
JavaEditorFactory::JavaEditorFactory()
|
||||
{
|
||||
static QStringList keywords = {
|
||||
"abstract", "assert", "boolean", "break", "byte", "case", "catch", "char", "class", "const",
|
||||
"continue", "default", "do", "double", "else", "enum", "extends", "final", "finally",
|
||||
"float", "for", "goto", "if", "implements", "import", "instanceof", "int", "interface",
|
||||
"long", "native", "new", "package", "private", "protected", "public", "return", "short",
|
||||
"static", "strictfp", "super", "switch", "synchronized", "this", "throw", "throws",
|
||||
"transient", "try", "void", "volatile", "while"
|
||||
};
|
||||
setId(Constants::JAVA_EDITOR_ID);
|
||||
setDisplayName(tr("Java Editor"));
|
||||
addMimeType(Constants::JAVA_MIMETYPE);
|
||||
@@ -67,8 +75,8 @@ JavaEditorFactory::JavaEditorFactory()
|
||||
setUseGenericHighlighter(true);
|
||||
setCommentDefinition(Utils::CommentDefinition::CppStyle);
|
||||
setEditorActionHandlers(TextEditor::TextEditorActionHandler::UnCommentSelection);
|
||||
setCompletionAssistProvider(new JavaCompletionAssistProvider);
|
||||
setMarksVisible(true);
|
||||
setCompletionAssistProvider(new TextEditor::KeywordsCompletionAssistProvider(keywords));
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
Reference in New Issue
Block a user