data: refactored file clearing on reparse to use TaskClearStorage
This commit is contained in:
@@ -270,7 +270,7 @@ std::vector<CodeView::CodeSnippetParams> CodeController::getSnippetsForFile(std:
|
||||
m_storageAccess->getTokenLocationOfParentScope(firstUsedLine->getTokenLocations().begin()->second.get())->forEachStartTokenLocation(
|
||||
[&](TokenLocation* location)
|
||||
{
|
||||
params.title = m_storageAccess->getNameForNodeWithId(location->getTokenId());
|
||||
params.title = m_storageAccess->getNameHierarchyForNodeWithId(location->getTokenId()).getFullName();
|
||||
params.titleId = location->getId();
|
||||
}
|
||||
);
|
||||
|
||||
@@ -19,19 +19,8 @@ void FeatureController::handleMessage(MessageActivateEdge* message)
|
||||
{
|
||||
if (message->type == Edge::EDGE_AGGREGATION)
|
||||
{
|
||||
const std::string sourceStartDelimiter = ":";
|
||||
const std::string sourceEndDelimiter = "->";
|
||||
|
||||
const int sourceStartPosition = message->name.find(sourceStartDelimiter) + sourceStartDelimiter.size();
|
||||
const int sourceEndPosition = message->name.find(sourceEndDelimiter);
|
||||
const int targetStartPosition = sourceEndPosition + sourceEndDelimiter.size();
|
||||
const int targetEndPosition = message->name.size();
|
||||
|
||||
const std::string sourceName = message->name.substr(sourceStartPosition, sourceEndPosition - sourceStartPosition);
|
||||
const std::string targetName = message->name.substr(targetStartPosition, targetEndPosition - targetStartPosition);
|
||||
|
||||
const int sourceId = m_storageAccess->getIdForNodeWithName(sourceName);
|
||||
const int targetId = m_storageAccess->getIdForNodeWithName(targetName);
|
||||
const Id sourceId = m_storageAccess->getIdForNodeWithNameHierarchy(message->fromNameHierarchy);
|
||||
const Id targetId = m_storageAccess->getIdForNodeWithNameHierarchy(message->toNameHierarchy);
|
||||
|
||||
MessageActivateTokens m(m_storageAccess->getTokenIdsForAggregationEdge(sourceId, targetId));
|
||||
m.isAggregation = true;
|
||||
@@ -44,7 +33,7 @@ void FeatureController::handleMessage(MessageActivateEdge* message)
|
||||
|
||||
if (!message->isFresh())
|
||||
{
|
||||
edgeId = m_storageAccess->getIdForEdgeWithName(message->name);
|
||||
edgeId = m_storageAccess->getIdForEdge(message->type, message->fromNameHierarchy, message->toNameHierarchy);
|
||||
}
|
||||
|
||||
if (!edgeId)
|
||||
@@ -80,17 +69,18 @@ void FeatureController::handleMessage(MessageActivateNodes* message)
|
||||
{
|
||||
for (const MessageActivateNodes::ActiveNode& node : message->nodes)
|
||||
{
|
||||
nodeIds.push_back(m_storageAccess->getIdForNodeWithName(node.name));
|
||||
Id nodeId = m_storageAccess->getIdForNodeWithNameHierarchy(node.nameHierarchy);
|
||||
if (nodeId > 0)
|
||||
{
|
||||
nodeIds.push_back(nodeId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (nodeIds.size())
|
||||
{
|
||||
MessageActivateTokens m(nodeIds);
|
||||
m.isFromSystem = message->isFromSystem;
|
||||
m.undoRedoType = message->undoRedoType;
|
||||
m.dispatchImmediately();
|
||||
}
|
||||
MessageActivateTokens m(nodeIds);
|
||||
m.isFromSystem = message->isFromSystem;
|
||||
m.undoRedoType = message->undoRedoType;
|
||||
m.dispatchImmediately();
|
||||
}
|
||||
|
||||
void FeatureController::handleMessage(MessageActivateTokenLocations* message)
|
||||
@@ -104,7 +94,7 @@ void FeatureController::handleMessage(MessageActivateTokenLocations* message)
|
||||
msg.addNode(
|
||||
nodeId,
|
||||
m_storageAccess->getNodeTypeForNodeWithId(nodeId),
|
||||
m_storageAccess->getNameForNodeWithId(nodeId)
|
||||
m_storageAccess->getNameHierarchyForNodeWithId(nodeId)
|
||||
);
|
||||
}
|
||||
msg.dispatchImmediately();
|
||||
|
||||
@@ -43,6 +43,12 @@ void GraphController::handleMessage(MessageActivateTokens* message)
|
||||
m_activeEdgeIds.clear();
|
||||
}
|
||||
|
||||
if (!m_activeNodeIds.size() && !m_activeEdgeIds.size())
|
||||
{
|
||||
clear();
|
||||
return;
|
||||
}
|
||||
|
||||
createDummyGraphForTokenIds(utility::concat(m_activeNodeIds, m_activeEdgeIds));
|
||||
|
||||
buildGraph(message);
|
||||
@@ -133,6 +139,18 @@ GraphView* GraphController::getView() const
|
||||
return Controller::getView<GraphView>();
|
||||
}
|
||||
|
||||
void GraphController::clear()
|
||||
{
|
||||
m_dummyNodes.clear();
|
||||
m_dummyEdges.clear();
|
||||
|
||||
m_activeNodeIds.clear();
|
||||
m_activeEdgeIds.clear();
|
||||
|
||||
m_graph.reset();
|
||||
getView()->clear();
|
||||
}
|
||||
|
||||
void GraphController::createDummyGraphForTokenIds(const std::vector<Id>& tokenIds)
|
||||
{
|
||||
GraphView* view = getView();
|
||||
|
||||
@@ -48,6 +48,8 @@ private:
|
||||
|
||||
GraphView* getView() const;
|
||||
|
||||
void clear();
|
||||
|
||||
void createDummyGraphForTokenIds(const std::vector<Id>& tokenIds);
|
||||
DummyNode createDummyNodeTopDown(Node* node);
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ void SearchController::handleMessage(MessageActivateNodes* message)
|
||||
for (const MessageActivateNodes::ActiveNode& node : message->nodes)
|
||||
{
|
||||
SearchMatch match;
|
||||
match.fullName = node.name;
|
||||
match.fullName = node.nameHierarchy.getFullName();
|
||||
match.nodeType = node.type;
|
||||
match.tokenIds.insert(node.nodeId);
|
||||
match.searchType = SearchMatch::SEARCH_TOKEN;
|
||||
|
||||
@@ -28,7 +28,7 @@ UndoRedoController::Command::Command(std::shared_ptr<MessageBase> message, size_
|
||||
void UndoRedoController::handleMessage(MessageActivateEdge* message)
|
||||
{
|
||||
if (m_lastCommand.message && m_lastCommand.message->getType() == message->getType() &&
|
||||
static_cast<MessageActivateEdge*>(m_lastCommand.message.get())->name == message->name)
|
||||
static_cast<MessageActivateEdge*>(m_lastCommand.message.get())->getFullName() == message->getFullName())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -53,7 +53,8 @@ void UndoRedoController::handleMessage(MessageActivateNodes* message)
|
||||
{
|
||||
if (m_lastCommand.message && m_lastCommand.message->getType() == message->getType() && message->nodes.size() &&
|
||||
static_cast<MessageActivateNodes*>(m_lastCommand.message.get())->nodes.size() == message->nodes.size() &&
|
||||
static_cast<MessageActivateNodes*>(m_lastCommand.message.get())->nodes[0].name == message->nodes[0].name)
|
||||
static_cast<MessageActivateNodes*>(m_lastCommand.message.get())->nodes[0].nameHierarchy.getFullName() ==
|
||||
message->nodes[0].nameHierarchy.getFullName())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user