Android: Use a BaseEditorFactory derived class for JavaEditor

Change-Id: Ifc923177744af5058b22fac7fff2f2345cc99135
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
This commit is contained in:
hjk
2014-08-22 12:49:02 +02:00
parent 984e2e3cac
commit 2b5df11cb8
4 changed files with 56 additions and 52 deletions

View File

@@ -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;
}