1 /*
2 SPDX-FileCopyrightText: 2011-2013 Sven Brauch <svenbrauch@googlemail.com>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7 #include "pythonducontext.h"
8
9 #include <language/duchain/topducontext.h>
10 #include <language/duchain/topducontextdata.h>
11 #include <language/duchain/duchainregister.h>
12 #include <language/duchain/duchainpointer.h>
13
14 #include "navigation/navigationwidget.h"
15
16 #include <QDebug>
17 #include "duchaindebug.h"
18
19 using namespace KDevelop;
20
21 namespace Python {
22
23 REGISTER_DUCHAIN_ITEM_WITH_DATA(PythonTopDUContext, TopDUContextData);
24
25 REGISTER_DUCHAIN_ITEM_WITH_DATA(PythonNormalDUContext, DUContextData);
26
27 template<>
createNavigationWidget(Declaration * decl,TopDUContext * topContext,KDevelop::AbstractNavigationWidget::DisplayHints hints) const28 KDevelop::AbstractNavigationWidget* PythonTopDUContext::createNavigationWidget(Declaration* decl, TopDUContext* topContext,
29 KDevelop::AbstractNavigationWidget::DisplayHints hints) const {
30 if ( ! decl ) {
31 qCDebug(KDEV_PYTHON_DUCHAIN) << "no declaration, not returning navigationwidget";
32 return nullptr;
33 }
34 return new NavigationWidget(DeclarationPointer(decl), TopDUContextPointer(topContext), hints);
35 }
36
37 template<>
createNavigationWidget(Declaration * decl,TopDUContext * topContext,KDevelop::AbstractNavigationWidget::DisplayHints hints) const38 KDevelop::AbstractNavigationWidget* PythonNormalDUContext::createNavigationWidget(Declaration* decl, TopDUContext* topContext,
39 KDevelop::AbstractNavigationWidget::DisplayHints hints) const {
40 if ( ! decl ) {
41 qCDebug(KDEV_PYTHON_DUCHAIN) << "no declaration, not returning navigationwidget";
42 return nullptr;
43 }
44 return new NavigationWidget(DeclarationPointer(decl), TopDUContextPointer(topContext), hints);
45 }
46
47 }
48