| 362 | } |
| 363 | |
| 364 | void ContextBrowserPlugin::showUsesDelayed(const DeclarationPointer& declaration) |
| 365 | { |
| 366 | DUChainReadLocker lock; |
| 367 | |
| 368 | Declaration* decl = declaration.data(); |
| 369 | if (!decl) { |
| 370 | return; |
| 371 | } |
| 372 | QWidget* toolView = ICore::self()->uiController()->findToolView(i18nc("@title:window", "Code Browser"), m_viewFactory, |
| 373 | KDevelop::IUiController::CreateAndRaise); |
| 374 | if (!toolView) { |
| 375 | return; |
| 376 | } |
| 377 | auto* view = qobject_cast<ContextBrowserView*>(toolView); |
| 378 | Q_ASSERT(view); |
| 379 | view->allowLockedUpdate(); |
| 380 | view->setDeclaration(decl, decl->topContext(), true); |
| 381 | //We may get deleted while the call to acceptLink, so make sure we don't crash in that case |
| 382 | QPointer<AbstractNavigationWidget> widget = qobject_cast<AbstractNavigationWidget*>(view->navigationWidget()); |
| 383 | if (widget && widget->context()) { |
| 384 | auto nextContext = widget->context()->execute( |
| 385 | NavigationAction(declaration, KDevelop::NavigationAction::ShowUses)); |
| 386 | |
| 387 | if (widget) { |
| 388 | widget->setContext(nextContext); |
| 389 | } |
| 390 | } |
| 391 | } |
| 392 | |
| 393 | void ContextBrowserPlugin::findUses() |
| 394 | { |
nothing calls this directly
no test coverage detected