From 07812d8d2df15764efe031397e5089e9d4c16baa Mon Sep 17 00:00:00 2001 From: David Schulz Date: Fri, 13 Sep 2024 09:09:10 +0200 Subject: [PATCH] ProjectExplorer: allow removing and adding files in workspace projects Change-Id: I06ffedbc5e7b15f909ef726e769ac5245b064e4f Reviewed-by: Marcus Tillmanns --- .../projectexplorer/workspaceproject.cpp | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/plugins/projectexplorer/workspaceproject.cpp b/src/plugins/projectexplorer/workspaceproject.cpp index e3442e8d261..2a6d8cbc2df 100644 --- a/src/plugins/projectexplorer/workspaceproject.cpp +++ b/src/plugins/projectexplorer/workspaceproject.cpp @@ -64,6 +64,12 @@ public: void reparse(bool force); void triggerParsing() final; + bool addFiles(Node *context, const FilePaths &filePaths, FilePaths *notAdded) final; + RemovedFilesFromProject removeFiles(Node *context, const FilePaths &filePaths, FilePaths *notRemoved) final; + bool deleteFiles(Node *context, const FilePaths &filePaths) final; + bool renameFile(Node *context, const FilePath &oldFilePath, const FilePath &newFilePath) final; + bool supportsAction(Node *context, ProjectAction action, const Node *node) const final; + void watchFolder(const FilePath &path, const QList &versionControls); void handleDirectoryChanged(const FilePath &directory); @@ -222,6 +228,36 @@ void WorkspaceBuildSystem::triggerParsing() reparse(false); } +bool WorkspaceBuildSystem::addFiles(Node *, const FilePaths &, FilePaths *) +{ + // nothing to do here since the changes will be picked up by the file system watcher + return true; +} + +RemovedFilesFromProject WorkspaceBuildSystem::removeFiles(Node *, const FilePaths &, FilePaths *) +{ + // nothing to do here since the changes will be picked up by the file system watcher + return RemovedFilesFromProject::Ok; +} + +bool WorkspaceBuildSystem::deleteFiles(Node *, const FilePaths &) +{ + // nothing to do here since the changes will be picked up by the file system watcher + return true; +} + +bool WorkspaceBuildSystem::renameFile(Node *, const FilePath &, const FilePath &) +{ + // nothing to do here since the changes will be picked up by the file system watcher + return true; +} + +bool WorkspaceBuildSystem::supportsAction(Node *, ProjectAction action, const Node *) const +{ + return action == ProjectAction::Rename || action == ProjectAction::AddNewFile + || action == ProjectAction::EraseFile; +} + void WorkspaceBuildSystem::watchFolder( const FilePath &path, const QList &versionControls) {