ui: Added status messages for fulltext search

This commit is contained in:
Eberhard Graether
2016-06-12 09:35:11 +02:00
parent 19e26268cf
commit be3ba0ba23
2 changed files with 25 additions and 7 deletions
@@ -21,7 +21,6 @@ StatusBarView* StatusBarController::getView()
void StatusBarController::clear() void StatusBarController::clear()
{ {
getView()->setErrorCount(ErrorCountInfo()); getView()->setErrorCount(ErrorCountInfo());
getView()->showMessage("", false, false);
} }
void StatusBarController::handleMessage(MessageClearErrorCount* message) void StatusBarController::handleMessage(MessageClearErrorCount* message)
+25 -6
View File
@@ -7,6 +7,7 @@
#include "utility/logging/logging.h" #include "utility/logging/logging.h"
#include "utility/messaging/type/MessageClearErrorCount.h" #include "utility/messaging/type/MessageClearErrorCount.h"
#include "utility/messaging/type/MessageShowErrors.h" #include "utility/messaging/type/MessageShowErrors.h"
#include "utility/messaging/type/MessageStatus.h"
#include "utility/text/TextAccess.h" #include "utility/text/TextAccess.h"
#include "utility/TimePoint.h" #include "utility/TimePoint.h"
#include "utility/utility.h" #include "utility/utility.h"
@@ -102,7 +103,8 @@ Id PersistentStorage::addLocalSymbol(const std::string& name)
return localSymbolId; return localSymbolId;
} }
void PersistentStorage::addSourceLocation(Id elementId, Id fileNodeId, uint startLine, uint startCol, uint endLine, uint endCol, int type) void PersistentStorage::addSourceLocation(
Id elementId, Id fileNodeId, uint startLine, uint startCol, uint endLine, uint endCol, int type)
{ {
m_sqliteStorage.addSourceLocation( m_sqliteStorage.addSourceLocation(
elementId, elementId,
@@ -131,7 +133,8 @@ void PersistentStorage::addCommentLocation(Id fileNodeId, uint startLine, uint s
); );
} }
void PersistentStorage::addError(const std::string& message, bool fatal, const std::string& filePath, uint startLine, uint startCol) void PersistentStorage::addError(
const std::string& message, bool fatal, const std::string& filePath, uint startLine, uint startCol)
{ {
m_sqliteStorage.addError( m_sqliteStorage.addError(
message, message,
@@ -166,7 +169,8 @@ void PersistentStorage::forEachEdge(std::function<void(const Id /*id*/, const St
} }
} }
void PersistentStorage::forEachLocalSymbol(std::function<void(const Id /*id*/, const StorageLocalSymbol& /*data*/)> callback) const void PersistentStorage::forEachLocalSymbol(std::function<void(
const Id /*id*/, const StorageLocalSymbol& /*data*/)> callback) const
{ {
for (StorageLocalSymbol& localSymbol: m_sqliteStorage.getAllLocalSymbols()) for (StorageLocalSymbol& localSymbol: m_sqliteStorage.getAllLocalSymbols())
{ {
@@ -217,10 +221,11 @@ void PersistentStorage::finishInjection()
{ {
m_sqliteStorage.commitTransaction(); m_sqliteStorage.commitTransaction();
ErrorCountInfo errorCount = getErrorCount();
if (m_preInjectionErrorCount != -1 && if (m_preInjectionErrorCount != -1 &&
m_preInjectionErrorCount != getErrorCount().total) m_preInjectionErrorCount != errorCount.total)
{ {
MessageShowErrors msg(getErrorCount()); MessageShowErrors msg(errorCount);
msg.setSendAsTask(false); msg.setSendAsTask(false);
msg.dispatch(); msg.dispatch();
} }
@@ -396,9 +401,15 @@ std::shared_ptr<TokenLocationCollection> PersistentStorage::getFullTextSearchLoc
{ {
if (m_fullTextSearchIndex.fileCount() == 0) if (m_fullTextSearchIndex.fileCount() == 0)
{ {
MessageStatus("Building fulltext search index", false, true).dispatch();
buildFullTextSearchIndex(); buildFullTextSearchIndex();
} }
MessageStatus(
std::string("Searching fulltext (case-") + (caseSensitive ? "sensitive" : "insensitive") + "): " + searchTerm,
false, true
).dispatch();
std::shared_ptr<TokenLocationCollection> collection = std::make_shared<TokenLocationCollection>(); std::shared_ptr<TokenLocationCollection> collection = std::make_shared<TokenLocationCollection>();
std::vector<FullTextSearchResult> hits = m_fullTextSearchIndex.searchForTerm(searchTerm); std::vector<FullTextSearchResult> hits = m_fullTextSearchIndex.searchForTerm(searchTerm);
@@ -462,6 +473,13 @@ std::shared_ptr<TokenLocationCollection> PersistentStorage::getFullTextSearchLoc
} }
} }
MessageStatus(
std::to_string(collection->getTokenLocationCount()) + " results in " +
std::to_string(collection->getTokenLocationFileCount()) + " files for fulltext search (case-" +
(caseSensitive ? "sensitive" : "insensitive") + "): " + searchTerm,
false, false
).dispatch();
return collection; return collection;
} }
@@ -847,7 +865,8 @@ Id PersistentStorage::getTokenIdForFileNode(const FilePath& filePath) const
return m_sqliteStorage.getFileByPath(filePath.str()).id; return m_sqliteStorage.getFileByPath(filePath.str()).id;
} }
std::shared_ptr<TokenLocationCollection> PersistentStorage::getTokenLocationsForTokenIds(const std::vector<Id>& tokenIds) const std::shared_ptr<TokenLocationCollection> PersistentStorage::getTokenLocationsForTokenIds(
const std::vector<Id>& tokenIds) const
{ {
std::shared_ptr<TokenLocationCollection> collection = std::make_shared<TokenLocationCollection>(); std::shared_ptr<TokenLocationCollection> collection = std::make_shared<TokenLocationCollection>();