diff options
author | hjk <hjk@qt.io> | 2017-03-17 12:26:00 +0100 |
---|---|---|
committer | hjk <hjk@qt.io> | 2017-03-21 12:48:41 +0000 |
commit | ebae6426f8246f21ac6354147d67efcde782c624 (patch) | |
tree | fb9e9488dc3e8896bc9856edfe152427d20c1ee0 /src/plugins/projectexplorer/projecttreewidget.cpp | |
parent | 312784a930078992c290b330a7e41ea219a6e3b1 (diff) |
ProjectManager: Remove SessionNode
Instead, get root project nodes directly from the project.
Change-Id: I5cf95a7dce1fa29c1adc26013ad03cc017f38a6d
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'src/plugins/projectexplorer/projecttreewidget.cpp')
-rw-r--r-- | src/plugins/projectexplorer/projecttreewidget.cpp | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/src/plugins/projectexplorer/projecttreewidget.cpp b/src/plugins/projectexplorer/projecttreewidget.cpp index 67bbf07405..372dbdb757 100644 --- a/src/plugins/projectexplorer/projecttreewidget.cpp +++ b/src/plugins/projectexplorer/projecttreewidget.cpp @@ -275,23 +275,27 @@ Node *ProjectTreeWidget::nodeForFile(const Utils::FileName &fileName) Node *bestNode = nullptr; int bestNodeExpandCount = INT_MAX; - SessionManager::sessionNode()->forEachGenericNode([&](Node *node) { - if (node->filePath() == fileName) { - if (!bestNode) { - bestNode = node; - bestNodeExpandCount = ProjectTreeWidget::expandedCount(node); - } else if (node->nodeType() < bestNode->nodeType()) { - bestNode = node; - bestNodeExpandCount = ProjectTreeWidget::expandedCount(node); - } else if (node->nodeType() == bestNode->nodeType()) { - int nodeExpandCount = ProjectTreeWidget::expandedCount(node); - if (nodeExpandCount < bestNodeExpandCount) { - bestNode = node; - bestNodeExpandCount = ProjectTreeWidget::expandedCount(node); + for (Project *project : SessionManager::projects()) { + if (ProjectNode *projectNode = project->rootProjectNode()) { + projectNode->forEachGenericNode([&](Node *node) { + if (node->filePath() == fileName) { + if (!bestNode) { + bestNode = node; + bestNodeExpandCount = ProjectTreeWidget::expandedCount(node); + } else if (node->nodeType() < bestNode->nodeType()) { + bestNode = node; + bestNodeExpandCount = ProjectTreeWidget::expandedCount(node); + } else if (node->nodeType() == bestNode->nodeType()) { + int nodeExpandCount = ProjectTreeWidget::expandedCount(node); + if (nodeExpandCount < bestNodeExpandCount) { + bestNode = node; + bestNodeExpandCount = ProjectTreeWidget::expandedCount(node); + } + } } - } + }); } - }); + } return bestNode; } |