| 78 | } |
| 79 | |
| 80 | void BasicRefactoring::fillContextMenu(ContextMenuExtension& extension, Context* context, QWidget* parent) |
| 81 | { |
| 82 | auto* declContext = dynamic_cast<DeclarationContext*>(context); |
| 83 | if (!declContext) |
| 84 | return; |
| 85 | |
| 86 | DUChainReadLocker lock; |
| 87 | Declaration* declaration = declContext->declaration().data(); |
| 88 | if (declaration && acceptForContextMenu(declaration)) { |
| 89 | QFileInfo finfo(declaration->topContext()->url().str()); |
| 90 | if (finfo.isWritable()) { |
| 91 | auto* action = new QAction(i18nc("@action", "Rename \"%1\"...", |
| 92 | declaration->qualifiedIdentifier().toString()), parent); |
| 93 | action->setData(QVariant::fromValue(IndexedDeclaration(declaration))); |
| 94 | action->setIcon(QIcon::fromTheme(QStringLiteral("edit-rename"))); |
| 95 | connect(action, &QAction::triggered, this, &BasicRefactoring::executeRenameAction); |
| 96 | extension.addAction(ContextMenuExtension::RefactorGroup, action); |
| 97 | } |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | bool BasicRefactoring::shouldRenameUses(KDevelop::Declaration* declaration) const |
| 102 | { |
nothing calls this directly
no test coverage detected