TextEditor: Move more code out of RefactoringChanges

The only callers are in RefactoringFile, so put the functions there.

Change-Id: I94141d759d32c20a334804e98dfeb262e10c5e11
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2023-11-17 12:31:43 +01:00
parent 1dafa53b3b
commit f163a4f9a1
2 changed files with 45 additions and 57 deletions

View File

@@ -59,7 +59,7 @@ public:
void appendReindentRange(const Range &range);
void setOpenEditor(bool activate = false, int pos = -1);
bool apply();
bool create(const QString &contents, bool reindent, bool openEditor);
bool create(const QString &contents, bool reindent, bool openInEditor);
protected:
// users may only get const access to RefactoringFiles created through
@@ -80,6 +80,10 @@ protected:
void setupFormattingRanges(const QList<Utils::ChangeSet::EditOp> &replaceList);
void doFormatting();
TextEditorWidget *openEditor(bool activate, int line, int column);
static RefactoringSelections rangesToSelections(QTextDocument *document,
const QList<Range> &ranges);
virtual void indentSelection(const QTextCursor &selection,
const TextDocument *textDocument) const;
virtual void reindentSelection(const QTextCursor &selection,
@@ -109,8 +113,6 @@ protected:
class TEXTEDITOR_EXPORT RefactoringChanges
{
public:
using Range = Utils::ChangeSet::Range;
virtual ~RefactoringChanges();
// TODO: Make pure virtual and introduce dedicated subclass for generic refactoring,
@@ -121,16 +123,6 @@ public:
const QString &contents,
bool reindent = true,
bool openEditor = true) const;
protected:
static TextEditorWidget *openEditor(const Utils::FilePath &filePath,
bool activate,
int line,
int column);
static RefactoringSelections rangesToSelections(QTextDocument *document,
const QList<Range> &ranges);
friend class RefactoringFile;
};
} // namespace TextEditor