diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp index 2aec0daa0cc4e5ec816713b40ad0d168856ef034..0967cfdd0926140339acde34b0e5a1ffaf2c052b 100644 --- a/src/plugins/cpptools/cppmodelmanager.cpp +++ b/src/plugins/cpptools/cppmodelmanager.cpp @@ -648,6 +648,16 @@ QByteArray CppModelManager::internalDefinedMacros() const return macros; } +void CppModelManager::addEditorSupport(AbstractEditorSupport *editorSupport) +{ + m_addtionalEditorSupport.insert(editorSupport); +} + +void CppModelManager::removeEditorSupport(AbstractEditorSupport *editorSupport) +{ + m_addtionalEditorSupport.remove(editorSupport); +} + QMap<QString, QByteArray> CppModelManager::buildWorkingCopyList() { QMap<QString, QByteArray> workingCopy; @@ -660,6 +670,12 @@ QMap<QString, QByteArray> CppModelManager::buildWorkingCopyList() workingCopy[fileName] = editorSupport->contents(); } + QSetIterator<AbstractEditorSupport *> jt(m_addtionalEditorSupport); + while (jt.hasNext()) { + AbstractEditorSupport *es = jt.next(); + workingCopy[es->fileName()] = es->contents(); + } + // add the project configuration file QByteArray conf(pp_configuration); conf += definedMacros(); diff --git a/src/plugins/cpptools/cppmodelmanager.h b/src/plugins/cpptools/cppmodelmanager.h index 9f2c2f221e21d1d9db66eca904f68866d4da521a..30569890e2ebdf4ff8fbed0126509c172d470465 100644 --- a/src/plugins/cpptools/cppmodelmanager.h +++ b/src/plugins/cpptools/cppmodelmanager.h @@ -91,6 +91,9 @@ public: void stopEditorSelectionsUpdate() { m_updateEditorSelectionsTimer->stop(); } + virtual void addEditorSupport(AbstractEditorSupport *editorSupport); + virtual void removeEditorSupport(AbstractEditorSupport *editorSupport); + Q_SIGNALS: void projectPathChanged(const QString &projectPath); @@ -161,6 +164,8 @@ private: // editor integration QMap<TextEditor::ITextEditor *, CppEditorSupport *> m_editorSupport; + QSet<AbstractEditorSupport *> m_addtionalEditorSupport; + // project integration QMap<ProjectExplorer::Project *, ProjectInfo> m_projects; diff --git a/src/plugins/cpptools/cppmodelmanagerinterface.h b/src/plugins/cpptools/cppmodelmanagerinterface.h index b3da1aa03c70a6268959f413f59a43539947a725..bb926905d09351455c5f17172220bf70af629970 100644 --- a/src/plugins/cpptools/cppmodelmanagerinterface.h +++ b/src/plugins/cpptools/cppmodelmanagerinterface.h @@ -41,6 +41,8 @@ namespace ProjectExplorer { } namespace CppTools { + +class AbstractEditorSupport; class CPPTOOLS_EXPORT CppModelManagerInterface : public QObject { @@ -87,6 +89,25 @@ public: virtual QList<ProjectInfo> projectInfos() const = 0; virtual ProjectInfo projectInfo(ProjectExplorer::Project *project) const = 0; virtual void updateProjectInfo(const ProjectInfo &pinfo) = 0; + + virtual void addEditorSupport(AbstractEditorSupport *editorSupport) = 0; + virtual void removeEditorSupport(AbstractEditorSupport *editorSupport) = 0; +}; + +class CPPTOOLS_EXPORT AbstractEditorSupport +{ +public: + AbstractEditorSupport(CppModelManagerInterface *modelmanager) + : m_modelmanager(modelmanager) {} + virtual ~AbstractEditorSupport() {} + virtual QByteArray contents() const = 0; + virtual QString fileName() const = 0; + + void updateDocument() + { m_modelmanager->updateSourceFiles(QStringList() << fileName()); } + +private: + CppModelManagerInterface *m_modelmanager; }; } // namespace CppTools