ui: Fixed activating history item from menu showed wrong symbol (issue #572)
* Refactored SearchMatch: removed delimiter, added tokenName * Refactored MessageActivateTokens: removed tokenNames * Restore from SearchMatches from NameHierarchies of tokens
This commit is contained in:
@@ -10,6 +10,11 @@ class MessageActivateTokens
|
||||
: public Message<MessageActivateTokens>
|
||||
{
|
||||
public:
|
||||
static const std::string getStaticType()
|
||||
{
|
||||
return "MessageActivateTokens";
|
||||
}
|
||||
|
||||
MessageActivateTokens(const MessageBase* other)
|
||||
: isEdge(false)
|
||||
, isAggregation(false)
|
||||
@@ -19,11 +24,6 @@ public:
|
||||
setKeepContent(other->keepContent());
|
||||
}
|
||||
|
||||
static const std::string getStaticType()
|
||||
{
|
||||
return "MessageActivateTokens";
|
||||
}
|
||||
|
||||
virtual void print(std::wostream& os) const
|
||||
{
|
||||
for (const Id& id : tokenIds)
|
||||
@@ -32,8 +32,17 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<NameHierarchy> getTokenNamesOfMatches() const
|
||||
{
|
||||
std::vector<NameHierarchy> tokenNames;
|
||||
for (const SearchMatch& match : searchMatches)
|
||||
{
|
||||
tokenNames.push_back(match.tokenName);
|
||||
}
|
||||
return tokenNames;
|
||||
}
|
||||
|
||||
std::vector<Id> tokenIds;
|
||||
std::vector<NameHierarchy> tokenNames;
|
||||
std::vector<SearchMatch> searchMatches;
|
||||
|
||||
bool isEdge;
|
||||
|
||||
@@ -10,43 +10,16 @@ class MessageSearch
|
||||
: public Message<MessageSearch>
|
||||
{
|
||||
public:
|
||||
MessageSearch(const std::vector<SearchMatch>& matches, NodeTypeSet acceptedNodeTypes = NodeTypeSet::all())
|
||||
: isFromSearch(true)
|
||||
, acceptedNodeTypes(acceptedNodeTypes)
|
||||
, m_matches(matches)
|
||||
{
|
||||
}
|
||||
|
||||
static const std::string getStaticType()
|
||||
{
|
||||
return "MessageSearch";
|
||||
}
|
||||
|
||||
std::wstring getMatchesAsString() const
|
||||
MessageSearch(const std::vector<SearchMatch>& matches, NodeTypeSet acceptedNodeTypes = NodeTypeSet::all())
|
||||
: isFromSearch(true)
|
||||
, acceptedNodeTypes(acceptedNodeTypes)
|
||||
, m_matches(matches)
|
||||
{
|
||||
std::wstringstream ss;
|
||||
|
||||
for (size_t i = 0; i < m_matches.size(); i++)
|
||||
{
|
||||
ss << '@';
|
||||
if (m_matches[i].nodeType.isFile())
|
||||
{
|
||||
ss << m_matches[i].subtext;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!m_matches[i].subtext.empty())
|
||||
{
|
||||
ss << m_matches[i].subtext << nameDelimiterTypeToString(m_matches[i].delimiter) << m_matches[i].text;
|
||||
}
|
||||
else
|
||||
{
|
||||
ss << m_matches[i].name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
const std::vector<SearchMatch>& getMatches() const
|
||||
@@ -70,9 +43,22 @@ public:
|
||||
return tokenIds;
|
||||
}
|
||||
|
||||
std::vector<NameHierarchy> getTokenNamesOfMatches() const
|
||||
{
|
||||
std::vector<NameHierarchy> tokenNames;
|
||||
for (const SearchMatch& match : m_matches)
|
||||
{
|
||||
tokenNames.push_back(match.tokenName);
|
||||
}
|
||||
return tokenNames;
|
||||
}
|
||||
|
||||
virtual void print(std::wostream& os) const
|
||||
{
|
||||
os << getMatchesAsString();
|
||||
for (const SearchMatch& match : m_matches)
|
||||
{
|
||||
os << " @" << match.name << "-" << match.tokenName.getQualifiedName();
|
||||
}
|
||||
}
|
||||
|
||||
bool isFromSearch;
|
||||
|
||||
Reference in New Issue
Block a user