diff options
-rw-r--r-- | src/libs/qmljs/qmljsmodelmanagerinterface.cpp | 18 | ||||
-rw-r--r-- | src/libs/qmljs/qmljsmodelmanagerinterface.h | 4 | ||||
-rw-r--r-- | src/plugins/qmljseditor/qmltaskmanager.cpp | 2 | ||||
-rw-r--r-- | src/plugins/qmljstools/qmljsmodelmanager.cpp | 12 | ||||
-rw-r--r-- | src/plugins/qmljstools/qmljsmodelmanager.h | 3 |
5 files changed, 31 insertions, 8 deletions
diff --git a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp index fb43abc65a..96aac5619d 100644 --- a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp +++ b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp @@ -34,6 +34,24 @@ using namespace QmlJS; +/*! + \class QmlJS::ModelManagerInterface + \brief Interface to the global state of the QmlJS code model. + \sa QmlJS::Document QmlJS::Snapshot QmlJSTools::Internal::ModelManager + + The ModelManagerInterface is an interface for global state and actions in + the QmlJS code model. It is implemented by \l{QmlJSTools::Internal::ModelManager} + and the instance can be accessed through ModelManagerInterface::instance(). + + One of its primary concerns is to keep the Snapshots it + maintains up to date by parsing documents and finding QML modules. + + It has a Snapshot that contains only valid Documents, + accessible through ModelManagerInterface::snapshot() and a Snapshot with + potentially more recent, but invalid documents that is exposed through + ModelManagerInterface::newestSnapshot(). +*/ + static ModelManagerInterface *g_instance = 0; ModelManagerInterface::ModelManagerInterface(QObject *parent) diff --git a/src/libs/qmljs/qmljsmodelmanagerinterface.h b/src/libs/qmljs/qmljsmodelmanagerinterface.h index 17530e4359..c021341e5d 100644 --- a/src/libs/qmljs/qmljsmodelmanagerinterface.h +++ b/src/libs/qmljs/qmljsmodelmanagerinterface.h @@ -119,7 +119,9 @@ public: static ModelManagerInterface *instance(); virtual WorkingCopy workingCopy() const = 0; - virtual QmlJS::Snapshot snapshot(bool preferValid = true) const = 0; + + virtual QmlJS::Snapshot snapshot() const = 0; + virtual QmlJS::Snapshot newestSnapshot() const = 0; virtual void updateSourceFiles(const QStringList &files, bool emitDocumentOnDiskChanged) = 0; diff --git a/src/plugins/qmljseditor/qmltaskmanager.cpp b/src/plugins/qmljseditor/qmltaskmanager.cpp index 93e17201cf..2a59adc8f6 100644 --- a/src/plugins/qmljseditor/qmltaskmanager.cpp +++ b/src/plugins/qmljseditor/qmltaskmanager.cpp @@ -153,7 +153,7 @@ void QmlTaskManager::updateMessagesNow(bool updateSemantic) // process them QFuture<FileErrorMessages> future = QtConcurrent::run<FileErrorMessages>( - &collectMessages, modelManager->snapshot(false), modelManager->projectInfos(), + &collectMessages, modelManager->newestSnapshot(), modelManager->projectInfos(), modelManager->importPaths(), updateSemantic); m_messageCollector.setFuture(future); } diff --git a/src/plugins/qmljstools/qmljsmodelmanager.cpp b/src/plugins/qmljstools/qmljsmodelmanager.cpp index 545761ad7e..bc4c1cfc94 100644 --- a/src/plugins/qmljstools/qmljsmodelmanager.cpp +++ b/src/plugins/qmljstools/qmljsmodelmanager.cpp @@ -170,14 +170,16 @@ ModelManagerInterface::WorkingCopy ModelManager::workingCopy() const return workingCopy; } -Snapshot ModelManager::snapshot(bool preferValid) const +Snapshot ModelManager::snapshot() const { QMutexLocker locker(&m_mutex); + return _validSnapshot; +} - if (preferValid) - return _validSnapshot; - else - return _newestSnapshot; +Snapshot ModelManager::newestSnapshot() const +{ + QMutexLocker locker(&m_mutex); + return _newestSnapshot; } void ModelManager::updateSourceFiles(const QStringList &files, diff --git a/src/plugins/qmljstools/qmljsmodelmanager.h b/src/plugins/qmljstools/qmljsmodelmanager.h index 0a8c26fdbd..a6803a008f 100644 --- a/src/plugins/qmljstools/qmljsmodelmanager.h +++ b/src/plugins/qmljstools/qmljsmodelmanager.h @@ -69,7 +69,8 @@ public: void delayedInitialization(); virtual WorkingCopy workingCopy() const; - virtual QmlJS::Snapshot snapshot(bool preferValid = true) const; + virtual QmlJS::Snapshot snapshot() const; + virtual QmlJS::Snapshot newestSnapshot() const; virtual void updateSourceFiles(const QStringList &files, bool emitDocumentOnDiskChanged); |