| 413 | } |
| 414 | |
| 415 | ContextMenuExtension 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 | |
| 442 | void QuickOpenPlugin::showQuickOpen(const QStringList& items) |
| 443 | { |
nothing calls this directly
no test coverage detected