diff options
Diffstat (limited to 'src/plugins/clangrefactoring')
5 files changed, 35 insertions, 19 deletions
diff --git a/src/plugins/clangrefactoring/clangrefactoringplugin.cpp b/src/plugins/clangrefactoring/clangrefactoringplugin.cpp index ea765bed5f..059eff4c78 100644 --- a/src/plugins/clangrefactoring/clangrefactoringplugin.cpp +++ b/src/plugins/clangrefactoring/clangrefactoringplugin.cpp @@ -36,6 +36,7 @@ #include <clangpchmanager/clangpchmanagerplugin.h> #include <clangpchmanager/progressmanager.h> #include <clangsupport/refactoringdatabaseinitializer.h> +#include <projectpartsstorage.h> #include <cpptools/cppmodelmanager.h> @@ -61,6 +62,8 @@ namespace ClangRefactoring { namespace { +using ClangPchManager::ClangPchManagerPlugin; + QString backendProcessPath() { return Core::ICore::libexecPath() @@ -91,14 +94,16 @@ public: ClangBackEnd::RefactoringConnectionClient connectionClient{&refactoringClient}; QuerySqliteReadStatementFactory statementFactory{database}; SymbolQuery<QuerySqliteReadStatementFactory> symbolQuery{statementFactory}; + ClangBackEnd::ProjectPartsStorage<Sqlite::Database> projectPartsStorage{database}; RefactoringEngine engine{connectionClient.serverProxy(), refactoringClient, filePathCache, symbolQuery}; QtCreatorSearch qtCreatorSearch; QtCreatorClangQueryFindFilter qtCreatorfindFilter{connectionClient.serverProxy(), qtCreatorSearch, refactoringClient}; QtCreatorRefactoringProjectUpdater projectUpdate{connectionClient.serverProxy(), - ClangPchManager::ClangPchManagerPlugin::pchManagerClient(), - filePathCache}; + ClangPchManagerPlugin::pchManagerClient(), + filePathCache, + projectPartsStorage}; }; ClangRefactoringPlugin::ClangRefactoringPlugin() diff --git a/src/plugins/clangrefactoring/qtcreatorrefactoringprojectupdater.cpp b/src/plugins/clangrefactoring/qtcreatorrefactoringprojectupdater.cpp index f3ca992620..dea3ccfeec 100644 --- a/src/plugins/clangrefactoring/qtcreatorrefactoringprojectupdater.cpp +++ b/src/plugins/clangrefactoring/qtcreatorrefactoringprojectupdater.cpp @@ -60,10 +60,16 @@ std::vector<ClangBackEnd::V2::FileContainer> createGeneratedFiles() } } -QtCreatorRefactoringProjectUpdater::QtCreatorRefactoringProjectUpdater(ClangBackEnd::ProjectManagementServerInterface &server, - ClangPchManager::PchManagerClient &pchManagerClient, - ClangBackEnd::FilePathCachingInterface &filePathCache) - : RefactoringProjectUpdater(server, pchManagerClient, *cppModelManager(), filePathCache) +QtCreatorRefactoringProjectUpdater::QtCreatorRefactoringProjectUpdater( + ClangBackEnd::ProjectManagementServerInterface &server, + ClangPchManager::PchManagerClient &pchManagerClient, + ClangBackEnd::FilePathCachingInterface &filePathCache, + ClangBackEnd::ProjectPartsStorageInterface &projectPartsStorage) + : RefactoringProjectUpdater(server, + pchManagerClient, + *cppModelManager(), + filePathCache, + projectPartsStorage) { connectToCppModelManager(); } diff --git a/src/plugins/clangrefactoring/qtcreatorrefactoringprojectupdater.h b/src/plugins/clangrefactoring/qtcreatorrefactoringprojectupdater.h index 118c15b50c..85d635a3af 100644 --- a/src/plugins/clangrefactoring/qtcreatorrefactoringprojectupdater.h +++ b/src/plugins/clangrefactoring/qtcreatorrefactoringprojectupdater.h @@ -32,9 +32,11 @@ namespace ClangRefactoring { class QtCreatorRefactoringProjectUpdater final : public RefactoringProjectUpdater { public: - QtCreatorRefactoringProjectUpdater(ClangBackEnd::ProjectManagementServerInterface &server, - ClangPchManager::PchManagerClient &pchManagerClient, - ClangBackEnd::FilePathCachingInterface &filePathCache); + QtCreatorRefactoringProjectUpdater( + ClangBackEnd::ProjectManagementServerInterface &server, + ClangPchManager::PchManagerClient &pchManagerClient, + ClangBackEnd::FilePathCachingInterface &filePathCache, + ClangBackEnd::ProjectPartsStorageInterface &projectPartsStorage); private: void abstractEditorUpdated(const QString &filePath, const QByteArray &contents); diff --git a/src/plugins/clangrefactoring/refactoringprojectupdater.cpp b/src/plugins/clangrefactoring/refactoringprojectupdater.cpp index 99b028e522..8cfd5b942a 100644 --- a/src/plugins/clangrefactoring/refactoringprojectupdater.cpp +++ b/src/plugins/clangrefactoring/refactoringprojectupdater.cpp @@ -26,19 +26,22 @@ #include "refactoringprojectupdater.h" #include <cpptools/cppmodelmanager.h> +#include <projectpartsstorageinterface.h> namespace ClangRefactoring { -void RefactoringProjectUpdater::precompiledHeaderUpdated(const QString &projectPartId, +void RefactoringProjectUpdater::precompiledHeaderUpdated(ClangBackEnd::ProjectPartId projectPartId, const QString &, long long) { - auto projectPart = m_cppModelManager.projectPartForId(projectPartId); + const QString projectPartName = fetchProjectPartName(projectPartId); + + auto projectPart = m_cppModelManager.projectPartForId(projectPartName); if (projectPart) updateProjectParts({projectPart.data()}, {}); } -void RefactoringProjectUpdater::precompiledHeaderRemoved(const QString &projectPartId) +void RefactoringProjectUpdater::precompiledHeaderRemoved(ClangBackEnd::ProjectPartId projectPartId) { removeProjectParts({projectPartId}); } diff --git a/src/plugins/clangrefactoring/refactoringprojectupdater.h b/src/plugins/clangrefactoring/refactoringprojectupdater.h index 8e2652cf23..a9559ef94e 100644 --- a/src/plugins/clangrefactoring/refactoringprojectupdater.h +++ b/src/plugins/clangrefactoring/refactoringprojectupdater.h @@ -39,18 +39,18 @@ public: RefactoringProjectUpdater(ClangBackEnd::ProjectManagementServerInterface &server, ClangPchManager::PchManagerClient &pchManagerClient, CppTools::CppModelManagerInterface &cppModelManager, - ClangBackEnd::FilePathCachingInterface &filePathCache) - : ClangPchManager::ProjectUpdater(server, filePathCache), - ClangPchManager::PchManagerNotifierInterface(pchManagerClient), - m_cppModelManager(cppModelManager) + ClangBackEnd::FilePathCachingInterface &filePathCache, + ClangBackEnd::ProjectPartsStorageInterface &projectPartsStorage) + : ClangPchManager::ProjectUpdater(server, filePathCache, projectPartsStorage) + , ClangPchManager::PchManagerNotifierInterface(pchManagerClient) + , m_cppModelManager(cppModelManager) { - } - void precompiledHeaderUpdated(const QString &projectPartId, + void precompiledHeaderUpdated(ClangBackEnd::ProjectPartId projectPartId, const QString &pchFilePath, long long lastModified) override; - void precompiledHeaderRemoved(const QString &projectPartId) override; + void precompiledHeaderRemoved(ClangBackEnd::ProjectPartId projectPartId) override; private: CppTools::CppModelManagerInterface &m_cppModelManager; |