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()
|
void ClangFixItOperation::perform()
|
||||||
{
|
{
|
||||||
const TextEditor::RefactoringChanges refactoringChanges;
|
const TextEditor::RefactoringFileFactory refactoringChanges;
|
||||||
const FileToFixits fileToFixIts = fixitsPerFile(fixIts);
|
const FileToFixits fileToFixIts = fixitsPerFile(fixIts);
|
||||||
|
|
||||||
for (auto i = fileToFixIts.cbegin(), end = fileToFixIts.cend(); i != end; ++i) {
|
for (auto i = fileToFixIts.cbegin(), end = fileToFixIts.cend(); i != end; ++i) {
|
||||||
|
|||||||
@@ -12,10 +12,7 @@
|
|||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
|
|
||||||
namespace TextEditor {
|
namespace TextEditor { class RefactoringFile; }
|
||||||
class RefactoringChanges;
|
|
||||||
class RefactoringFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace ClangCodeModel {
|
namespace ClangCodeModel {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ static Range toRange(const QTextDocument *doc, DiagnosticRange locations)
|
|||||||
|
|
||||||
void ClangToolQuickFixOperation::perform()
|
void ClangToolQuickFixOperation::perform()
|
||||||
{
|
{
|
||||||
TextEditor::RefactoringChanges changes;
|
TextEditor::RefactoringFileFactory changes;
|
||||||
QMap<QString, TextEditor::RefactoringFilePtr> refactoringFiles;
|
QMap<QString, TextEditor::RefactoringFilePtr> refactoringFiles;
|
||||||
|
|
||||||
for (const ExplainingStep &step : m_diagnostic.explainingSteps) {
|
for (const ExplainingStep &step : m_diagnostic.explainingSteps) {
|
||||||
|
|||||||
@@ -1839,7 +1839,7 @@ void CppModelManager::renameIncludes(const FilePath &oldFilePath, const FilePath
|
|||||||
if (oldFilePath.absolutePath() != newFilePath.absolutePath())
|
if (oldFilePath.absolutePath() != newFilePath.absolutePath())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const TextEditor::RefactoringChanges changes;
|
const TextEditor::RefactoringFileFactory changes;
|
||||||
|
|
||||||
QString oldFileName = oldFilePath.fileName();
|
QString oldFileName = oldFilePath.fileName();
|
||||||
QString newFileName = newFilePath.fileName();
|
QString newFileName = newFilePath.fileName();
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ public:
|
|||||||
WorkingCopy m_workingCopy;
|
WorkingCopy m_workingCopy;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CPPEDITOR_EXPORT CppRefactoringChanges: public TextEditor::RefactoringChanges
|
class CPPEDITOR_EXPORT CppRefactoringChanges: public TextEditor::RefactoringFileFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit CppRefactoringChanges(const CPlusPlus::Snapshot &snapshot);
|
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
|
TextEditor::RefactoringFilePtr Client::createRefactoringFile(const FilePath &filePath) const
|
||||||
{
|
{
|
||||||
return TextEditor::RefactoringChanges().file(filePath);
|
return TextEditor::RefactoringFileFactory().file(filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::setCompletionResultsLimit(int limit)
|
void Client::setCompletionResultsLimit(int limit)
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
using namespace QmlJS;
|
using namespace QmlJS;
|
||||||
using namespace QmlJS::AST;
|
using namespace QmlJS::AST;
|
||||||
using namespace QmlJSTools;
|
using namespace QmlJSTools;
|
||||||
using TextEditor::RefactoringChanges;
|
using TextEditor::RefactoringFileFactory;
|
||||||
|
|
||||||
namespace QmlJSEditor {
|
namespace QmlJSEditor {
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class QMLJSTOOLS_EXPORT QmlJSRefactoringChanges: public TextEditor::RefactoringChanges
|
class QMLJSTOOLS_EXPORT QmlJSRefactoringChanges: public TextEditor::RefactoringFileFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QmlJSRefactoringChanges(QmlJS::ModelManagerInterface *modelManager,
|
QmlJSRefactoringChanges(QmlJS::ModelManagerInterface *modelManager,
|
||||||
|
|||||||
@@ -539,7 +539,7 @@ FilePaths BaseFileFind::replaceAll(const QString &text, const SearchResultItems
|
|||||||
if (items.isEmpty())
|
if (items.isEmpty())
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
RefactoringChanges refactoring;
|
RefactoringFileFactory refactoring;
|
||||||
|
|
||||||
QHash<FilePath, SearchResultItems> changes;
|
QHash<FilePath, SearchResultItems> changes;
|
||||||
for (const SearchResultItem &item : items)
|
for (const SearchResultItem &item : items)
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ using namespace Utils;
|
|||||||
|
|
||||||
namespace TextEditor {
|
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));
|
return RefactoringFilePtr(new RefactoringFile(filePath));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,9 +22,9 @@ QT_END_NAMESPACE
|
|||||||
namespace TextEditor {
|
namespace TextEditor {
|
||||||
class TextDocument;
|
class TextDocument;
|
||||||
class TextEditorWidget;
|
class TextEditorWidget;
|
||||||
class RefactoringChanges;
|
|
||||||
class RefactoringFile;
|
class RefactoringFile;
|
||||||
using RefactoringFilePtr = QSharedPointer<RefactoringFile>;
|
using RefactoringFilePtr = QSharedPointer<RefactoringFile>;
|
||||||
|
class RefactoringFileFactory;
|
||||||
using RefactoringSelections = QVector<QPair<QTextCursor, QTextCursor>>;
|
using RefactoringSelections = QVector<QPair<QTextCursor, QTextCursor>>;
|
||||||
|
|
||||||
// ### listen to the m_editor::destroyed signal?
|
// ### listen to the m_editor::destroyed signal?
|
||||||
@@ -103,17 +103,13 @@ protected:
|
|||||||
bool m_appliedOnce = false;
|
bool m_appliedOnce = false;
|
||||||
bool m_formattingEnabled = false;
|
bool m_formattingEnabled = false;
|
||||||
|
|
||||||
friend class RefactoringChanges; // access to constructor
|
friend class RefactoringFileFactory; // access to constructor
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
class TEXTEDITOR_EXPORT RefactoringFileFactory
|
||||||
This class batches changes to multiple file, which are applied as a single big
|
|
||||||
change.
|
|
||||||
*/
|
|
||||||
class TEXTEDITOR_EXPORT RefactoringChanges
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~RefactoringChanges();
|
virtual ~RefactoringFileFactory();
|
||||||
|
|
||||||
// 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.
|
||||||
|
|||||||
@@ -514,7 +514,7 @@ bool TextDocument::applyChangeSet(const ChangeSet &changeSet)
|
|||||||
{
|
{
|
||||||
if (changeSet.isEmpty())
|
if (changeSet.isEmpty())
|
||||||
return true;
|
return true;
|
||||||
RefactoringChanges changes;
|
RefactoringFileFactory changes;
|
||||||
const RefactoringFilePtr file = changes.file(filePath());
|
const RefactoringFilePtr file = changes.file(filePath());
|
||||||
file->setChangeSet(changeSet);
|
file->setChangeSet(changeSet);
|
||||||
return file->apply();
|
return file->apply();
|
||||||
|
|||||||
Reference in New Issue
Block a user