forked from qt-creator/qt-creator
TextEditor: Rename class RefactoringChanges
... and remove outdated comment. Change-Id: I6dcd0a38608192ccdd6734affd33e170d39e8299 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -12,10 +12,7 @@
|
||||
#include <QVector>
|
||||
#include <QSharedPointer>
|
||||
|
||||
namespace TextEditor {
|
||||
class RefactoringChanges;
|
||||
class RefactoringFile;
|
||||
}
|
||||
namespace TextEditor { class RefactoringFile; }
|
||||
|
||||
namespace ClangCodeModel {
|
||||
namespace Internal {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
using namespace QmlJS;
|
||||
using namespace QmlJS::AST;
|
||||
using namespace QmlJSTools;
|
||||
using TextEditor::RefactoringChanges;
|
||||
using TextEditor::RefactoringFileFactory;
|
||||
|
||||
namespace QmlJSEditor {
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class QMLJSTOOLS_EXPORT QmlJSRefactoringChanges: public TextEditor::RefactoringChanges
|
||||
class QMLJSTOOLS_EXPORT QmlJSRefactoringChanges: public TextEditor::RefactoringFileFactory
|
||||
{
|
||||
public:
|
||||
QmlJSRefactoringChanges(QmlJS::ModelManagerInterface *modelManager,
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user