Commit 51d91a60 authored by Nikolai Kosjar's avatar Nikolai Kosjar

CppTools: Add revisions to AbstractEditorSupport

So far revisions for AbstractEditorSupport were not needed because until
recently we only had a single snapshot ("global snapshot"). Now, since
editor snapshots are introduced, we need to make sure to update the
corresponding documents in these snapshots, too. To do this efficiently,
a revision is introduced for AbstractEditorSupport.

Task-number: QTCREATORBUG-10894

Change-Id: Ibad1dbbafb7c721d1328959c1e903345fe465326
Reviewed-by: default avatarChristian Stenger <christian.stenger@digia.com>
Reviewed-by: default avatarErik Verbruggen <erik.verbruggen@digia.com>
parent b7d0d968
......@@ -38,7 +38,7 @@
namespace CppTools {
AbstractEditorSupport::AbstractEditorSupport(CppModelManagerInterface *modelmanager) :
m_modelmanager(modelmanager)
m_modelmanager(modelmanager), m_revision(0)
{
}
......@@ -48,6 +48,7 @@ AbstractEditorSupport::~AbstractEditorSupport()
void AbstractEditorSupport::updateDocument()
{
++m_revision;
m_modelmanager->updateSourceFiles(QStringList(fileName()));
}
......
......@@ -50,6 +50,7 @@ public:
virtual QString fileName() const = 0;
void updateDocument();
unsigned revision() const { return m_revision; }
// TODO: find a better place for common utility functions
static QString functionAt(const CppModelManagerInterface *mm,
......@@ -60,6 +61,7 @@ public:
private:
CppModelManagerInterface *m_modelmanager;
unsigned m_revision;
};
} // namespace CppTools
......
......@@ -550,7 +550,7 @@ CppModelManager::WorkingCopy CppModelManager::buildWorkingCopyList()
QSetIterator<AbstractEditorSupport *> it(m_extraEditorSupports);
while (it.hasNext()) {
AbstractEditorSupport *es = it.next();
workingCopy.insert(es->fileName(), es->contents());
workingCopy.insert(es->fileName(), es->contents(), es->revision());
}
// Add the project configuration file
......
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