CppEditor: Move renameFilesForSymbol() to ProjectExplorer

We'd like to use it outside of CppEditor in the future.

Change-Id: Ie7553a17aa1d86fb898eaa315a1613ac0ff6b452
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2022-09-21 13:38:42 +02:00
parent 5e99a16e46
commit a522215840
7 changed files with 66 additions and 73 deletions

View File

@@ -15,6 +15,7 @@
#include <cppeditor/cpptoolsreuse.h>
#include <languageclient/languageclientsymbolsupport.h>
#include <languageserverprotocol/lsptypes.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectnodes.h>
#include <projectexplorer/projecttree.h>
#include <projectexplorer/session.h>
@@ -169,14 +170,10 @@ void ClangdFindReferences::Private::handleRenameRequest(
if (!renameFilesCheckBox->isChecked())
return;
QVector<Node *> fileNodes;
for (const Utils::FilePath &file : replacementData.fileRenameCandidates) {
Node * const node = ProjectTree::nodeForFile(file);
if (node)
fileNodes << node;
}
if (!fileNodes.isEmpty())
renameFilesForSymbol(replacementData.oldSymbolName, newSymbolName, fileNodes);
ProjectExplorerPlugin::renameFilesForSymbol(
replacementData.oldSymbolName, newSymbolName,
Utils::toList(replacementData.fileRenameCandidates),
CppEditor::preferLowerCaseFileNames());
}
void ClangdFindReferences::Private::handleFindUsagesResult(const QList<Location> &locations)