TextEditor: Remove RefactoringChanges::createFile()

Dissolve into only caller.

Change-Id: I2eaac8bf31c0ecd2dfb863b7fae79af557ccad95
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2023-11-17 12:36:19 +01:00
parent fabef397f9
commit e7073421cc
3 changed files with 1 additions and 14 deletions

View File

@@ -166,7 +166,7 @@ public:
const bool reindent = true; const bool reindent = true;
const bool openEditor = false; const bool openEditor = false;
const Utils::FilePath newFilePath = newFileName; const Utils::FilePath newFilePath = newFileName;
if (!refactoring.createFile(newFileName, newComponentSource, reindent, openEditor)) if (!refactoring.file(newFileName)->create(newComponentSource, reindent, openEditor))
return; return;
if (path.toString() == currentFileName.toFileInfo().path()) { if (path.toString() == currentFileName.toFileInfo().path()) {

View File

@@ -28,14 +28,6 @@ namespace TextEditor {
RefactoringChanges::~RefactoringChanges() = default; RefactoringChanges::~RefactoringChanges() = default;
bool RefactoringChanges::createFile(const FilePath &filePath,
const QString &contents,
bool reindent,
bool openEditor) const
{
return file(filePath)->create(contents, reindent, openEditor);
}
RefactoringFilePtr RefactoringChanges::file(const FilePath &filePath) const RefactoringFilePtr RefactoringChanges::file(const FilePath &filePath) const
{ {
return RefactoringFilePtr(new RefactoringFile(filePath)); return RefactoringFilePtr(new RefactoringFile(filePath));

View File

@@ -118,11 +118,6 @@ public:
// TODO: Make pure virtual and introduce dedicated subclass for generic refactoring, // TODO: Make pure virtual and introduce dedicated subclass for generic refactoring,
// so no one instantiates this one by mistake. // so no one instantiates this one by mistake.
virtual RefactoringFilePtr file(const Utils::FilePath &filePath) const; virtual RefactoringFilePtr file(const Utils::FilePath &filePath) const;
bool createFile(const Utils::FilePath &filePath,
const QString &contents,
bool reindent = true,
bool openEditor = true) const;
}; };
} // namespace TextEditor } // namespace TextEditor