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

Method contextMenuExtension

plugins/quickopen/quickopenplugin.cpp:415–440  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

413}
414
415ContextMenuExtension QuickOpenPlugin::contextMenuExtension(Context* context, QWidget* parent)
416{
417 KDevelop::ContextMenuExtension menuExt = KDevelop::IPlugin::contextMenuExtension(context, parent);
418
419 auto* codeContext = dynamic_cast<KDevelop::DeclarationContext*>(context);
420
421 if (!codeContext) {
422 return menuExt;
423 }
424
425 DUChainReadLocker readLock;
426 Declaration* decl(codeContext->declaration().data());
427
428 if (decl) {
429 const bool isDef = FunctionDefinition::definition(decl);
430 if (codeContext->use().isValid() || !isDef) {
431 menuExt.addAction(KDevelop::ContextMenuExtension::NavigationGroup, m_quickOpenDeclaration);
432 }
433
434 if (isDef) {
435 menuExt.addAction(KDevelop::ContextMenuExtension::NavigationGroup, m_quickOpenDefinition);
436 }
437 }
438
439 return menuExt;
440}
441
442void QuickOpenPlugin::showQuickOpen(const QStringList& items)
443{

Callers

nothing calls this directly

Calls 5

useMethod · 0.80
dataMethod · 0.45
declarationMethod · 0.45
isValidMethod · 0.45
addActionMethod · 0.45

Tested by

no test coverage detected