ProjectExplorer: Rename ProjectTree::findCurrentNode to currentNode

For consistency, it's straight forwards access, similar to
currentProject, not much to search and find.

Change-Id: I7ce696bdc24b6a8713d6f11e02443a6f94c605f6
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2019-04-30 12:58:33 +02:00
parent 28de30df18
commit a5148b5363
13 changed files with 47 additions and 47 deletions

View File

@@ -147,7 +147,7 @@ void CMakeProjectPlugin::extensionsInitialized()
void CMakeProjectPlugin::updateContextActions() void CMakeProjectPlugin::updateContextActions()
{ {
Project *project = ProjectTree::currentProject(); Project *project = ProjectTree::currentProject();
const Node *node = ProjectTree::findCurrentNode(); const Node *node = ProjectTree::currentNode();
auto targetNode = dynamic_cast<const CMakeTargetNode *>(node); auto targetNode = dynamic_cast<const CMakeTargetNode *>(node);
// as targetNode can be deleted while the menu is open, we keep only the // as targetNode can be deleted while the menu is open, we keep only the
const QString targetDisplayName = targetNode ? targetNode->displayName() : QString(); const QString targetDisplayName = targetNode ? targetNode->displayName() : QString();

View File

@@ -250,7 +250,7 @@ void ModelsManager::onAboutToShowContextMenu(ProjectExplorer::Project *project,
void ModelsManager::onOpenDiagramFromProjectExplorer() void ModelsManager::onOpenDiagramFromProjectExplorer()
{ {
if (ProjectExplorer::ProjectTree::findCurrentNode() == d->contextMenuOwnerNode) { if (ProjectExplorer::ProjectTree::currentNode() == d->contextMenuOwnerNode) {
qmt::MDiagram *diagram = nullptr; qmt::MDiagram *diagram = nullptr;
foreach (const ManagedModel &managedModel, d->managedModels) { foreach (const ManagedModel &managedModel, d->managedModels) {
if ((diagram = managedModel.m_documentController->pxNodeController()->findDiagramForExplorerNode(d->contextMenuOwnerNode))) { if ((diagram = managedModel.m_documentController->pxNodeController()->findDiagramForExplorerNode(d->contextMenuOwnerNode))) {

View File

@@ -1460,7 +1460,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
connect(dd->m_openTerminalHereRunEnv, &QAction::triggered, dd, []() { dd->openTerminalHere(runEnv); }); connect(dd->m_openTerminalHereRunEnv, &QAction::triggered, dd, []() { dd->openTerminalHere(runEnv); });
connect(dd->m_filePropertiesAction, &QAction::triggered, this, []() { connect(dd->m_filePropertiesAction, &QAction::triggered, this, []() {
const Node *currentNode = ProjectTree::findCurrentNode(); const Node *currentNode = ProjectTree::currentNode();
QTC_ASSERT(currentNode && currentNode->asFileNode(), return); QTC_ASSERT(currentNode && currentNode->asFileNode(), return);
DocumentManager::showFilePropertiesDialog(currentNode->filePath()); DocumentManager::showFilePropertiesDialog(currentNode->filePath());
}); });
@@ -2628,7 +2628,7 @@ void ProjectExplorerPlugin::buildProject(Project *p)
void ProjectExplorerPluginPrivate::runProjectContextMenu() void ProjectExplorerPluginPrivate::runProjectContextMenu()
{ {
const Node *node = ProjectTree::findCurrentNode(); const Node *node = ProjectTree::currentNode();
const ProjectNode *projectNode = node ? node->asProjectNode() : nullptr; const ProjectNode *projectNode = node ? node->asProjectNode() : nullptr;
if (projectNode == ProjectTree::currentProject()->rootProjectNode() || !projectNode) { if (projectNode == ProjectTree::currentProject()->rootProjectNode() || !projectNode) {
m_instance->runProject(ProjectTree::currentProject(), Constants::NORMAL_RUN_MODE); m_instance->runProject(ProjectTree::currentProject(), Constants::NORMAL_RUN_MODE);
@@ -3160,7 +3160,7 @@ void ProjectExplorerPluginPrivate::updateContextMenuActions()
runMenu->menu()->clear(); runMenu->menu()->clear();
runMenu->menu()->menuAction()->setVisible(false); runMenu->menu()->menuAction()->setVisible(false);
const Node *currentNode = ProjectTree::findCurrentNode(); const Node *currentNode = ProjectTree::currentNode();
if (currentNode && currentNode->managingProject()) { if (currentNode && currentNode->managingProject()) {
ProjectNode *pn; ProjectNode *pn;
@@ -3285,7 +3285,7 @@ void ProjectExplorerPluginPrivate::updateLocationSubMenus()
QTC_CHECK(folderMenu->actions().isEmpty()); QTC_CHECK(folderMenu->actions().isEmpty());
const FolderNode *const fn const FolderNode *const fn
= ProjectTree::findCurrentNode() ? ProjectTree::findCurrentNode()->asFolderNode() : nullptr; = ProjectTree::currentNode() ? ProjectTree::currentNode()->asFolderNode() : nullptr;
const QList<FolderNode::LocationInfo> locations const QList<FolderNode::LocationInfo> locations
= fn ? fn->locationInfo() : QList<FolderNode::LocationInfo>(); = fn ? fn->locationInfo() : QList<FolderNode::LocationInfo>();
@@ -3313,7 +3313,7 @@ void ProjectExplorerPluginPrivate::updateLocationSubMenus()
void ProjectExplorerPluginPrivate::addNewFile() void ProjectExplorerPluginPrivate::addNewFile()
{ {
Node* currentNode = ProjectTree::findCurrentNode(); Node *currentNode = ProjectTree::currentNode();
QTC_ASSERT(currentNode, return); QTC_ASSERT(currentNode, return);
QString location = directoryFor(currentNode); QString location = directoryFor(currentNode);
@@ -3337,7 +3337,7 @@ void ProjectExplorerPluginPrivate::addNewFile()
void ProjectExplorerPluginPrivate::addNewSubproject() void ProjectExplorerPluginPrivate::addNewSubproject()
{ {
Node* currentNode = ProjectTree::findCurrentNode(); Node* currentNode = ProjectTree::currentNode();
QTC_ASSERT(currentNode, return); QTC_ASSERT(currentNode, return);
QString location = directoryFor(currentNode); QString location = directoryFor(currentNode);
@@ -3364,7 +3364,7 @@ void ProjectExplorerPluginPrivate::addNewSubproject()
void ProjectExplorerPluginPrivate::addExistingProjects() void ProjectExplorerPluginPrivate::addExistingProjects()
{ {
Node * const currentNode = ProjectTree::findCurrentNode(); Node * const currentNode = ProjectTree::currentNode();
if (!currentNode) if (!currentNode)
return; return;
ProjectNode *projectNode = currentNode->asProjectNode(); ProjectNode *projectNode = currentNode->asProjectNode();
@@ -3405,7 +3405,7 @@ void ProjectExplorerPluginPrivate::addExistingProjects()
void ProjectExplorerPluginPrivate::handleAddExistingFiles() void ProjectExplorerPluginPrivate::handleAddExistingFiles()
{ {
Node *node = ProjectTree::findCurrentNode(); Node *node = ProjectTree::currentNode();
FolderNode *folderNode = node ? node->asFolderNode() : nullptr; FolderNode *folderNode = node ? node->asFolderNode() : nullptr;
QTC_ASSERT(folderNode, return); QTC_ASSERT(folderNode, return);
@@ -3420,7 +3420,7 @@ void ProjectExplorerPluginPrivate::handleAddExistingFiles()
void ProjectExplorerPluginPrivate::addExistingDirectory() void ProjectExplorerPluginPrivate::addExistingDirectory()
{ {
Node *node = ProjectTree::findCurrentNode(); Node *node = ProjectTree::currentNode();
FolderNode *folderNode = node ? node->asFolderNode() : nullptr; FolderNode *folderNode = node ? node->asFolderNode() : nullptr;
QTC_ASSERT(folderNode, return); QTC_ASSERT(folderNode, return);
@@ -3462,7 +3462,7 @@ void ProjectExplorerPlugin::addExistingFiles(FolderNode *folderNode, const QStri
void ProjectExplorerPluginPrivate::removeProject() void ProjectExplorerPluginPrivate::removeProject()
{ {
Node *node = ProjectTree::findCurrentNode(); Node *node = ProjectTree::currentNode();
if (!node) if (!node)
return; return;
ProjectNode *projectNode = node->managingProject(); ProjectNode *projectNode = node->managingProject();
@@ -3476,28 +3476,28 @@ void ProjectExplorerPluginPrivate::removeProject()
void ProjectExplorerPluginPrivate::openFile() void ProjectExplorerPluginPrivate::openFile()
{ {
const Node *currentNode = ProjectTree::findCurrentNode(); const Node *currentNode = ProjectTree::currentNode();
QTC_ASSERT(currentNode, return); QTC_ASSERT(currentNode, return);
EditorManager::openEditor(currentNode->filePath().toString()); EditorManager::openEditor(currentNode->filePath().toString());
} }
void ProjectExplorerPluginPrivate::searchOnFileSystem() void ProjectExplorerPluginPrivate::searchOnFileSystem()
{ {
const Node *currentNode = ProjectTree::findCurrentNode(); const Node *currentNode = ProjectTree::currentNode();
QTC_ASSERT(currentNode, return); QTC_ASSERT(currentNode, return);
TextEditor::FindInFiles::findOnFileSystem(pathFor(currentNode)); TextEditor::FindInFiles::findOnFileSystem(pathFor(currentNode));
} }
void ProjectExplorerPluginPrivate::showInGraphicalShell() void ProjectExplorerPluginPrivate::showInGraphicalShell()
{ {
Node *currentNode = ProjectTree::findCurrentNode(); Node *currentNode = ProjectTree::currentNode();
QTC_ASSERT(currentNode, return); QTC_ASSERT(currentNode, return);
FileUtils::showInGraphicalShell(ICore::mainWindow(), pathFor(currentNode)); FileUtils::showInGraphicalShell(ICore::mainWindow(), pathFor(currentNode));
} }
void ProjectExplorerPluginPrivate::openTerminalHere(const EnvironmentGetter &env) void ProjectExplorerPluginPrivate::openTerminalHere(const EnvironmentGetter &env)
{ {
const Node *currentNode = ProjectTree::findCurrentNode(); const Node *currentNode = ProjectTree::currentNode();
QTC_ASSERT(currentNode, return); QTC_ASSERT(currentNode, return);
const auto environment = env(ProjectTree::projectForNode(currentNode)); const auto environment = env(ProjectTree::projectForNode(currentNode));
@@ -3509,7 +3509,7 @@ void ProjectExplorerPluginPrivate::openTerminalHere(const EnvironmentGetter &env
void ProjectExplorerPluginPrivate::removeFile() void ProjectExplorerPluginPrivate::removeFile()
{ {
const Node *currentNode = ProjectTree::findCurrentNode(); const Node *currentNode = ProjectTree::currentNode();
QTC_ASSERT(currentNode && currentNode->asFileNode(), return); QTC_ASSERT(currentNode && currentNode->asFileNode(), return);
const Utils::FileName filePath = currentNode->filePath(); const Utils::FileName filePath = currentNode->filePath();
@@ -3519,7 +3519,7 @@ void ProjectExplorerPluginPrivate::removeFile()
const bool deleteFile = removeFileDialog.isDeleteFileChecked(); const bool deleteFile = removeFileDialog.isDeleteFileChecked();
// Re-read the current node, in case the project is re-parsed while the dialog is open // Re-read the current node, in case the project is re-parsed while the dialog is open
if (currentNode != ProjectTree::findCurrentNode()) { if (currentNode != ProjectTree::currentNode()) {
currentNode = ProjectTreeWidget::nodeForFile(filePath); currentNode = ProjectTreeWidget::nodeForFile(filePath);
QTC_ASSERT(currentNode && currentNode->asFileNode(), return); QTC_ASSERT(currentNode && currentNode->asFileNode(), return);
} }
@@ -3544,7 +3544,7 @@ void ProjectExplorerPluginPrivate::removeFile()
void ProjectExplorerPluginPrivate::duplicateFile() void ProjectExplorerPluginPrivate::duplicateFile()
{ {
Node *currentNode = ProjectTree::findCurrentNode(); Node *currentNode = ProjectTree::currentNode();
QTC_ASSERT(currentNode && currentNode->asFileNode(), return); QTC_ASSERT(currentNode && currentNode->asFileNode(), return);
FileNode *fileNode = currentNode->asFileNode(); FileNode *fileNode = currentNode->asFileNode();
@@ -3575,7 +3575,7 @@ void ProjectExplorerPluginPrivate::duplicateFile()
void ProjectExplorerPluginPrivate::deleteFile() void ProjectExplorerPluginPrivate::deleteFile()
{ {
Node *currentNode = ProjectTree::findCurrentNode(); Node *currentNode = ProjectTree::currentNode();
QTC_ASSERT(currentNode && currentNode->asFileNode(), return); QTC_ASSERT(currentNode && currentNode->asFileNode(), return);
FileNode *fileNode = currentNode->asFileNode(); FileNode *fileNode = currentNode->asFileNode();

View File

@@ -104,7 +104,7 @@ Project *ProjectTree::currentProject()
return s_instance->m_currentProject; return s_instance->m_currentProject;
} }
Node *ProjectTree::findCurrentNode() Node *ProjectTree::currentNode()
{ {
s_instance->update(); s_instance->update();
return s_instance->m_currentNode; return s_instance->m_currentNode;
@@ -112,8 +112,8 @@ Node *ProjectTree::findCurrentNode()
FileName ProjectTree::currentFilePath() FileName ProjectTree::currentFilePath()
{ {
Node *currentNode = findCurrentNode(); Node *node = currentNode();
return currentNode ? currentNode->filePath() : FileName(); return node ? node->filePath() : FileName();
} }
void ProjectTree::registerWidget(ProjectTreeWidget *widget) void ProjectTree::registerWidget(ProjectTreeWidget *widget)

View File

@@ -53,7 +53,7 @@ public:
static ProjectTree *instance(); static ProjectTree *instance();
static Project *currentProject(); static Project *currentProject();
static Node *findCurrentNode(); static Node *currentNode();
static Utils::FileName currentFilePath(); static Utils::FileName currentFilePath();
// Integration with ProjectTreeWidget // Integration with ProjectTreeWidget

View File

@@ -298,7 +298,7 @@ ProjectTreeWidget::ProjectTreeWidget(QWidget *parent) : QWidget(parent)
connect(m_toggleSync, &QAbstractButton::clicked, connect(m_toggleSync, &QAbstractButton::clicked,
this, &ProjectTreeWidget::toggleAutoSynchronization); this, &ProjectTreeWidget::toggleAutoSynchronization);
setCurrentItem(ProjectTree::findCurrentNode()); setCurrentItem(ProjectTree::currentNode());
setAutoSynchronization(true); setAutoSynchronization(true);
m_projectTreeWidgets << this; m_projectTreeWidgets << this;

View File

@@ -283,7 +283,7 @@ void QbsProjectManagerPlugin::projectWasAdded(Project *project)
void QbsProjectManagerPlugin::updateContextActions() void QbsProjectManagerPlugin::updateContextActions()
{ {
auto project = qobject_cast<Internal::QbsProject *>(ProjectTree::currentProject()); auto project = qobject_cast<Internal::QbsProject *>(ProjectTree::currentProject());
const Node *node = ProjectTree::findCurrentNode(); const Node *node = ProjectTree::currentNode();
bool isEnabled = !BuildManager::isBuilding(project) bool isEnabled = !BuildManager::isBuilding(project)
&& project && !project->isParsing() && project && !project->isParsing()
&& node && node->isEnabled(); && node && node->isEnabled();
@@ -375,7 +375,7 @@ void QbsProjectManagerPlugin::projectChanged()
void QbsProjectManagerPlugin::buildFileContextMenu() void QbsProjectManagerPlugin::buildFileContextMenu()
{ {
const Node *node = ProjectTree::findCurrentNode(); const Node *node = ProjectTree::currentNode();
QTC_ASSERT(node, return); QTC_ASSERT(node, return);
auto project = dynamic_cast<QbsProject *>(ProjectTree::currentProject()); auto project = dynamic_cast<QbsProject *>(ProjectTree::currentProject());
QTC_ASSERT(project, return); QTC_ASSERT(project, return);
@@ -412,7 +412,7 @@ void QbsProjectManagerPlugin::rebuildProductContextMenu()
void QbsProjectManagerPlugin::runStepsForProductContextMenu(const QList<Core::Id> &stepTypes) void QbsProjectManagerPlugin::runStepsForProductContextMenu(const QList<Core::Id> &stepTypes)
{ {
const Node *node = ProjectTree::findCurrentNode(); const Node *node = ProjectTree::currentNode();
QTC_ASSERT(node, return); QTC_ASSERT(node, return);
auto project = dynamic_cast<QbsProject *>(ProjectTree::currentProject()); auto project = dynamic_cast<QbsProject *>(ProjectTree::currentProject());
QTC_ASSERT(project, return); QTC_ASSERT(project, return);
@@ -477,7 +477,7 @@ void QbsProjectManagerPlugin::rebuildSubprojectContextMenu()
void QbsProjectManagerPlugin::runStepsForSubprojectContextMenu(const QList<Core::Id> &stepTypes) void QbsProjectManagerPlugin::runStepsForSubprojectContextMenu(const QList<Core::Id> &stepTypes)
{ {
const Node *node = ProjectTree::findCurrentNode(); const Node *node = ProjectTree::currentNode();
QTC_ASSERT(node, return); QTC_ASSERT(node, return);
auto project = dynamic_cast<QbsProject *>(ProjectTree::currentProject()); auto project = dynamic_cast<QbsProject *>(ProjectTree::currentProject());
QTC_ASSERT(project, return); QTC_ASSERT(project, return);

View File

@@ -67,7 +67,7 @@ static QmakeProFileNode *buildableFileProFile(Node *node)
FileNode *QmakeManager::contextBuildableFileNode() FileNode *QmakeManager::contextBuildableFileNode()
{ {
Node *node = ProjectTree::findCurrentNode(); Node *node = ProjectTree::currentNode();
QmakeProFileNode *subProjectNode = buildableFileProFile(node); QmakeProFileNode *subProjectNode = buildableFileProFile(node);
FileNode *fileNode = node ? node->asFileNode() : nullptr; FileNode *fileNode = node ? node->asFileNode() : nullptr;
@@ -87,7 +87,7 @@ void QmakeManager::addLibraryContextMenu()
{ {
QString projectPath; QString projectPath;
Node *node = ProjectTree::findCurrentNode(); Node *node = ProjectTree::currentNode();
if (ContainerNode *cn = node->asContainerNode()) if (ContainerNode *cn = node->asContainerNode())
projectPath = cn->project()->projectFilePath().toString(); projectPath = cn->project()->projectFilePath().toString();
else if (dynamic_cast<QmakeProFileNode *>(node)) else if (dynamic_cast<QmakeProFileNode *>(node))
@@ -132,7 +132,7 @@ void QmakeManager::runQMake()
void QmakeManager::runQMakeContextMenu() void QmakeManager::runQMakeContextMenu()
{ {
runQMakeImpl(ProjectTree::currentProject(), ProjectTree::findCurrentNode()); runQMakeImpl(ProjectTree::currentProject(), ProjectTree::currentNode());
} }
void QmakeManager::runQMakeImpl(ProjectExplorer::Project *p, ProjectExplorer::Node *node) void QmakeManager::runQMakeImpl(ProjectExplorer::Project *p, ProjectExplorer::Node *node)
@@ -199,7 +199,7 @@ void QmakeManager::handleSubDirContextMenu(QmakeManager::Action action, bool isF
handleSubDirContextMenu(action, handleSubDirContextMenu(action,
isFileBuild, isFileBuild,
ProjectTree::currentProject(), ProjectTree::currentProject(),
buildableFileProFile(ProjectTree::findCurrentNode()), buildableFileProFile(ProjectTree::currentNode()),
contextBuildableFileNode()); contextBuildableFileNode());
} }

View File

@@ -369,7 +369,7 @@ void QmakeProjectManagerPluginPrivate::updateRunQMakeAction()
void QmakeProjectManagerPluginPrivate::updateContextActions() void QmakeProjectManagerPluginPrivate::updateContextActions()
{ {
const Node *node = ProjectTree::findCurrentNode(); const Node *node = ProjectTree::currentNode();
Project *project = ProjectTree::currentProject(); Project *project = ProjectTree::currentProject();
const ContainerNode *containerNode = node ? node->asContainerNode() : nullptr; const ContainerNode *containerNode = node ? node->asContainerNode() : nullptr;

View File

@@ -72,7 +72,7 @@ QString QmlPreviewFileOnTargetFinder::findPath(const QString &filePath, bool *su
// Try the current node first. It's likely that this is the one we're looking for and if there // Try the current node first. It's likely that this is the one we're looking for and if there
// is any ambiguity (same file mapped to multiple qrc paths) it should take precedence. // is any ambiguity (same file mapped to multiple qrc paths) it should take precedence.
ProjectExplorer::Node *currentNode = ProjectExplorer::ProjectTree::findCurrentNode(); ProjectExplorer::Node *currentNode = ProjectExplorer::ProjectTree::currentNode();
if (currentNode && currentNode->filePath().toString() == filePath) { if (currentNode && currentNode->filePath().toString() == filePath) {
const QString path = resourceNodePath(currentNode); const QString path = resourceNodePath(currentNode);
if (!path.isEmpty()) if (!path.isEmpty())

View File

@@ -143,7 +143,7 @@ bool QmlPreviewPlugin::initialize(const QStringList &arguments, QString *errorSt
Constants::G_FILE_OTHER); Constants::G_FILE_OTHER);
action->setVisible(false); action->setVisible(false);
connect(ProjectTree::instance(), &ProjectTree::currentNodeChanged, action, [action]() { connect(ProjectTree::instance(), &ProjectTree::currentNodeChanged, action, [action]() {
const Node *node = ProjectTree::findCurrentNode(); const Node *node = ProjectTree::currentNode();
const FileNode *fileNode = node ? node->asFileNode() : nullptr; const FileNode *fileNode = node ? node->asFileNode() : nullptr;
action->setVisible(fileNode ? fileNode->fileType() == FileType::QML : false); action->setVisible(fileNode ? fileNode->fileType() == FileType::QML : false);
}); });
@@ -297,7 +297,7 @@ void QmlPreviewPlugin::setFileLoader(QmlPreviewFileLoader fileLoader)
void QmlPreviewPlugin::previewCurrentFile() void QmlPreviewPlugin::previewCurrentFile()
{ {
const Node *currentNode = ProjectTree::findCurrentNode(); const Node *currentNode = ProjectTree::currentNode();
if (!currentNode || !currentNode->asFileNode() if (!currentNode || !currentNode->asFileNode()
|| currentNode->asFileNode()->fileType() != FileType::QML) || currentNode->asFileNode()->fileType() != FileType::QML)
return; return;

View File

@@ -241,7 +241,7 @@ void ResourceEditorPlugin::onRefresh()
void ResourceEditorPlugin::addPrefixContextMenu() void ResourceEditorPlugin::addPrefixContextMenu()
{ {
auto topLevel = dynamic_cast<ResourceTopLevelNode *>(ProjectTree::findCurrentNode()); auto topLevel = dynamic_cast<ResourceTopLevelNode *>(ProjectTree::currentNode());
QTC_ASSERT(topLevel, return); QTC_ASSERT(topLevel, return);
PrefixLangDialog dialog(tr("Add Prefix"), QString(), QString(), Core::ICore::mainWindow()); PrefixLangDialog dialog(tr("Add Prefix"), QString(), QString(), Core::ICore::mainWindow());
if (dialog.exec() != QDialog::Accepted) if (dialog.exec() != QDialog::Accepted)
@@ -254,7 +254,7 @@ void ResourceEditorPlugin::addPrefixContextMenu()
void ResourceEditorPlugin::removePrefixContextMenu() void ResourceEditorPlugin::removePrefixContextMenu()
{ {
auto rfn = dynamic_cast<ResourceFolderNode *>(ProjectTree::findCurrentNode()); auto rfn = dynamic_cast<ResourceFolderNode *>(ProjectTree::currentNode());
QTC_ASSERT(rfn, return); QTC_ASSERT(rfn, return);
if (QMessageBox::question(Core::ICore::mainWindow(), if (QMessageBox::question(Core::ICore::mainWindow(),
tr("Remove Prefix"), tr("Remove Prefix"),
@@ -267,7 +267,7 @@ void ResourceEditorPlugin::removePrefixContextMenu()
void ResourceEditorPlugin::removeNonExisting() void ResourceEditorPlugin::removeNonExisting()
{ {
auto topLevel = dynamic_cast<ResourceTopLevelNode *>(ProjectTree::findCurrentNode()); auto topLevel = dynamic_cast<ResourceTopLevelNode *>(ProjectTree::currentNode());
QTC_ASSERT(topLevel, return); QTC_ASSERT(topLevel, return);
topLevel->removeNonExistingFiles(); topLevel->removeNonExistingFiles();
} }
@@ -279,7 +279,7 @@ void ResourceEditorPlugin::renameFileContextMenu()
void ResourceEditorPlugin::removeFileContextMenu() void ResourceEditorPlugin::removeFileContextMenu()
{ {
auto rfn = dynamic_cast<ResourceTopLevelNode *>(ProjectTree::findCurrentNode()); auto rfn = dynamic_cast<ResourceTopLevelNode *>(ProjectTree::currentNode());
QTC_ASSERT(rfn, return); QTC_ASSERT(rfn, return);
QString path = rfn->filePath().toString(); QString path = rfn->filePath().toString();
FolderNode *parent = rfn->parentFolderNode(); FolderNode *parent = rfn->parentFolderNode();
@@ -292,26 +292,26 @@ void ResourceEditorPlugin::removeFileContextMenu()
void ResourceEditorPlugin::openEditorContextMenu() void ResourceEditorPlugin::openEditorContextMenu()
{ {
Core::EditorManager::openEditor(ProjectTree::findCurrentNode()->filePath().toString()); Core::EditorManager::openEditor(ProjectTree::currentNode()->filePath().toString());
} }
void ResourceEditorPlugin::copyPathContextMenu() void ResourceEditorPlugin::copyPathContextMenu()
{ {
auto node = dynamic_cast<ResourceFileNode *>(ProjectTree::findCurrentNode()); auto node = dynamic_cast<ResourceFileNode *>(ProjectTree::currentNode());
QTC_ASSERT(node, return); QTC_ASSERT(node, return);
QApplication::clipboard()->setText(QLatin1String(resourcePrefix) + node->qrcPath()); QApplication::clipboard()->setText(QLatin1String(resourcePrefix) + node->qrcPath());
} }
void ResourceEditorPlugin::copyUrlContextMenu() void ResourceEditorPlugin::copyUrlContextMenu()
{ {
auto node = dynamic_cast<ResourceFileNode *>(ProjectTree::findCurrentNode()); auto node = dynamic_cast<ResourceFileNode *>(ProjectTree::currentNode());
QTC_ASSERT(node, return); QTC_ASSERT(node, return);
QApplication::clipboard()->setText(QLatin1String(urlPrefix) + node->qrcPath()); QApplication::clipboard()->setText(QLatin1String(urlPrefix) + node->qrcPath());
} }
void ResourceEditorPlugin::renamePrefixContextMenu() void ResourceEditorPlugin::renamePrefixContextMenu()
{ {
auto node = dynamic_cast<ResourceFolderNode *>(ProjectTree::findCurrentNode()); auto node = dynamic_cast<ResourceFolderNode *>(ProjectTree::currentNode());
QTC_ASSERT(node, return); QTC_ASSERT(node, return);
PrefixLangDialog dialog(tr("Rename Prefix"), node->prefix(), node->lang(), Core::ICore::mainWindow()); PrefixLangDialog dialog(tr("Rename Prefix"), node->prefix(), node->lang(), Core::ICore::mainWindow());
@@ -326,7 +326,7 @@ void ResourceEditorPlugin::renamePrefixContextMenu()
void ResourceEditorPlugin::updateContextActions() void ResourceEditorPlugin::updateContextActions()
{ {
const Node *node = ProjectTree::findCurrentNode(); const Node *node = ProjectTree::currentNode();
const bool isResourceNode = dynamic_cast<const ResourceTopLevelNode *>(node); const bool isResourceNode = dynamic_cast<const ResourceTopLevelNode *>(node);
m_addPrefix->setEnabled(isResourceNode); m_addPrefix->setEnabled(isResourceNode);
m_addPrefix->setVisible(isResourceNode); m_addPrefix->setVisible(isResourceNode);

View File

@@ -149,7 +149,7 @@ void TodoItemsProvider::setItemsListWithinStartupProject()
void TodoItemsProvider::setItemsListWithinSubproject() void TodoItemsProvider::setItemsListWithinSubproject()
{ {
// TODO prefer current editor as source of sub-project // TODO prefer current editor as source of sub-project
const Node *node = ProjectTree::findCurrentNode(); const Node *node = ProjectTree::currentNode();
if (node) { if (node) {
ProjectNode *projectNode = node->parentProjectNode(); ProjectNode *projectNode = node->parentProjectNode();
if (projectNode) { if (projectNode) {