logic: search bar duplicates

* When a location is clicked in the code that has more than one TokenLocations pointing to the same element, only one instance of the element is displayed in the search bar.
This commit is contained in:
malte_langkabel
2016-02-22 14:17:53 +01:00
parent fc1a43c1a5
commit e054df2e71
3 changed files with 20 additions and 10 deletions
+4 -4
View File
@@ -881,7 +881,7 @@ std::vector<Id> Storage::getActiveTokenIdsForId(Id tokenId, Id* declarationId) c
std::vector<Id> Storage::getNodeIdsForLocationIds(const std::vector<Id>& locationIds) const
{
std::vector<Id> nodeIds;
std::set<Id> nodeIds;
for (Id locationId : locationIds)
{
@@ -890,15 +890,15 @@ std::vector<Id> Storage::getNodeIdsForLocationIds(const std::vector<Id>& locatio
StorageEdge edge = m_sqliteStorage.getEdgeById(elementId);
if (edge.id != 0) // here we test if location is an edge.
{
nodeIds.push_back(edge.targetNodeId);
nodeIds.insert(edge.targetNodeId);
}
else
{
nodeIds.push_back(elementId);
nodeIds.insert(elementId);
}
}
return nodeIds;
return utility::toVector(nodeIds);
}
std::vector<Id> Storage::getTokenIdsForMatches(const std::vector<SearchMatch>& matches) const