TextEditor: Rename class RefactoringChanges

... and remove outdated comment.

Change-Id: I6dcd0a38608192ccdd6734affd33e170d39e8299
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2023-11-17 12:44:49 +01:00
parent e7073421cc
commit 78b9edd251
12 changed files with 16 additions and 23 deletions

View File

@@ -46,7 +46,7 @@ static FileToFixits fixitsPerFile(const QList<ClangFixIt> &fixIts)
void ClangFixItOperation::perform()
{
const TextEditor::RefactoringChanges refactoringChanges;
const TextEditor::RefactoringFileFactory refactoringChanges;
const FileToFixits fileToFixIts = fixitsPerFile(fixIts);
for (auto i = fileToFixIts.cbegin(), end = fileToFixIts.cend(); i != end; ++i) {

View File

@@ -12,10 +12,7 @@
#include <QVector>
#include <QSharedPointer>
namespace TextEditor {
class RefactoringChanges;
class RefactoringFile;
}
namespace TextEditor { class RefactoringFile; }
namespace ClangCodeModel {
namespace Internal {

View File

@@ -41,7 +41,7 @@ static Range toRange(const QTextDocument *doc, DiagnosticRange locations)
void ClangToolQuickFixOperation::perform()
{
TextEditor::RefactoringChanges changes;
TextEditor::RefactoringFileFactory changes;
QMap<QString, TextEditor::RefactoringFilePtr> refactoringFiles;
for (const ExplainingStep &step : m_diagnostic.explainingSteps) {

View File

@@ -1839,7 +1839,7 @@ void CppModelManager::renameIncludes(const FilePath &oldFilePath, const FilePath
if (oldFilePath.absolutePath() != newFilePath.absolutePath())
return;
const TextEditor::RefactoringChanges changes;
const TextEditor::RefactoringFileFactory changes;
QString oldFileName = oldFilePath.fileName();
QString newFileName = newFilePath.fileName();

View File

@@ -81,7 +81,7 @@ public:
WorkingCopy m_workingCopy;
};
class CPPEDITOR_EXPORT CppRefactoringChanges: public TextEditor::RefactoringChanges
class CPPEDITOR_EXPORT CppRefactoringChanges: public TextEditor::RefactoringFileFactory
{
public:
explicit CppRefactoringChanges(const CPlusPlus::Snapshot &snapshot);

View File

@@ -1739,7 +1739,7 @@ void Client::log(const QString &message) const
TextEditor::RefactoringFilePtr Client::createRefactoringFile(const FilePath &filePath) const
{
return TextEditor::RefactoringChanges().file(filePath);
return TextEditor::RefactoringFileFactory().file(filePath);
}
void Client::setCompletionResultsLimit(int limit)

View File

@@ -15,7 +15,7 @@
using namespace QmlJS;
using namespace QmlJS::AST;
using namespace QmlJSTools;
using TextEditor::RefactoringChanges;
using TextEditor::RefactoringFileFactory;
namespace QmlJSEditor {

View File

@@ -52,7 +52,7 @@ private:
};
class QMLJSTOOLS_EXPORT QmlJSRefactoringChanges: public TextEditor::RefactoringChanges
class QMLJSTOOLS_EXPORT QmlJSRefactoringChanges: public TextEditor::RefactoringFileFactory
{
public:
QmlJSRefactoringChanges(QmlJS::ModelManagerInterface *modelManager,

View File

@@ -539,7 +539,7 @@ FilePaths BaseFileFind::replaceAll(const QString &text, const SearchResultItems
if (items.isEmpty())
return {};
RefactoringChanges refactoring;
RefactoringFileFactory refactoring;
QHash<FilePath, SearchResultItems> changes;
for (const SearchResultItem &item : items)

View File

@@ -26,9 +26,9 @@ using namespace Utils;
namespace TextEditor {
RefactoringChanges::~RefactoringChanges() = default;
RefactoringFileFactory::~RefactoringFileFactory() = default;
RefactoringFilePtr RefactoringChanges::file(const FilePath &filePath) const
RefactoringFilePtr RefactoringFileFactory::file(const FilePath &filePath) const
{
return RefactoringFilePtr(new RefactoringFile(filePath));
}

View File

@@ -22,9 +22,9 @@ QT_END_NAMESPACE
namespace TextEditor {
class TextDocument;
class TextEditorWidget;
class RefactoringChanges;
class RefactoringFile;
using RefactoringFilePtr = QSharedPointer<RefactoringFile>;
class RefactoringFileFactory;
using RefactoringSelections = QVector<QPair<QTextCursor, QTextCursor>>;
// ### listen to the m_editor::destroyed signal?
@@ -103,17 +103,13 @@ protected:
bool m_appliedOnce = false;
bool m_formattingEnabled = false;
friend class RefactoringChanges; // access to constructor
friend class RefactoringFileFactory; // access to constructor
};
/*!
This class batches changes to multiple file, which are applied as a single big
change.
*/
class TEXTEDITOR_EXPORT RefactoringChanges
class TEXTEDITOR_EXPORT RefactoringFileFactory
{
public:
virtual ~RefactoringChanges();
virtual ~RefactoringFileFactory();
// TODO: Make pure virtual and introduce dedicated subclass for generic refactoring,
// so no one instantiates this one by mistake.

View File

@@ -514,7 +514,7 @@ bool TextDocument::applyChangeSet(const ChangeSet &changeSet)
{
if (changeSet.isEmpty())
return true;
RefactoringChanges changes;
RefactoringFileFactory changes;
const RefactoringFilePtr file = changes.file(filePath());
file->setChangeSet(changeSet);
return file->apply();