Commit 890bb77f authored by Eike Ziller's avatar Eike Ziller

Update the Qml working copy from the documents, not editors.

Unfortunately the language is still checked by using an editor property.

Change-Id: I3b54624e60b65c48b154c405f66d04b74be5be3e
Reviewed-by: default avatarErik Verbruggen <erik.verbruggen@digia.com>
parent a6eefb1a
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#include <coreplugin/messagemanager.h> #include <coreplugin/messagemanager.h>
#include <cpptools/cppmodelmanagerinterface.h> #include <cpptools/cppmodelmanagerinterface.h>
#include <qmljs/qmljsbind.h> #include <qmljs/qmljsbind.h>
#include <texteditor/basetexteditor.h> #include <texteditor/basetextdocument.h>
#include <projectexplorer/buildconfiguration.h> #include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>
...@@ -55,6 +55,7 @@ ...@@ -55,6 +55,7 @@
#include <QFile> #include <QFile>
#include <QFileInfo> #include <QFileInfo>
#include <utils/runextensions.h> #include <utils/runextensions.h>
#include <QTextDocument>
#include <QTextStream> #include <QTextStream>
#include <QTimer> #include <QTimer>
#include <QRegExp> #include <QRegExp>
...@@ -326,17 +327,13 @@ void ModelManager::loadQmlTypeDescriptions(const QString &resourcePath) ...@@ -326,17 +327,13 @@ void ModelManager::loadQmlTypeDescriptions(const QString &resourcePath)
ModelManagerInterface::WorkingCopy ModelManager::workingCopy() const ModelManagerInterface::WorkingCopy ModelManager::workingCopy() const
{ {
WorkingCopy workingCopy; WorkingCopy workingCopy;
if (!Core::ICore::instance()) Core::DocumentModel *documentModel = Core::EditorManager::documentModel();
return workingCopy; foreach (Core::IDocument *document, documentModel->openedDocuments()) {
const QString key = document->filePath();
foreach (Core::IEditor *editor, Core::ICore::editorManager()->openedEditors()) { if (TextEditor::BaseTextDocument *textDocument = qobject_cast<TextEditor::BaseTextDocument *>(document)) {
const QString key = editor->document()->filePath(); // TODO the language should be a property on the document, not the editor
if (documentModel->editorsForDocument(document).first()->context().contains(ProjectExplorer::Constants::LANG_QMLJS))
if (TextEditor::ITextEditor *textEditor = qobject_cast<TextEditor::ITextEditor*>(editor)) { workingCopy.insert(key, textDocument->contents(), textDocument->document()->revision());
if (textEditor->context().contains(ProjectExplorer::Constants::LANG_QMLJS)) {
if (TextEditor::BaseTextEditorWidget *ed = qobject_cast<TextEditor::BaseTextEditorWidget *>(textEditor->widget()))
workingCopy.insert(key, ed->toPlainText(), ed->document()->revision());
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment