forked from qt-creator/qt-creator
Android: Use a BaseEditorFactory derived class for JavaEditor
Change-Id: Ifc923177744af5058b22fac7fff2f2345cc99135 Reviewed-by: Christian Stenger <christian.stenger@digia.com>
This commit is contained in:
@@ -7228,6 +7228,7 @@ BaseTextDocumentPtr BaseTextEditor::ensureDocument()
|
||||
BaseTextEditorFactory::BaseTextEditorFactory(QObject *parent)
|
||||
: IEditorFactory(parent)
|
||||
{
|
||||
m_widgetCreator = []() { return new BaseTextEditorWidget; };
|
||||
}
|
||||
|
||||
void BaseTextEditorFactory::setDocumentCreator(const BaseTextDocumentCreator &creator)
|
||||
@@ -7255,6 +7256,20 @@ void BaseTextEditorFactory::setSyntaxHighlighterCreator(const SyntaxHighLighterC
|
||||
m_syntaxHighlighterCreator = creator;
|
||||
}
|
||||
|
||||
void BaseTextEditorFactory::setGenericSyntaxHighlighter(const QString &mimeType)
|
||||
{
|
||||
m_syntaxHighlighterCreator = [this, mimeType]() -> SyntaxHighlighter * {
|
||||
Highlighter *highlighter = new TextEditor::Highlighter();
|
||||
setMimeTypeForHighlighter(highlighter, Core::MimeDatabase::findByType(mimeType));
|
||||
return highlighter;
|
||||
};
|
||||
}
|
||||
|
||||
void BaseTextEditorFactory::setAutoCompleterCreator(const AutoCompleterCreator &creator)
|
||||
{
|
||||
m_autoCompleterCreator = creator;
|
||||
}
|
||||
|
||||
void BaseTextEditorFactory::setEditorActionHandlers(Id contextId, uint optionalActions)
|
||||
{
|
||||
new TextEditorActionHandler(this, contextId, optionalActions);
|
||||
@@ -7298,6 +7313,9 @@ BaseTextEditor *BaseTextEditorFactory::createEditorHelper(const BaseTextDocument
|
||||
|
||||
widget->d->m_codeAssistant.configure(editor);
|
||||
|
||||
if (m_autoCompleterCreator)
|
||||
widget->setAutoCompleter(m_autoCompleterCreator());
|
||||
|
||||
return editor;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user