data: explicitly clear all errors when refreshing incomplete files
This commit is contained in:
@@ -8,10 +8,11 @@
|
||||
#include "Application.h"
|
||||
|
||||
TaskCleanStorage::TaskCleanStorage(
|
||||
PersistentStorage* storage, const std::vector<FilePath>& filePaths
|
||||
PersistentStorage* storage, const std::vector<FilePath>& filePaths, bool clearAllErrors
|
||||
)
|
||||
: m_storage(storage)
|
||||
, m_filePaths(filePaths)
|
||||
, m_clearAllErrors(clearAllErrors)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -22,7 +23,7 @@ void TaskCleanStorage::doEnter(std::shared_ptr<Blackboard> blackboard)
|
||||
|
||||
m_start = utility::durationStart();
|
||||
|
||||
if (!m_filePaths.empty())
|
||||
if (!m_filePaths.empty() || m_clearAllErrors)
|
||||
{
|
||||
m_storage->setMode(SqliteIndexStorage::STORAGE_MODE_CLEAR);
|
||||
}
|
||||
@@ -30,6 +31,11 @@ void TaskCleanStorage::doEnter(std::shared_ptr<Blackboard> blackboard)
|
||||
|
||||
Task::TaskState TaskCleanStorage::doUpdate(std::shared_ptr<Blackboard> blackboard)
|
||||
{
|
||||
if (m_clearAllErrors)
|
||||
{
|
||||
m_storage->clearAllErrors();
|
||||
}
|
||||
|
||||
m_storage->clearFileElements(m_filePaths, [=](int progress)
|
||||
{
|
||||
Application::getInstance()->getDialogView()->showProgressDialog(
|
||||
|
||||
@@ -16,7 +16,8 @@ class TaskCleanStorage
|
||||
public:
|
||||
TaskCleanStorage(
|
||||
PersistentStorage* storage,
|
||||
const std::vector<FilePath>& filePaths
|
||||
const std::vector<FilePath>& filePaths,
|
||||
bool clearAllErrors
|
||||
);
|
||||
|
||||
private:
|
||||
@@ -27,6 +28,7 @@ private:
|
||||
|
||||
PersistentStorage* m_storage;
|
||||
std::vector<FilePath> m_filePaths;
|
||||
bool m_clearAllErrors;
|
||||
|
||||
TimeStamp m_start;
|
||||
};
|
||||
|
||||
@@ -328,6 +328,13 @@ std::set<FilePath> PersistentStorage::getReferencing(const std::set<FilePath>& f
|
||||
return referencing;
|
||||
}
|
||||
|
||||
void PersistentStorage::clearAllErrors()
|
||||
{
|
||||
TRACE();
|
||||
|
||||
m_sqliteIndexStorage.removeAllErrors();
|
||||
}
|
||||
|
||||
void PersistentStorage::clearFileElements(const std::vector<FilePath>& filePaths, std::function<void(int)> updateStatusCallback)
|
||||
{
|
||||
TRACE();
|
||||
|
||||
@@ -61,6 +61,7 @@ public:
|
||||
std::set<FilePath> getReferenced(const std::set<FilePath>& filePaths) const;
|
||||
std::set<FilePath> getReferencing(const std::set<FilePath>& filePaths) const;
|
||||
|
||||
void clearAllErrors();
|
||||
void clearFileElements(const std::vector<FilePath>& filePaths, std::function<void(int)> updateStatusCallback);
|
||||
|
||||
std::vector<FileInfo> getFileInfoForAllIndexedFiles() const;
|
||||
|
||||
@@ -450,6 +450,13 @@ void SqliteIndexStorage::removeElementsWithLocationInFiles(const std::vector<Id>
|
||||
}
|
||||
}
|
||||
|
||||
void SqliteIndexStorage::removeAllErrors()
|
||||
{
|
||||
executeStatement(
|
||||
"DELETE FROM error;"
|
||||
);
|
||||
}
|
||||
|
||||
void SqliteIndexStorage::removeErrorsInFiles(const std::vector<FilePath>& filePaths)
|
||||
{
|
||||
executeStatement(
|
||||
|
||||
@@ -54,6 +54,7 @@ public:
|
||||
void removeElements(const std::vector<Id>& ids);
|
||||
void removeElementsWithLocationInFiles(const std::vector<Id>& fileIds, std::function<void(int)> updateStatusCallback);
|
||||
|
||||
void removeAllErrors();
|
||||
void removeErrorsInFiles(const std::vector<FilePath>& filePaths);
|
||||
|
||||
bool isEdge(Id elementId) const;
|
||||
|
||||
@@ -356,7 +356,8 @@ void Project::buildIndex(const RefreshInfo& info, DialogView* dialogView)
|
||||
{
|
||||
taskSequential->addTask(std::make_shared<TaskCleanStorage>(
|
||||
m_storage.get(),
|
||||
utility::toVector(utility::concat(info.filesToClear, info.nonIndexedFilesToClear))
|
||||
utility::toVector(utility::concat(info.filesToClear, info.nonIndexedFilesToClear)),
|
||||
info.mode == REFRESH_UPDATED_AND_INCOMPLETE_FILES
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user