| 130 | } |
| 131 | |
| 132 | bool BasicRefactoring::shouldRenameFile(Declaration* declaration) |
| 133 | { |
| 134 | // only try to rename files when we renamed a class/struct |
| 135 | if (!dynamic_cast<ClassDeclaration*>(declaration)) { |
| 136 | return false; |
| 137 | } |
| 138 | const QUrl currUrl = declaration->topContext()->url().toUrl(); |
| 139 | const QString fileName = currUrl.fileName(); |
| 140 | const QPair<QString, QString> nameExtensionPair = splitFileAtExtension(fileName); |
| 141 | // check whether we renamed something that is called like the document it lives in |
| 142 | return nameExtensionPair.first.compare(declaration->identifier().toString(), Qt::CaseInsensitive) == 0; |
| 143 | } |
| 144 | |
| 145 | DocumentChangeSet::ChangeResult BasicRefactoring::applyChanges(const QString& oldName, const QString& newName, |
| 146 | DocumentChangeSet& changes, DUContext* context, |
no test coverage detected