Compare commits

...
6 Commits
Author SHA1 Message Date
Eberhard Graether b0d03d9c8d docs: Updates for release 2020.2
closes #1047
2020-06-29 19:41:47 +02:00
Eberhard GrätherandGitHub 3950da7999 src: Rename aggregation edge to bundled edges (#1051)
The term aggregation is misleading. Bundled edges is a better definition for this type of edge.

closes #962
2020-06-29 19:41:12 +02:00
Malte LangkabelandGitHub 7008d2abdd logic: fix error recording for multi-threaded custom command indexing (issue #1043) (#1049)
In multi-threaded custom command indexing errors were read from the wrong storage.
2020-06-29 19:25:26 +02:00
Eberhard GrätherandGitHub 27558c42bb ui: Fixed crash when changing tabs during animation (#1046)
Changing tabs during animation triggers a hover leave event on the focused node, which moves the focus to the parent node if available. This parent node however is still the old node, and deleted after the graph transition animation finishes, which leaves a dangling pointer.

closes #1021
2020-06-29 01:05:53 +02:00
Eberhard Graether 673e26e290 res: Fixed Changelog markdown 2020-06-11 09:25:42 +02:00
Eberhard Graether 44bd0aad01 res: Changelog for release 2020.2 (beta) 2020-06-09 00:00:49 +02:00
36 changed files with 323 additions and 237 deletions
+22
View File
@@ -1,5 +1,27 @@
### Changelog
#### 2020.2.37 (Beta)
released 2020-06-08
* C/C++: Improved help message for source file extensions in project settings ([#1039](https://github.com/CoatiSoftware/Sourcetrail/issues/1039))
* Python: Updated to SourcetrailPythonIndexer v1.db25.p4 - Record override edges ([#1037](https://github.com/CoatiSoftware/Sourcetrail/issues/1037))
* Linux: Migrated Linux '.tar.gz' package creation from CPack to linuxdeployqt ([#1034](https://github.com/CoatiSoftware/Sourcetrail/issues/1034))
* UI: Save last filepicker location ([#802](https://github.com/CoatiSoftware/Sourcetrail/issues/802))
* C/C++: Updated to LLVM/Clang 10.0.0 ([#965](https://github.com/CoatiSoftware/Sourcetrail/issues/965))
* Java: Updated macOS Java Path detector and docs to current JDK file structure ([#1031](https://github.com/CoatiSoftware/Sourcetrail/issues/1031))
* Improved performance of excluded files and directories filtering ([#1030](https://github.com/CoatiSoftware/Sourcetrail/issues/1030))
* Fix corrupted display of non-ascii characters in about window ([#1013](https://github.com/CoatiSoftware/Sourcetrail/issues/1013))
* C/C++: Copy Clang compiler headers from Clang build dir via CMake ([#993](https://github.com/CoatiSoftware/Sourcetrail/issues/993))
* Improved error logging if exception occurred while loading project ([#1004](https://github.com/CoatiSoftware/Sourcetrail/issues/1004))
* Graph: Add context menu action 'copy to clipboard' ([#999](https://github.com/CoatiSoftware/Sourcetrail/issues/999))
* C/C++: Extend Compiler Flags help message ([#974](https://github.com/CoatiSoftware/Sourcetrail/issues/974))
* macOS: Create .dmg release package using HFS+ filesystem to be mountable on older macOS versions ([#619](https://github.com/CoatiSoftware/Sourcetrail/issues/619))
* Python: Respect "super()" in post processing ([#964](https://github.com/CoatiSoftware/Sourcetrail/issues/964))
* Less restrictions for FilePath::isValid check on project location ([#959](https://github.com/CoatiSoftware/Sourcetrail/issues/959))
* Refactored recent projects menu ([#956](https://github.com/CoatiSoftware/Sourcetrail/issues/956))
* macOs: Updated Info.plist missing values and removed deprecated keys
* Python: Respect class qualifier in method call for post processing ([#951](https://github.com/CoatiSoftware/Sourcetrail/issues/951))
#### 2020.1.117
released 2020-03-31
+1 -1
View File
@@ -234,7 +234,7 @@
<include></include>
<macro_use></macro_use>
<aggregation></aggregation>
<bundled_edges></bundled_edges>
</edge>
</graph>
+1 -1
View File
@@ -499,7 +499,7 @@
<macro_use>#4E82F6</macro_use>
<annotation_use>#4E82F6</annotation_use>
<aggregation>#666666</aggregation>
<bundled_edges>#666666</bundled_edges>
</edge>
</graph>
+1 -1
View File
@@ -467,7 +467,7 @@
<macro_use>#719660</macro_use>
<annotation_use>#719660</annotation_use>
<aggregation>#CCC</aggregation>
<bundled_edges>#CCC</bundled_edges>
</edge>
</graph>
+1 -1
View File
@@ -470,7 +470,7 @@
<macro_use>#247368</macro_use>
<annotation_use>#247368</annotation_use>
<aggregation>#4D4D4D</aggregation>
<bundled_edges>#4D4D4D</bundled_edges>
</edge>
</graph>

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

+18 -9
View File
@@ -76,7 +76,7 @@
</div>
</div>
<div class="row" style="text-align:center; margin-top: 10px;">
<p>Documentation for version 2020.1</p>
<p>Documentation for version 2020.2</p>
</div>
<div class="row" style="height:20px;"></div>
@@ -105,10 +105,10 @@
<h2>Supported Languages</h2>
<h3>C</h3>
<p>C support is powered by <a href="https://clang.llvm.org/" target="_blank">Clang 8.0.1</a>. For issues loading C code, please have a look at <a href="https://clang.llvm.org/compatibility.html" target="_blank">Clang language compatibility</a> or report a bug in our <a href="https://github.com/CoatiSoftware/SourcetrailBugTracker">bug tracker</a>.</p>
<p>C support is powered by <a href="https://clang.llvm.org/" target="_blank">Clang 10.0.0</a>. For issues loading C code, please have a look at <a href="https://clang.llvm.org/compatibility.html" target="_blank">Clang language compatibility</a> or report a bug in our <a href="https://github.com/CoatiSoftware/SourcetrailBugTracker">bug tracker</a>.</p>
<h3>C++</h3>
<p>C++ support is powered by <a href="https://clang.llvm.org/" target="_blank">Clang 8.0.1</a>. For more Information please visit <a href="https://clang.llvm.org/cxx_status.html" target="_blank">Clang C++ Status</a>. For issues loading C++ code, please have a look at <a href="https://clang.llvm.org/compatibility.html" target="_blank">Clang language compatibility</a> or report a bug in our <a href="https://github.com/CoatiSoftware/SourcetrailBugTracker">bug tracker</a>.</p>
<p>C++ support is powered by <a href="https://clang.llvm.org/" target="_blank">Clang 10.0.0</a>. For more Information please visit <a href="https://clang.llvm.org/cxx_status.html" target="_blank">Clang C++ Status</a>. For issues loading C++ code, please have a look at <a href="https://clang.llvm.org/compatibility.html" target="_blank">Clang language compatibility</a> or report a bug in our <a href="https://github.com/CoatiSoftware/SourcetrailBugTracker">bug tracker</a>.</p>
<h3>Java</h3>
<p>Sourcetrail includes support for Java 10 and lower which is powered by <a href="https://github.com/eclipse/eclipse.jdt.core" target="_blank">Eclipse JDT</a>. If you encounter any issues while using Sourcetrail on a Java project, please let us know by providing a minimal example in our <a href="https://github.com/CoatiSoftware/SourcetrailBugTracker">bug tracker</a>.</p>
@@ -354,7 +354,7 @@
<ul>
<li><strong>Nodes:</strong> All named symbols in your source code will be displayed as different <a href="#Nodes">nodes</a>, such as <var>functions</var>, <var>classes</var> or <var>files</var>. Nodes with members (like <var>classes</var>) can be expanded to show all their contents, the number at the expansion arrow shows how many members are hidden. Clicking a node will activate it and update all the views to the new selection. Dragging a node can be used to change its position.</li>
<li><strong>Edges:</strong> The relationships between the symbols are displayed as different <a href="#Edges">edges</a>, such as <var>type use</var>, <var>function call</var> or <var>file include</var>. Sometimes edges get bundled together and are displayed as an <var>aggregation</var> edge that shows a number of how many edges it contains. Clicking an edge will highlight its source location in the code view.</li>
<li><strong>Edges:</strong> The relationships between the symbols are displayed as different <a href="#Edges">edges</a>, such as <var>type use</var>, <var>function call</var> or <var>file include</var>. Sometimes edges get bundled together and are displayed as <var>bundled edges</var> that show a number of how many edges are contained. Clicking an edge will highlight its source location in the code view.</li>
</ul>
<div class="row">
@@ -462,7 +462,11 @@
<h3>Tarball</h3>
<p>Download the <code>.tar.gz</code> file and extract it. To start Sourcetrail run the <code>Sourcetrail.sh</code> script. Sourcetrail creates a folder <code>~/.config/sourcetrail</code> at the first run, this is the folder for Sourcetrail settings.</p>
<p>To Install Sourcetrail run the <code>install.sh</code> script with <code>sudo</code>, it will install Sourcetrail to <code>/opt/sourcetrail</code> and create <code>/usr/bin/sourcetrail</code> symlink.</p>
<h4>Install</h4>
<p>To install Sourcetrail run the <code>install.sh</code> script with <code>sudo</code>. It will install Sourcetrail to <code>/opt/sourcetrail</code> and create the <code>/usr/bin/sourcetrail</code> symlink.</p>
<h4>Uninstall</h4>
<p>To uninstall Sourcetrail run the <code>/opt/sourcetrail/uninstall.sh</code> script with <code>sudo</code>.</p>
<h3>AppImage</h3>
<p>Download the <code>.AppImage</code> file. Give it permission to execute with <code>chmod a+x</code> or via the context menu. To start Sourcetrail double click it or execute it from the Terminal. Sourcetrail creates a folder <code>~/.config/sourcetrail</code> at the first run, this is the folder for Sourcetrail settings.</p>
@@ -1509,13 +1513,18 @@
<strong>Context Menu:</strong>
<ul>
<li><b>Save As Image:</b> Export current graph as image file. Possible formats are <code>PNG</code>, <code>JPEG</code>, <code>BMP</code> and <code>SVG</code>.</li>
<li><b>Open in New Tab:</b> Opens a new Tab with the node under the mouse cursor as active symbol.</li>
<li><b>Back:</b> Go back in history.</li>
<li><b>Forward:</b> Go forward in history.</li>
<li><b>Show Definition:</b> Show the definition of the node under the mouse cursor in the <a href="#CodeView">Code View</a>.</li>
<li><b>Show Definition in IDE:</b> Show the definition of the node under the mouse cursor using the connected <a href="#CodeEditorPlugins">Code Editor Plugin</a>.</li>
<li><b>Expand Node:</b> Expand node under mouse cursor.</li>
<li><b>Collapse Node:</b> Collapse node under mouse cursor.</li>
<li><b>Show Definition:</b> Show the definition of the node under the mouse cursor in the <a href="#CodeView">Code View</a>.</li>
<li><b>Hide Node:</b> Hide node under mouse cursor.</li>
<li><b>Hide Edge:</b> Hide edge under mouse cursor.</li>
<li><b>Bookmark Node:</b> Create a bookmark for node under mouse cursor.</li>
<li><b>Save As Image:</b> Export current graph as image file. Possible formats are <code>PNG</code>, <code>JPEG</code>, <code>BMP</code> and <code>SVG</code>.</li>
<li><b>Save To Clipboard:</b> Save current graph as <code>PNG</code> image to clipboard.</li>
<li><b>Copy Name:</b> Copy name for node under mouse cursor to clipboard.</li>
<li><b>Copy Full Path:</b> Copy file path for file node under mouse cursor to clipboard.</li>
<li><b>Open Containing Folder:</b> Show the file in your file explorer for file node under mouse cursor.</li>
@@ -1565,13 +1574,13 @@
<tr> <th scope="row">Method Override</th> <td><img src="img/edge_override.png" style="height:240px;"></td> </tr>
<tr> <th scope="row">Template Specialization & Template Argument Use</th> <td><img src="img/edge_template_param.png" style="height:100px;"></td> </tr>
<tr> <th scope="row">Template Member Specialization</th> <td><img src="img/edge_template_member_specialization.png" style="height:160px;"></td> </tr>
<tr> <th scope="row">Aggregation: <span style="font-weight:normal">Bundles multiple edges between the child nodes of the 2 nodes. The thickness gives an impression of how many edges are bundled. Hover the edge to get the number of bundled edges.</span></th> <td><img src="img/edge_aggregation.png" style="height:50px;"></td> </tr>
<tr> <th scope="row">Bundled Edges: <span style="font-weight:normal">Bundles multiple edges between the child nodes of the 2 nodes. The thickness gives an impression of how many edges are bundled. Hover the edge to get the number of bundled edges.</span></th> <td><img src="img/edge_bundled_edges.png" style="height:50px;"></td> </tr>
</tbody>
</table>
<strong>Interactions:</strong>
<ul>
<li>Click an edge to see its location in the <a href="#CodeView">Code View</a>.</li>
<li>Click an aggregation edge to activate all its corresponding edges.</li>
<li>Click a bundled edges to activate all its corresponding edges.</li>
<li>Hover an edge to see a tooltip that displays the edges type.</li>
</ul>
+2 -2
View File
@@ -147,8 +147,8 @@ add_files(
data/graph/token_component/TokenComponentAbstraction.h
data/graph/token_component/TokenComponentAccess.cpp
data/graph/token_component/TokenComponentAccess.h
data/graph/token_component/TokenComponentAggregation.cpp
data/graph/token_component/TokenComponentAggregation.h
data/graph/token_component/TokenComponentBundledEdges.cpp
data/graph/token_component/TokenComponentBundledEdges.h
data/graph/token_component/TokenComponentConst.cpp
data/graph/token_component/TokenComponentConst.h
data/graph/token_component/TokenComponentFilePath.cpp
@@ -24,12 +24,12 @@ void ActivationController::clear() {}
void ActivationController::handleMessage(MessageActivateEdge* message)
{
if (message->isAggregation())
if (message->isBundledEdges())
{
MessageActivateTokens m(message);
m.tokenIds = message->aggregationIds;
m.tokenIds = message->bundledEdgesIds;
m.setKeepContent(false);
m.isAggregation = true;
m.isBundledEdges = true;
m.dispatchImmediately();
}
else
@@ -209,10 +209,10 @@ void BookmarkController::activateBookmark(const std::shared_ptr<Bookmark> bookma
else
{
MessageActivateEdge activateEdge(
0, Edge::EdgeType::EDGE_AGGREGATION, sourceName, targetName);
for (const Id aggregatedEdgeId: edgeBookmark->getEdgeIds())
0, Edge::EdgeType::EDGE_BUNDLED_EDGES, sourceName, targetName);
for (const Id bundledEdgeId: edgeBookmark->getEdgeIds())
{
activateEdge.aggregationIds.push_back(aggregatedEdgeId);
activateEdge.bundledEdgesIds.push_back(bundledEdgeId);
}
activateEdge.dispatch();
}
@@ -318,7 +318,7 @@ void BookmarkController::handleMessage(MessageActivateTokens* message)
Id tabId = message->getSchedulerId();
m_activeEdgeIds[tabId].clear();
if (message->isEdge || message->isAggregation)
if (message->isEdge || message->isBundledEdges)
{
m_activeEdgeIds[tabId] = message->tokenIds;
@@ -199,7 +199,7 @@ void CodeController::handleMessage(MessageActivateTokens* message)
params.clearSnippets = true;
Id declarationId = 0; // 0 means that no token is found.
if (!message->isAggregation)
if (!message->isBundledEdges)
{
std::vector<Id> activeTokenIds;
for (Id tokenId: params.activeTokenIds)
@@ -98,7 +98,7 @@ void GraphController::handleMessage(MessageActivateTokens* message)
if (message->isEdge || message->keepContent())
{
m_activeEdgeIds = message->tokenIds;
if (message->isAggregation) // only on redo
if (message->isBundledEdges) // only on redo
{
m_activeEdgeIds.clear();
}
@@ -119,7 +119,7 @@ void GraphController::handleMessage(MessageActivateTokens* message)
getView()->activateEdge(edgeId);
return;
}
else if (message->isAggregation)
else if (message->isBundledEdges)
{
m_activeNodeIds.clear();
m_activeEdgeIds = message->tokenIds;
@@ -166,7 +166,7 @@ void GraphController::handleMessage(MessageActivateTokens* message)
{
bundleNodes();
}
else if (message->isAggregation)
else if (message->isBundledEdges)
{
bool isInheritanceChain = true;
for (const auto& edge: m_dummyEdges)
@@ -489,22 +489,22 @@ void GraphController::handleMessage(MessageGraphNodeExpand* message)
{
std::shared_ptr<DummyEdge> edge = m_dummyEdges[i];
if (edge && edge->data && edge->data->isType(Edge::EDGE_AGGREGATION) &&
if (edge && edge->data && edge->data->isType(Edge::EDGE_BUNDLED_EDGES) &&
(edge->targetId == dummyNode->tokenId || edge->ownerId == dummyNode->tokenId))
{
std::vector<Id> aggregationIds = utility::toVector<Id>(
edge->data->getComponent<TokenComponentAggregation>()->getAggregationIds());
std::vector<Id> bundledEdgesIds = utility::toVector<Id>(
edge->data->getComponent<TokenComponentBundledEdges>()->getBundledEdgesIds());
if (m_graph->getEdgeById(aggregationIds[0]) != nullptr)
if (m_graph->getEdgeById(bundledEdgesIds[0]) != nullptr)
{
break;
}
std::shared_ptr<Graph> aggregationGraph =
std::shared_ptr<Graph> bundledEdgesGraph =
m_storageAccess->getGraphForActiveTokenIds(
aggregationIds, std::vector<Id>());
bundledEdgesIds, std::vector<Id>());
aggregationGraph->forEachEdge([this](Edge* e) {
bundledEdgesGraph->forEachEdge([this](Edge* e) {
if (!e->isType(Edge::EDGE_MEMBER))
{
m_dummyEdges.push_back(std::make_shared<DummyEdge>(
@@ -1085,25 +1085,25 @@ void GraphController::bundleNodes()
bundleInfo->isReferencing = false;
}
if (e->isType(Edge::EDGE_AGGREGATION))
if (e->isType(Edge::EDGE_BUNDLED_EDGES))
{
TokenComponentAggregation::Direction dir =
e->getComponent<TokenComponentAggregation>()->getDirection();
TokenComponentBundledEdges::Direction dir =
e->getComponent<TokenComponentBundledEdges>()->getDirection();
if (dir == TokenComponentAggregation::DIRECTION_NONE)
if (dir == TokenComponentBundledEdges::DIRECTION_NONE)
{
bundleInfo->isReferenced = true;
bundleInfo->isReferencing = true;
}
else if (
(dir == TokenComponentAggregation::DIRECTION_FORWARD && e->getFrom() == n) ||
(dir == TokenComponentAggregation::DIRECTION_BACKWARD && e->getTo() == n))
(dir == TokenComponentBundledEdges::DIRECTION_FORWARD && e->getFrom() == n) ||
(dir == TokenComponentBundledEdges::DIRECTION_BACKWARD && e->getTo() == n))
{
bundleInfo->isReferencing = true;
}
else if (
(dir == TokenComponentAggregation::DIRECTION_FORWARD && e->getTo() == n) ||
(dir == TokenComponentAggregation::DIRECTION_BACKWARD && e->getFrom() == n))
(dir == TokenComponentBundledEdges::DIRECTION_FORWARD && e->getTo() == n) ||
(dir == TokenComponentBundledEdges::DIRECTION_BACKWARD && e->getFrom() == n))
{
bundleInfo->isReferenced = true;
}
@@ -2041,7 +2041,7 @@ Vec4i GraphController::layoutNestingRecursive(DummyNode* node, int relayoutAcces
break;
case GroupLayout::BUCKET:
if (node->hasActiveSubNode() || !m_activeNodeIds.size() /* aggregations */)
if (node->hasActiveSubNode() || !m_activeNodeIds.size() /* bundled edges */)
{
BucketLayouter grid(viewSize);
grid.createBuckets(node->subNodes, m_dummyEdges);
@@ -2446,25 +2446,25 @@ void GraphController::createLegendGraph()
addEdge(Edge::EDGE_INHERITANCE, derived, main);
{
Edge* edge = addEdge(Edge::EDGE_AGGREGATION, user, main);
std::shared_ptr<TokenComponentAggregation> aggregationComp =
std::make_shared<TokenComponentAggregation>();
Edge* edge = addEdge(Edge::EDGE_BUNDLED_EDGES, user, main);
std::shared_ptr<TokenComponentBundledEdges> bundledEdgesComp =
std::make_shared<TokenComponentBundledEdges>();
for (size_t i = 0; i < 10; i++)
{
aggregationComp->addAggregationId(++id, true);
bundledEdgesComp->addBundledEdgesId(++id, true);
}
edge->addComponent(aggregationComp);
edge->addComponent(bundledEdgesComp);
}
{
Edge* edge = addEdge(Edge::EDGE_AGGREGATION, main, usee);
std::shared_ptr<TokenComponentAggregation> aggregationComp =
std::make_shared<TokenComponentAggregation>();
Edge* edge = addEdge(Edge::EDGE_BUNDLED_EDGES, main, usee);
std::shared_ptr<TokenComponentBundledEdges> bundledEdgesComp =
std::make_shared<TokenComponentBundledEdges>();
for (size_t i = 0; i < 10; i++)
{
aggregationComp->addAggregationId(++id, true);
bundledEdgesComp->addBundledEdgesId(++id, true);
}
edge->addComponent(aggregationComp);
edge->addComponent(bundledEdgesComp);
}
Node* publicMethod = addNode(NODE_METHOD, L"public method", Vec2i());
@@ -2622,17 +2622,17 @@ void GraphController::createLegendGraph()
}
{
addText(L"aggregation", 0, Vec2i(x, y + dy * ++i));
addText(L"bundled edges", 0, Vec2i(x, y + dy * ++i));
Node* typeA = addNode(NODE_TYPE, L"Type A", Vec2i(x, y + dy * ++i));
Node* typeB = addNode(NODE_TYPE, L"Type B", Vec2i(x + dx, y + dy * i));
Edge* edge = addEdge(Edge::EDGE_AGGREGATION, typeA, typeB);
std::shared_ptr<TokenComponentAggregation> aggregationComp =
std::make_shared<TokenComponentAggregation>();
Edge* edge = addEdge(Edge::EDGE_BUNDLED_EDGES, typeA, typeB);
std::shared_ptr<TokenComponentBundledEdges> bundledEdgesComp =
std::make_shared<TokenComponentBundledEdges>();
for (size_t i = 0; i < 10; i++)
{
aggregationComp->addAggregationId(++id, true);
bundledEdgesComp->addBundledEdgesId(++id, true);
}
edge->addComponent(aggregationComp);
edge->addComponent(bundledEdgesComp);
}
{
@@ -349,7 +349,7 @@ void UndoRedoController::handleMessage(MessageIndexingFinished* message)
MessageActivateTokens* msg = dynamic_cast<MessageActivateTokens*>(command.message.get());
if (msg)
{
if (msg->isAggregation)
if (msg->isBundledEdges)
{
continue;
}
@@ -498,7 +498,7 @@ void UndoRedoController::replayCommand(std::list<Command>::iterator it)
{
MessageActivateTokens* msg = dynamic_cast<MessageActivateTokens*>(m.get());
if (!msg->isEdge && !msg->isAggregation)
if (!msg->isEdge && !msg->isBundledEdges)
{
std::vector<SearchMatch> matches = msg->getSearchMatches();
msg->searchMatches.clear();
@@ -310,9 +310,9 @@ void BucketLayouter::createBuckets(
}
}
else if (
edge->getDirection() == TokenComponentAggregation::DIRECTION_BACKWARD ||
edge->getDirection() == TokenComponentBundledEdges::DIRECTION_BACKWARD ||
// put nodes with bidirectional edges on the left
(edge->getDirection() == TokenComponentAggregation::DIRECTION_NONE &&
(edge->getDirection() == TokenComponentBundledEdges::DIRECTION_NONE &&
!target->bundleInfo.isReferencing && !target->bundleInfo.isReferenced))
{
std::swap(owner, target);
+14 -14
View File
@@ -5,7 +5,7 @@
#include "types.h"
#include "Edge.h"
#include "TokenComponentAggregation.h"
#include "TokenComponentBundledEdges.h"
class Edge;
@@ -21,7 +21,7 @@ struct DummyEdge
, active(false)
, layoutHorizontal(true)
, weight(0)
, direction(TokenComponentAggregation::DIRECTION_INVALID)
, direction(TokenComponentBundledEdges::DIRECTION_INVALID)
{
}
@@ -34,7 +34,7 @@ struct DummyEdge
, active(false)
, layoutHorizontal(true)
, weight(0)
, direction(TokenComponentAggregation::DIRECTION_INVALID)
, direction(TokenComponentBundledEdges::DIRECTION_INVALID)
{
}
@@ -44,43 +44,43 @@ struct DummyEdge
{
return weight;
}
else if (data->isType(Edge::EDGE_AGGREGATION))
else if (data->isType(Edge::EDGE_BUNDLED_EDGES))
{
return data->getComponent<TokenComponentAggregation>()->getAggregationCount();
return data->getComponent<TokenComponentBundledEdges>()->getBundledEdgesCount();
}
return 1;
}
void updateDirection(TokenComponentAggregation::Direction dir, bool invert)
void updateDirection(TokenComponentBundledEdges::Direction dir, bool invert)
{
if (invert)
{
dir = TokenComponentAggregation::opposite(dir);
dir = TokenComponentBundledEdges::opposite(dir);
}
if (direction == TokenComponentAggregation::DIRECTION_INVALID)
if (direction == TokenComponentBundledEdges::DIRECTION_INVALID)
{
direction = dir;
}
else if (direction != dir)
{
direction = TokenComponentAggregation::DIRECTION_NONE;
direction = TokenComponentBundledEdges::DIRECTION_NONE;
}
}
TokenComponentAggregation::Direction getDirection() const
TokenComponentBundledEdges::Direction getDirection() const
{
if (!data)
{
return direction;
}
else if (data->isType(Edge::EDGE_AGGREGATION))
else if (data->isType(Edge::EDGE_BUNDLED_EDGES))
{
return data->getComponent<TokenComponentAggregation>()->getDirection();
return data->getComponent<TokenComponentBundledEdges>()->getDirection();
}
return TokenComponentAggregation::DIRECTION_FORWARD;
return TokenComponentBundledEdges::DIRECTION_FORWARD;
}
Id ownerId;
@@ -98,7 +98,7 @@ struct DummyEdge
// BundleEdge
int weight;
TokenComponentAggregation::Direction direction;
TokenComponentBundledEdges::Direction direction;
};
#endif // DUMMY_EDGE_H
+1 -1
View File
@@ -671,7 +671,7 @@ GraphViewStyle::EdgeStyle GraphViewStyle::getStyleForEdgeType(
switch (type)
{
case Edge::EDGE_AGGREGATION:
case Edge::EDGE_BUNDLED_EDGES:
style.width = 3;
style.arrowLength = 7;
style.arrowWidth = 10;
+8 -8
View File
@@ -3,7 +3,7 @@
#include <sstream>
#include "Node.h"
#include "TokenComponentAggregation.h"
#include "TokenComponentBundledEdges.h"
#include "logging.h"
#include "utilityString.h"
@@ -36,8 +36,8 @@ Edge::EdgeType Edge::intToType(int value)
return EDGE_INCLUDE;
case EDGE_IMPORT:
return EDGE_IMPORT;
case EDGE_AGGREGATION:
return EDGE_AGGREGATION;
case EDGE_BUNDLED_EDGES:
return EDGE_BUNDLED_EDGES;
case EDGE_MACRO_USAGE:
return EDGE_MACRO_USAGE;
case EDGE_ANNOTATION_USAGE:
@@ -139,8 +139,8 @@ std::wstring Edge::getReadableTypeString(EdgeType type)
return L"include";
case EDGE_IMPORT:
return L"import";
case EDGE_AGGREGATION:
return L"aggregation";
case EDGE_BUNDLED_EDGES:
return L"bundled edges";
case EDGE_MACRO_USAGE:
return L"macro use";
case EDGE_ANNOTATION_USAGE:
@@ -175,10 +175,10 @@ std::wstring Edge::getAsString() const
str << L"[" << getId() << L"] " << getReadableTypeString();
str << L": \"" << m_from->getName() << L"\" -> \"" + m_to->getName() << L"\"";
TokenComponentAggregation* aggregation = getComponent<TokenComponentAggregation>();
if (aggregation)
TokenComponentBundledEdges* bundledEdges = getComponent<TokenComponentBundledEdges>();
if (bundledEdges)
{
str << L" " << aggregation->getAggregationCount();
str << L" " << bundledEdges->getBundledEdgesCount();
}
return str.str();
+1 -1
View File
@@ -25,7 +25,7 @@ public:
EDGE_TEMPLATE_SPECIALIZATION = 1 << 7,
EDGE_INCLUDE = 1 << 8,
EDGE_IMPORT = 1 << 9,
EDGE_AGGREGATION = 1 << 10,
EDGE_BUNDLED_EDGES = 1 << 10,
EDGE_MACRO_USAGE = 1 << 11,
EDGE_ANNOTATION_USAGE = 1 << 12,
@@ -1,42 +0,0 @@
#ifndef TOKEN_COMPONENT_AGGREGATION_H
#define TOKEN_COMPONENT_AGGREGATION_H
#include <map>
#include <set>
#include "types.h"
#include "TokenComponent.h"
class TokenComponentAggregation: public TokenComponent
{
public:
enum Direction
{
DIRECTION_NONE,
DIRECTION_FORWARD,
DIRECTION_BACKWARD,
DIRECTION_INVALID
};
static Direction opposite(Direction direction);
TokenComponentAggregation();
virtual ~TokenComponentAggregation();
virtual std::shared_ptr<TokenComponent> copy() const;
int getAggregationCount() const;
std::set<Id> getAggregationIds() const;
void addAggregationId(Id id, bool forward);
void removeAggregationId(Id id);
Direction getDirection();
private:
std::map<Id, Direction> m_ids;
Direction m_direction;
};
#endif // TOKEN_COMPONENT_AGGREGATION_H
@@ -1,6 +1,6 @@
#include "TokenComponentAggregation.h"
#include "TokenComponentBundledEdges.h"
TokenComponentAggregation::Direction TokenComponentAggregation::opposite(Direction direction)
TokenComponentBundledEdges::Direction TokenComponentBundledEdges::opposite(Direction direction)
{
if (direction == DIRECTION_FORWARD)
{
@@ -14,21 +14,21 @@ TokenComponentAggregation::Direction TokenComponentAggregation::opposite(Directi
return direction;
}
TokenComponentAggregation::TokenComponentAggregation(): m_direction(DIRECTION_INVALID) {}
TokenComponentBundledEdges::TokenComponentBundledEdges(): m_direction(DIRECTION_INVALID) {}
TokenComponentAggregation::~TokenComponentAggregation() {}
TokenComponentBundledEdges::~TokenComponentBundledEdges() {}
std::shared_ptr<TokenComponent> TokenComponentAggregation::copy() const
std::shared_ptr<TokenComponent> TokenComponentBundledEdges::copy() const
{
return std::make_shared<TokenComponentAggregation>(*this);
return std::make_shared<TokenComponentBundledEdges>(*this);
}
int TokenComponentAggregation::getAggregationCount() const
int TokenComponentBundledEdges::getBundledEdgesCount() const
{
return static_cast<int>(m_ids.size());
}
std::set<Id> TokenComponentAggregation::getAggregationIds() const
std::set<Id> TokenComponentBundledEdges::getBundledEdgesIds() const
{
std::set<Id> ids;
@@ -40,21 +40,21 @@ std::set<Id> TokenComponentAggregation::getAggregationIds() const
return ids;
}
void TokenComponentAggregation::addAggregationId(Id id, bool forward)
void TokenComponentBundledEdges::addBundledEdgesId(Id id, bool forward)
{
m_ids.emplace(id, forward ? DIRECTION_FORWARD : DIRECTION_BACKWARD);
m_direction = DIRECTION_INVALID;
}
void TokenComponentAggregation::removeAggregationId(Id id)
void TokenComponentBundledEdges::removeBundledEdgesId(Id id)
{
m_ids.erase(id);
m_direction = DIRECTION_INVALID;
}
TokenComponentAggregation::Direction TokenComponentAggregation::getDirection()
TokenComponentBundledEdges::Direction TokenComponentBundledEdges::getDirection()
{
if (m_direction != DIRECTION_INVALID)
{
@@ -0,0 +1,42 @@
#ifndef TOKEN_COMPONENT_BUNDLED_EDGES_H
#define TOKEN_COMPONENT_BUNDLED_EDGES_H
#include <map>
#include <set>
#include "types.h"
#include "TokenComponent.h"
class TokenComponentBundledEdges: public TokenComponent
{
public:
enum Direction
{
DIRECTION_NONE,
DIRECTION_FORWARD,
DIRECTION_BACKWARD,
DIRECTION_INVALID
};
static Direction opposite(Direction direction);
TokenComponentBundledEdges();
virtual ~TokenComponentBundledEdges();
virtual std::shared_ptr<TokenComponent> copy() const;
int getBundledEdgesCount() const;
std::set<Id> getBundledEdgesIds() const;
void addBundledEdgesId(Id id, bool forward);
void removeBundledEdgesId(Id id);
Direction getDirection();
private:
std::map<Id, Direction> m_ids;
Direction m_direction;
};
#endif // TOKEN_COMPONENT_BUNDLED_EDGES_H
@@ -7,6 +7,8 @@
#include "FileSystem.h"
#include "IndexerCommandCustom.h"
#include "IndexerCommandProvider.h"
#include "MessageErrorCountClear.h"
#include "MessageErrorCountUpdate.h"
#include "MessageIndexingStatus.h"
#include "MessageShowStatus.h"
#include "MessageStatus.h"
@@ -320,7 +322,7 @@ Task::TaskState TaskExecuteCustomCommands::doUpdate(std::shared_ptr<Blackboard>
{
std::shared_ptr<IndexerCommandCustom> indexerCommand = m_serialCommands.back();
m_serialCommands.pop_back();
runIndexerCommand(indexerCommand, blackboard);
runIndexerCommand(indexerCommand, blackboard, m_storage);
}
executeParallelIndexerCommands(0, blackboard);
@@ -331,6 +333,9 @@ Task::TaskState TaskExecuteCustomCommands::doUpdate(std::shared_ptr<Blackboard>
}
indexerThreads.clear();
// clear errors here, because otherwise injecting into the main storage will show them twice
MessageErrorCountClear().dispatch();
{
PersistentStorage targetStorage(m_targetDatabaseFilePath, FilePath());
targetStorage.setup();
@@ -386,6 +391,7 @@ void TaskExecuteCustomCommands::handleMessage(MessageIndexingInterrupted* messag
void TaskExecuteCustomCommands::executeParallelIndexerCommands(
int threadId, std::shared_ptr<Blackboard> blackboard)
{
std::shared_ptr<PersistentStorage> storage;
while (!m_interrupted)
{
std::shared_ptr<IndexerCommandCustom> indexerCommand;
@@ -399,7 +405,11 @@ void TaskExecuteCustomCommands::executeParallelIndexerCommands(
m_parallelCommands.pop_back();
}
if (threadId != 0)
if (threadId == 0)
{
storage = m_storage;
}
else
{
FilePath databaseFilePath = indexerCommand->getDatabaseFilePath();
databaseFilePath = databaseFilePath.getParentDirectory().concatenate(
@@ -426,21 +436,23 @@ void TaskExecuteCustomCommands::executeParallelIndexerCommands(
L"conflicts.");
FileSystem::remove(databaseFilePath);
}
PersistentStorage sourceStorage(databaseFilePath, FilePath());
sourceStorage.setup();
sourceStorage.setMode(SqliteIndexStorage::STORAGE_MODE_WRITE);
sourceStorage.buildCaches();
storage = std::make_shared<PersistentStorage>(databaseFilePath, FilePath());
storage->setup();
storage->setMode(SqliteIndexStorage::STORAGE_MODE_WRITE);
storage->buildCaches();
}
indexerCommand->setDatabaseFilePath(databaseFilePath);
}
runIndexerCommand(indexerCommand, blackboard);
runIndexerCommand(indexerCommand, blackboard, storage);
}
}
void TaskExecuteCustomCommands::runIndexerCommand(
std::shared_ptr<IndexerCommandCustom> indexerCommand, std::shared_ptr<Blackboard> blackboard)
std::shared_ptr<IndexerCommandCustom> indexerCommand,
std::shared_ptr<Blackboard> blackboard,
std::shared_ptr<PersistentStorage> storage)
{
if (indexerCommand)
{
@@ -455,15 +467,39 @@ void TaskExecuteCustomCommands::runIndexerCommand(
const std::wstring command = indexerCommand->getCustomCommand();
LOG_INFO_STREAM(<< "Execute command \"" << utility::encodeToUtf8(command) << "\"");
LOG_INFO("Start processing command \"" + utility::encodeToUtf8(command) + "\"");
m_storage->beforeErrorRecording();
const ErrorCountInfo previousErrorCount = storage ? storage->getErrorCount()
: ErrorCountInfo();
LOG_INFO("Starting to index");
std::wstring errorMessage;
const int result = utility::executeProcessAndGetExitCode(
command, {}, m_projectDirectory, -1, true, &errorMessage);
LOG_INFO("Finished indexing");
m_storage->afterErrorRecording();
if (storage)
{
std::vector<ErrorInfo> errors = storage->getErrorInfos();
const ErrorCountInfo currentErrorCount(errors);
if (currentErrorCount.total > previousErrorCount.total)
{
const ErrorCountInfo diff(
currentErrorCount.total - previousErrorCount.total,
currentErrorCount.fatal - previousErrorCount.fatal);
ErrorCountInfo errorCount; // local copy to release lock early
{
std::lock_guard<std::mutex> lock(m_errorCountMutex);
m_errorCount.total += diff.total;
m_errorCount.fatal += diff.fatal;
errorCount = m_errorCount;
}
errors.erase(errors.begin(), errors.begin() + previousErrorCount.total);
MessageErrorCountUpdate(errorCount, errors).dispatch();
}
}
if (result == 0 && errorMessage.empty())
{
@@ -4,6 +4,7 @@
#include <set>
#include <vector>
#include "ErrorCountInfo.h"
#include "FilePath.h"
#include "MessageIndexingInterrupted.h"
#include "MessageListener.h"
@@ -39,7 +40,9 @@ private:
void executeParallelIndexerCommands(int threadId, std::shared_ptr<Blackboard> blackboard);
void runIndexerCommand(
std::shared_ptr<IndexerCommandCustom> indexerCommand, std::shared_ptr<Blackboard> blackboard);
std::shared_ptr<IndexerCommandCustom> indexerCommand,
std::shared_ptr<Blackboard> blackboard,
std::shared_ptr<PersistentStorage> storage);
std::unique_ptr<IndexerCommandProvider> m_indexerCommandProvider;
std::shared_ptr<PersistentStorage> m_storage;
@@ -53,6 +56,8 @@ private:
std::vector<std::shared_ptr<IndexerCommandCustom>> m_serialCommands;
std::vector<std::shared_ptr<IndexerCommandCustom>> m_parallelCommands;
std::mutex m_parallelCommandsMutex;
ErrorCountInfo m_errorCount;
std::mutex m_errorCountMutex;
FilePath m_targetDatabaseFilePath;
bool m_hasPythonCommands;
std::set<FilePath> m_sourceDatabaseFilePaths;
+31 -26
View File
@@ -19,7 +19,7 @@
#include "TextCodec.h"
#include "TimeStamp.h"
#include "TokenComponentAccess.h"
#include "TokenComponentAggregation.h"
#include "TokenComponentBundledEdges.h"
#include "TokenComponentFilePath.h"
#include "TokenComponentInheritanceChain.h"
#include "TokenComponentIsAmbiguous.h"
@@ -260,6 +260,11 @@ void PersistentStorage::rollbackInjection()
afterErrorRecording();
}
const std::vector<ErrorInfo> PersistentStorage::getErrorInfos() const
{
return m_sqliteIndexStorage.getAllErrorInfos();
}
void PersistentStorage::beforeErrorRecording()
{
m_preInjectionErrorCount = m_sqliteIndexStorage.getErrorCount();
@@ -273,7 +278,7 @@ void PersistentStorage::beforeErrorRecording()
void PersistentStorage::afterErrorRecording()
{
std::vector<ErrorInfo> errors = m_sqliteIndexStorage.getAllErrorInfos();
std::vector<ErrorInfo> errors = getErrorInfos();
if (m_preInjectionErrorCount < errors.size())
{
ErrorCountInfo errorCount(errors);
@@ -1097,8 +1102,8 @@ std::shared_ptr<Graph> PersistentStorage::getGraphForActiveTokenIds(
std::vector<Id> nodeIds;
std::vector<Id> edgeIds;
bool addAggregations = false;
std::vector<StorageEdge> edgesToAggregate;
bool addBundledEdges = false;
std::vector<StorageEdge> edgesToBundle;
bool addFileContents = false;
@@ -1145,7 +1150,7 @@ std::shared_ptr<Graph> PersistentStorage::getGraphForActiveTokenIds(
(m_hierarchyCache.getLastVisibleParentNodeId(edge.targetNodeId) !=
m_hierarchyCache.getLastVisibleParentNodeId(edge.sourceNodeId)))
{
edgesToAggregate.push_back(edge);
edgesToBundle.push_back(edge);
}
else
{
@@ -1159,7 +1164,7 @@ std::shared_ptr<Graph> PersistentStorage::getGraphForActiveTokenIds(
}
else
{
addAggregations = true;
addBundledEdges = true;
}
}
}
@@ -1216,9 +1221,9 @@ std::shared_ptr<Graph> PersistentStorage::getGraphForActiveTokenIds(
addNodesWithParentsAndEdgesToGraph(nodeIds, edgeIds, graph, true);
}
if (addAggregations)
if (addBundledEdges)
{
addAggregationEdgesToGraph(tokenIds[0], edgesToAggregate, graph);
addBundledEdgesToGraph(tokenIds[0], edgesToBundle, graph);
}
else if (addFileContents)
{
@@ -2963,8 +2968,8 @@ void PersistentStorage::addNodesWithParentsAndEdgesToGraph(
addEdgesToGraph(utility::toVector(allEdgeIds), graph);
}
void PersistentStorage::addAggregationEdgesToGraph(
Id nodeId, const std::vector<StorageEdge>& edgesToAggregate, Graph* graph) const
void PersistentStorage::addBundledEdgesToGraph(
Id nodeId, const std::vector<StorageEdge>& edgesToBundle, Graph* graph) const
{
TRACE();
@@ -2974,19 +2979,19 @@ void PersistentStorage::addAggregationEdgesToGraph(
bool forward;
};
// build aggregation edges:
// build bundled edges:
// get all children of the active node
std::set<Id> childNodeIdsSet, edgeIdsSet;
m_hierarchyCache.addAllChildIdsForNodeId(nodeId, &childNodeIdsSet, &edgeIdsSet);
const std::vector<Id> childNodeIds = utility::toVector(childNodeIdsSet);
if (childNodeIds.size() == 0 && edgesToAggregate.size() == 0)
if (childNodeIds.size() == 0 && edgesToBundle.size() == 0)
{
return;
}
// get all edges of the children
std::map<Id, std::vector<EdgeInfo>> connectedNodeIds;
for (const StorageEdge& edge: edgesToAggregate)
for (const StorageEdge& edge: edgesToBundle)
{
bool isSource = nodeId == edge.sourceNodeId;
EdgeInfo edgeInfo;
@@ -3033,38 +3038,38 @@ void PersistentStorage::addAggregationEdgesToGraph(
std::vector<Id> nodeIdsToAdd;
for (const std::pair<Id, std::vector<EdgeInfo>>& p: connectedParentNodeIds)
{
const Id aggregationTargetNodeId = p.first;
if (!graph->getNodeById(aggregationTargetNodeId))
const Id bundledEdgesTargetNodeId = p.first;
if (!graph->getNodeById(bundledEdgesTargetNodeId))
{
nodeIdsToAdd.push_back(aggregationTargetNodeId);
nodeIdsToAdd.push_back(bundledEdgesTargetNodeId);
}
}
addNodesWithParentsAndEdgesToGraph(nodeIdsToAdd, std::vector<Id>(), graph, true);
// create aggregation edges between parents and active node
// create bundled edges between parents and active node
Node* sourceNode = graph->getNodeById(nodeId);
for (const std::pair<Id, std::vector<EdgeInfo>>& p: connectedParentNodeIds)
{
const Id aggregationTargetNodeId = p.first;
const Id bundledEdgesTargetNodeId = p.first;
Node* targetNode = graph->getNodeById(aggregationTargetNodeId);
Node* targetNode = graph->getNodeById(bundledEdgesTargetNodeId);
if (!targetNode)
{
LOG_ERROR("Aggregation target node not present.");
LOG_ERROR("Bundled edges target node not present.");
}
std::shared_ptr<TokenComponentAggregation> componentAggregation =
std::make_shared<TokenComponentAggregation>();
std::shared_ptr<TokenComponentBundledEdges> componentBundledEdges =
std::make_shared<TokenComponentBundledEdges>();
for (const EdgeInfo& edgeInfo: p.second)
{
componentAggregation->addAggregationId(edgeInfo.edgeId, edgeInfo.forward);
componentBundledEdges->addBundledEdgesId(edgeInfo.edgeId, edgeInfo.forward);
}
// Set first bit to 1 to avoid collisions
const Id aggregationId = ~(~Id(0) >> 1) + *componentAggregation->getAggregationIds().begin();
const Id bundledEdgesId = ~(~Id(0) >> 1) + *componentBundledEdges->getBundledEdgesIds().begin();
Edge* edge = graph->createEdge(aggregationId, Edge::EDGE_AGGREGATION, sourceNode, targetNode);
edge->addComponent(componentAggregation);
Edge* edge = graph->createEdge(bundledEdgesId, Edge::EDGE_BUNDLED_EDGES, sourceNode, targetNode);
edge->addComponent(componentBundledEdges);
}
}
+4 -2
View File
@@ -59,6 +59,8 @@ public:
void finishInjection() override;
void rollbackInjection();
const std::vector<ErrorInfo> getErrorInfos() const;
void beforeErrorRecording();
void afterErrorRecording();
@@ -244,8 +246,8 @@ private:
inline void addFileNodeToGraph(const StorageNode& storageNode, Graph* const graph) const;
void addNodeToGraph(
const StorageNode& newNode, const NodeType& type, Graph* graph, bool addChildCount) const;
void addAggregationEdgesToGraph(
Id nodeId, const std::vector<StorageEdge>& edgesToAggregate, Graph* graph) const;
void addBundledEdgesToGraph(
Id nodeId, const std::vector<StorageEdge>& edgesToBundle, Graph* graph) const;
void addFileContentsToGraph(Id fileId, Graph* graph) const;
void addComponentAccessToGraph(Graph* graph) const;
void addComponentIsAmbiguousToGraph(Graph* graph) const;
@@ -18,7 +18,7 @@ public:
}
MessageActivateTokens(const MessageBase* other)
: isEdge(false), isAggregation(false), isFromSearch(false)
: isEdge(false), isBundledEdges(false), isFromSearch(false)
{
setIsParallel(true);
setKeepContent(other->keepContent());
@@ -43,10 +43,10 @@ public:
std::vector<SearchMatch> getSearchMatches() const override
{
if (isAggregation)
if (isBundledEdges)
{
SearchMatch match;
match.name = match.text = L"aggregation"; // TODO: show aggregation source and target
match.name = match.text = L"bundled edges"; // TODO: show bundled edges source and target
match.searchType = SearchMatch::SEARCH_TOKEN;
match.nodeType = NodeType(NODE_TYPE);
return {match};
@@ -59,7 +59,7 @@ public:
std::vector<SearchMatch> searchMatches;
bool isEdge;
bool isAggregation;
bool isBundledEdges;
bool isFromSearch;
};
@@ -22,7 +22,7 @@ public:
, sourceNameHierarchy(sourceNameHierarchy)
, targetNameHierarchy(targetNameHierarchy)
{
if (!isAggregation())
if (!isBundledEdges())
{
setKeepContent(true);
}
@@ -35,9 +35,9 @@ public:
return "MessageActivateEdge";
}
bool isAggregation() const
bool isBundledEdges() const
{
return type == Edge::EDGE_AGGREGATION;
return type == Edge::EDGE_BUNDLED_EDGES;
}
std::wstring getFullName() const
@@ -58,7 +58,7 @@ public:
const NameHierarchy sourceNameHierarchy;
const NameHierarchy targetNameHierarchy;
std::vector<Id> aggregationIds;
std::vector<Id> bundledEdgesIds;
};
#endif // MESSAGE_ACTIVATE_EDGE_H
+16 -9
View File
@@ -91,19 +91,21 @@ void GraphFocusHandler::focusTokenId(
void GraphFocusHandler::refocusNode(
const std::list<QtGraphNode*>& newNodes, Id oldActiveTokenId, Id newActiveTokenId)
{
const Id lastFocusId = m_lastFocusId;
clear();
if (lastFocusId && (lastFocusId == newActiveTokenId || oldActiveTokenId == newActiveTokenId))
if (m_lastFocusId && (m_lastFocusId == newActiveTokenId || oldActiveTokenId == newActiveTokenId))
{
QtGraphNode* nodeToFocus = QtGraphNode::findNodeRecursive(newNodes, lastFocusId);
QtGraphNode* nodeToFocus = QtGraphNode::findNodeRecursive(newNodes, m_lastFocusId);
if (nodeToFocus)
{
m_focusNode = nodeToFocus;
m_lastFocusId = lastFocusId;
nodeToFocus->setIsFocused(true);
if (m_focusNode != nodeToFocus)
{
m_focusNode = nodeToFocus;
nodeToFocus->setIsFocused(true);
}
return;
}
}
clear();
}
void GraphFocusHandler::focusNext(Direction direction, bool navigateEdges)
@@ -180,6 +182,11 @@ void GraphFocusHandler::focusNode(QtGraphNode* node)
void GraphFocusHandler::defocusNode(QtGraphNode* node)
{
if (node != m_focusNode)
{
return;
}
QtGraphNode* parent = node->getParent();
while (parent && !parent->isFocusable())
{
@@ -399,7 +406,7 @@ QtGraphEdge* GraphFocusHandler::findNextEdge(QPointF pos, Direction direction, Q
qreal distXMult = vertical ? 2.0 : 1.0;
qreal distYMult = vertical ? 1.0 : 2.0;
// only use one dimension for distance calculation in aggregation graphs to not miss
// only use one dimension for distance calculation in bundled edges graphs to not miss
// certain edges
if (edge->isBezierEdge() && m_client->getGraphNodes().size() == 2)
{
+18 -19
View File
@@ -19,7 +19,6 @@
#include "QtLineItemAngled.h"
#include "QtLineItemBezier.h"
#include "QtLineItemStraight.h"
#include "TokenComponentAggregation.h"
#include "TokenComponentInheritanceChain.h"
#include "TokenComponentIsAmbiguous.h"
#include "utility.h"
@@ -51,7 +50,7 @@ QtGraphEdge::QtGraphEdge(
bool isActive,
bool isInteractive,
bool horizontal,
TokenComponentAggregation::Direction direction)
TokenComponentBundledEdges::Direction direction)
: m_focusHandler(focusHandler)
, m_data(data)
, m_owner(owner)
@@ -64,7 +63,7 @@ QtGraphEdge::QtGraphEdge(
{
this->setCursor(Qt::PointingHandCursor);
if (m_direction == TokenComponentAggregation::DIRECTION_BACKWARD)
if (m_direction == TokenComponentBundledEdges::DIRECTION_BACKWARD)
{
QtGraphNode* temp = m_owner;
m_owner = m_target;
@@ -104,7 +103,7 @@ void QtGraphEdge::updateLine()
const QtGraphNode* owner = m_owner;
const QtGraphNode* target = m_target;
Edge::EdgeType type = (getData() ? getData()->getType() : Edge::EDGE_AGGREGATION);
Edge::EdgeType type = (getData() ? getData()->getType() : Edge::EDGE_BUNDLED_EDGES);
GraphViewStyle::EdgeStyle style = GraphViewStyle::getStyleForEdgeType(
type, m_isActive | m_isCoFocused, m_isFocused, m_isTrailEdge, isAmbiguous());
@@ -171,7 +170,7 @@ void QtGraphEdge::updateLine()
ownerParentRect = rect;
}
bool showArrow = m_direction != TokenComponentAggregation::DIRECTION_NONE;
bool showArrow = m_direction != TokenComponentBundledEdges::DIRECTION_NONE;
QtLineItemBezier* bezier = new QtLineItemBezier(this);
m_child = bezier;
@@ -260,7 +259,7 @@ void QtGraphEdge::updateLine()
child->setEarlyBend(true);
}
}
else if (type != Edge::EDGE_AGGREGATION || owner != ownerNonGroupParent || target != targetNonGroupParent)
else if (type != Edge::EDGE_BUNDLED_EDGES || owner != ownerNonGroupParent || target != targetNonGroupParent)
{
route = QtLineItemBase::ROUTE_HORIZONTAL;
}
@@ -268,9 +267,9 @@ void QtGraphEdge::updateLine()
child->setRoute(route);
bool showArrow = true;
if (type == Edge::EDGE_AGGREGATION)
if (type == Edge::EDGE_BUNDLED_EDGES)
{
showArrow = m_direction != TokenComponentAggregation::DIRECTION_NONE;
showArrow = m_direction != TokenComponentBundledEdges::DIRECTION_NONE;
}
if (getData())
@@ -332,7 +331,7 @@ void QtGraphEdge::onClick()
if (isExpandable())
{
QtGraphNode* node =
(m_direction == TokenComponentAggregation::DIRECTION_BACKWARD ? m_owner : m_target);
(m_direction == TokenComponentBundledEdges::DIRECTION_BACKWARD ? m_owner : m_target);
if (m_owner->isGroupNode())
{
node = m_owner;
@@ -360,18 +359,18 @@ void QtGraphEdge::onClick()
MessageActivateEdge msg(
getData()->getId(),
componentInheritance ? Edge::EDGE_AGGREGATION : getData()->getType(),
componentInheritance ? Edge::EDGE_BUNDLED_EDGES : getData()->getType(),
getData()->getFrom()->getNameHierarchy(),
getData()->getTo()->getNameHierarchy());
if (getData()->getType() == Edge::EDGE_AGGREGATION)
if (getData()->getType() == Edge::EDGE_BUNDLED_EDGES)
{
msg.aggregationIds = utility::toVector<Id>(
getData()->getComponent<TokenComponentAggregation>()->getAggregationIds());
msg.bundledEdgesIds = utility::toVector<Id>(
getData()->getComponent<TokenComponentBundledEdges>()->getBundledEdgesIds());
}
else if (componentInheritance)
{
msg.aggregationIds = componentInheritance->inheritanceEdgeIds;
msg.bundledEdgesIds = componentInheritance->inheritanceEdgeIds;
}
msg.dispatch();
@@ -397,7 +396,7 @@ void QtGraphEdge::coFocusIn()
if (s_focusedEdge == this)
{
Edge::EdgeType type = (getData() ? getData()->getType() : Edge::EDGE_AGGREGATION);
Edge::EdgeType type = (getData() ? getData()->getType() : Edge::EDGE_BUNDLED_EDGES);
TooltipInfo info;
info.title = Edge::getReadableTypeString(type);
@@ -407,13 +406,13 @@ void QtGraphEdge::coFocusIn()
info.title = L"ambiguous " + info.title;
}
if (type == Edge::EDGE_AGGREGATION &&
m_direction == TokenComponentAggregation::DIRECTION_NONE)
if (type == Edge::EDGE_BUNDLED_EDGES &&
m_direction == TokenComponentBundledEdges::DIRECTION_NONE)
{
info.title = L"bidirectional " + info.title;
}
if (type == Edge::EDGE_AGGREGATION)
if (type == Edge::EDGE_BUNDLED_EDGES)
{
info.count = static_cast<int>(m_weight);
info.countText = "edge";
@@ -526,7 +525,7 @@ void QtGraphEdge::hoverLeaveEvent(QGraphicsSceneHoverEvent* event)
s_focusedEdge = nullptr;
}
void QtGraphEdge::setDirection(TokenComponentAggregation::Direction direction)
void QtGraphEdge::setDirection(TokenComponentBundledEdges::Direction direction)
{
if (m_direction != direction)
{
+4 -5
View File
@@ -5,11 +5,10 @@
#include <QGraphicsItem>
#include "TokenComponentBundledEdges.h"
#include "Vector2.h"
#include "Vector4.h"
#include "TokenComponentAggregation.h"
class Edge;
class GraphFocusHandler;
class QtGraphNode;
@@ -34,7 +33,7 @@ public:
bool isActive,
bool isInteractive,
bool horizontal,
TokenComponentAggregation::Direction direction);
TokenComponentBundledEdges::Direction direction);
virtual ~QtGraphEdge();
const Edge* getData() const;
@@ -60,7 +59,7 @@ public:
void coFocusIn();
void coFocusOut();
void setDirection(TokenComponentAggregation::Direction direction);
void setDirection(TokenComponentBundledEdges::Direction direction);
bool isHorizontal() const;
bool isExpandable() const;
@@ -108,7 +107,7 @@ private:
bool m_isHorizontal = false;
size_t m_weight = 0;
TokenComponentAggregation::Direction m_direction;
TokenComponentBundledEdges::Direction m_direction;
bool m_isTrailEdge = false;
std::vector<Vec4i> m_path;
+1 -1
View File
@@ -243,7 +243,7 @@ QtCustomTrailView::QtCustomTrailView(ViewLayout* viewLayout)
Edge::EDGE_TYPE_ARGUMENT,
Edge::EDGE_INCLUDE,
Edge::EDGE_IMPORT,
// Edge::EDGE_AGGREGATION,
// Edge::EDGE_BUNDLED_EDGES,
Edge::EDGE_MACRO_USAGE,
Edge::EDGE_ANNOTATION_USAGE
// Edge::EDGE_MEMBER // has separate checkbox
+9 -7
View File
@@ -390,7 +390,7 @@ void QtGraphView::rebuildGraph(
std::set<Id> visibleEdgeIds;
for (const std::shared_ptr<DummyEdge>& edge: edges)
{
if (!edge->data || !edge->data->isType(Edge::EDGE_AGGREGATION))
if (!edge->data || !edge->data->isType(Edge::EDGE_BUNDLED_EDGES))
{
createEdge(
view,
@@ -404,9 +404,9 @@ void QtGraphView::rebuildGraph(
}
for (const std::shared_ptr<DummyEdge>& edge: edges)
{
if (edge->data && edge->data->isType(Edge::EDGE_AGGREGATION))
if (edge->data && edge->data->isType(Edge::EDGE_BUNDLED_EDGES))
{
createAggregationEdge(view, edge.get(), &visibleEdgeIds, !params.disableInteraction);
createBundledEdgesEdge(view, edge.get(), &visibleEdgeIds, !params.disableInteraction);
}
}
@@ -937,6 +937,8 @@ void QtGraphView::updateTrailButtons()
void QtGraphView::switchToNewGraphData()
{
m_focusHandler.refocusNode(m_nodes, 0, 0);
m_oldGraph = m_graph;
for (QtGraphNode* node: m_oldNodes)
@@ -1201,7 +1203,7 @@ QtGraphEdge* QtGraphView::createEdge(
return nullptr;
}
QtGraphEdge* QtGraphView::createAggregationEdge(
QtGraphEdge* QtGraphView::createBundledEdgesEdge(
QGraphicsView* view, const DummyEdge* edge, std::set<Id>* visibleEdgeIds, bool interactive)
{
if (!edge->visible)
@@ -1210,9 +1212,9 @@ QtGraphEdge* QtGraphView::createAggregationEdge(
}
bool allVisible = true;
std::set<Id> aggregationIds =
edge->data->getComponent<TokenComponentAggregation>()->getAggregationIds();
for (Id edgeId: aggregationIds)
std::set<Id> bundledEdgesIds =
edge->data->getComponent<TokenComponentBundledEdges>()->getBundledEdgesIds();
for (Id edgeId: bundledEdgesIds)
{
if (visibleEdgeIds->find(edgeId) == visibleEdgeIds->end())
{
+1 -1
View File
@@ -128,7 +128,7 @@ private:
QPointF pathOffset,
bool useBezier,
bool interactive);
QtGraphEdge* createAggregationEdge(
QtGraphEdge* createBundledEdgesEdge(
QGraphicsView* view, const DummyEdge* edge, std::set<Id>* visibleEdgeIds, bool interactive);
QRectF itemsBoundingRect(const std::list<QtGraphNode*>& items) const;
@@ -225,10 +225,10 @@ namespace interaction
// TEST: aggregation expand
// TEST: bundled edges expand
// START ----------------------------------------------------------------------
// ACTION 1: Click on aggregation between 'BundleBase -> ExpandedClass'
// ACTION 1: Click on bundled edges between 'BundleBase -> ExpandedClass'
// RESULTS 1:
// - graph shows 6 edges: 4 call, 1 use, 1 type use
// - edges are displayed as bezier curves
@@ -134,12 +134,12 @@ B b; // <- ACTION: activate 'B'
// TEST: Activate aggregation edge
// TEST: Activate bundled edges edge
// START ----------------------------------------------------------------------
// ACTION: Move focus on aggregation 'D -> B'
// ACTION: Move focus on bundled edges 'D -> B'
// ACTION: Press Enter/E
// RESULT: aggregation edge is activated
// RESULT: bundled edges edge is activated
// END ------------------------------------------------------------------------
@@ -25,7 +25,7 @@ int func()
// TEST: Graph aggregation focus restored on back
// TEST: Graph bundled edges focus restored on back
// START ----------------------------------------------------------------------
class HistoryTestUser
@@ -40,9 +40,9 @@ public:
HistoryTest h;
};
// ACTION: Focus and activate aggregation 'HistoryTestUser -> HistoryTest'
// ACTION: Focus and activate bundled edges 'HistoryTestUser -> HistoryTest'
// ACTION: Navigate 'back' in history
// RESULT: The graph for 'HistoryTest' is restored with focus at aggregation edge
// RESULT: The graph for 'HistoryTest' is restored with focus at bundled edges edge
// END ------------------------------------------------------------------------