MCPcopy Create free account
hub / github.com/KDE/kdevelop / execute

Method execute

kdevplatform/language/assistant/renameaction.cpp:86–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84}
85
86void 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"

Callers

nothing calls this directly

Calls 8

addChangeMethod · 0.80
setReplacementPolicyMethod · 0.80
applyAllChangesMethod · 0.80
uiControllerMethod · 0.80
validMethod · 0.45
toStringMethod · 0.45
postMessageMethod · 0.45

Tested by

no test coverage detected