forked from qt-creator/qt-creator
ProjectManager: Remove SessionNode
Instead, get root project nodes directly from the project. Change-Id: I5cf95a7dce1fa29c1adc26013ad03cc017f38a6d Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user