| 84 | } |
| 85 | |
| 86 | void RenameAction::execute() |
| 87 | { |
| 88 | Q_D(RenameAction); |
| 89 | |
| 90 | DocumentChangeSet changes; |
| 91 | |
| 92 | for (const RevisionedFileRanges& ranges : std::as_const(d->m_oldDeclarationUses)) { |
| 93 | for (const RangeInRevision range : ranges.ranges) { |
| 94 | KTextEditor::Range currentRange; |
| 95 | if (ranges.revision && ranges.revision->valid()) { |
| 96 | currentRange = ranges.revision->transformToCurrentRevision(range); |
| 97 | } else { |
| 98 | currentRange = range.castToSimpleRange(); |
| 99 | } |
| 100 | DocumentChange useRename(ranges.file, currentRange, |
| 101 | d->m_oldDeclarationName.toString(), d->m_newDeclarationName); |
| 102 | changes.addChange(useRename); |
| 103 | changes.setReplacementPolicy(DocumentChangeSet::WarnOnFailedChange); |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | DocumentChangeSet::ChangeResult result = changes.applyAllChanges(); |
| 108 | if (!result) { |
| 109 | auto* message = new Sublime::Message(i18n("Failed to apply changes: %1", result.m_failureReason), Sublime::Message::Error); |
| 110 | ICore::self()->uiController()->postMessage(message); |
| 111 | } |
| 112 | |
| 113 | emit executed(this); |
| 114 | } |
| 115 | |
| 116 | #include "moc_renameaction.cpp" |
nothing calls this directly
no test coverage detected