TextEditor: Start moving data from *EditorWidget to *Editor

Goal is to consolidate "controller" related data in the *Editor hierarchy.
This patch introduces temporary "cross-Private" accessors dd() to
keep the patches small.

First item moved is the AutoCompleter, a glimps at long term benefits
is the simplification in the JavaEditorWidget which is now essentially
a BaseTextEditorWidget, only containing the still-wrong createEditor().
But that can only be move if the *Editors are self-contained, i.e.
keep data themselves, not indirectly through the *EditorWidgets.

Change-Id: Ia0ab90f0322bb17ac20458e6581069eed30acbaf
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
hjk
2014-07-31 14:44:35 +02:00
parent 9fd2fe5a9a
commit 98fd59fd09
12 changed files with 42 additions and 37 deletions

View File

@@ -35,7 +35,6 @@
#include "qmljseditorplugin.h"
#include "qmloutlinemodel.h"
#include "qmljsfindreferences.h"
#include "qmljsautocompleter.h"
#include "qmljscompletionassist.h"
#include "qmljsquickfixassist.h"
@@ -120,7 +119,6 @@ void QmlJSTextEditorWidget::ctor()
setParenthesesMatchingEnabled(true);
setMarksVisible(true);
setCodeFoldingSupported(true);
setAutoCompleter(new AutoCompleter);
setLanguageSettingsId(QmlJSTools::Constants::QML_JS_SETTINGS_ID);
m_updateUsesTimer = new QTimer(this);

View File

@@ -31,6 +31,7 @@
#include "qmljseditor.h"
#include "qmljseditorconstants.h"
#include "qmljscompletionassist.h"
#include "qmljsautocompleter.h"
#include <qmljstools/qmljstoolsconstants.h>
#include <texteditor/texteditorconstants.h>
@@ -56,6 +57,7 @@ QmlJSEditor::QmlJSEditor(QmlJSTextEditorWidget *editor)
setDuplicateSupported(true);
setCommentStyle(Utils::CommentDefinition::CppStyle);
setCompletionAssistProvider(ExtensionSystem::PluginManager::getObject<Internal::QmlJSCompletionAssistProvider>());
setAutoCompleter(new AutoCompleter);
}
bool QmlJSEditor::isDesignModePreferred() const

View File

@@ -66,5 +66,5 @@ void QmlJSSnippetProvider::decorateEditor(TextEditor::SnippetEditorWidget *edito
{
editor->setSyntaxHighlighter(new Highlighter);
editor->baseTextDocument()->setIndenter(new Indenter);
editor->setAutoCompleter(new AutoCompleter);
editor->editor()->setAutoCompleter(new AutoCompleter);
}