diff options
author | hjk <hjk121@nokiamail.com> | 2014-08-22 12:49:02 +0200 |
---|---|---|
committer | hjk <hjk121@nokiamail.com> | 2014-08-22 16:21:32 +0200 |
commit | 2b5df11cb8f6e8d40d86728e8b788aff3a755907 (patch) | |
tree | 2087b4a9217267dc378713a69cc44dead2c2e7b4 /src/plugins/texteditor/basetexteditor.cpp | |
parent | 984e2e3cacd45280b9403b8754ad4437082ec69f (diff) |
Android: Use a BaseEditorFactory derived class for JavaEditor
Change-Id: Ifc923177744af5058b22fac7fff2f2345cc99135
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
Diffstat (limited to 'src/plugins/texteditor/basetexteditor.cpp')
-rw-r--r-- | src/plugins/texteditor/basetexteditor.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index 8f8473ece9..69254299ec 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -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; } |