logic: rewrote messages handling token activation for correct restoring on undo
* saving search query to undo stack with MessageSearch * saving node and edge with name to undo stack with MessageActivateNode and MessageActivateEdge * added FeatureController that handels distribution of MessageActivateTokens * clearing views when refreshing or changing project * clearing undo stack when changing project * added StorageCache derived from StorageAccessProxy
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include "data/graph/token_component/TokenComponentAggregation.h"
|
||||
#include "data/graph/token_component/TokenComponentAccess.h"
|
||||
#include "utility/logging/logging.h"
|
||||
#include "utility/utilityString.h"
|
||||
|
||||
Edge::Edge(EdgeType type, Node* from, Node* to)
|
||||
: m_type(type)
|
||||
@@ -67,6 +68,24 @@ std::string Edge::getName() const
|
||||
return getTypeString() + ":" + getFrom()->getFullName() + "->" + getTo()->getFullName();
|
||||
}
|
||||
|
||||
void Edge::splitName(const std::string& name, EdgeType* type, std::string* fromName, std::string* toName)
|
||||
{
|
||||
EdgeTypeMask mask = 1;
|
||||
std::string typeStr = utility::substrBefore(name, ':');
|
||||
|
||||
while (typeStr != getTypeString(static_cast<EdgeType>(mask)))
|
||||
{
|
||||
mask = mask << 1;
|
||||
}
|
||||
|
||||
*type = static_cast<EdgeType>(mask);
|
||||
|
||||
std::string names = utility::substrAfter(name, ':');
|
||||
|
||||
*fromName = utility::substrBefore(names, '-');
|
||||
*toName = utility::substrAfter(utility::substrAfter(names, '-'), '>');
|
||||
}
|
||||
|
||||
bool Edge::isNode() const
|
||||
{
|
||||
return false;
|
||||
@@ -110,7 +129,7 @@ void Edge::addComponentAccess(std::shared_ptr<TokenComponentAccess> component)
|
||||
}
|
||||
}
|
||||
|
||||
std::string Edge::getTypeString(EdgeType type) const
|
||||
std::string Edge::getTypeString(EdgeType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
|
||||
@@ -48,6 +48,7 @@ public:
|
||||
Node* getTo() const;
|
||||
|
||||
std::string getName() const;
|
||||
static void splitName(const std::string& name, EdgeType* type, std::string* fromName, std::string* toName);
|
||||
|
||||
// Token implementation
|
||||
virtual bool isNode() const;
|
||||
@@ -58,7 +59,7 @@ public:
|
||||
void addComponentAccess(std::shared_ptr<TokenComponentAccess> component);
|
||||
|
||||
// Logging.
|
||||
std::string getTypeString(EdgeType type) const;
|
||||
static std::string getTypeString(EdgeType type);
|
||||
virtual std::string getTypeString() const;
|
||||
std::string getAsString() const;
|
||||
|
||||
|
||||
@@ -257,15 +257,27 @@ public:
|
||||
|
||||
virtual void apply(const FilterableGraph* in, FilterableGraph* out)
|
||||
{
|
||||
if (m_tokenIds.size())
|
||||
std::vector<Node*> nodes;
|
||||
|
||||
for (Id tokenId : m_tokenIds)
|
||||
{
|
||||
for (Id tokenId : m_tokenIds)
|
||||
Node* node = in->getNodeById(tokenId);
|
||||
if (node)
|
||||
{
|
||||
Node* node = in->getNodeById(tokenId);
|
||||
if (node)
|
||||
{
|
||||
out->addNode(node);
|
||||
}
|
||||
nodes.push_back(node);
|
||||
}
|
||||
else
|
||||
{
|
||||
nodes.clear();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (nodes.size())
|
||||
{
|
||||
for (Node* node : nodes)
|
||||
{
|
||||
out->addNode(node);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user