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

Method fillContextMenu

kdevplatform/language/codegen/basicrefactoring.cpp:80–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78}
79
80void 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
101bool BasicRefactoring::shouldRenameUses(KDevelop::Declaration* declaration) const
102{

Callers

nothing calls this directly

Calls 12

strMethod · 0.80
setIconMethod · 0.80
IndexedDeclarationClass · 0.70
dataMethod · 0.45
declarationMethod · 0.45
urlMethod · 0.45
topContextMethod · 0.45
isWritableMethod · 0.45
toStringMethod · 0.45
qualifiedIdentifierMethod · 0.45
setDataMethod · 0.45
addActionMethod · 0.45

Tested by

no test coverage detected