| 792 | struct CreateOutlineDialog |
| 793 | { |
| 794 | void start() |
| 795 | { |
| 796 | if (!QuickOpenPlugin::self()->freeModel()) { |
| 797 | return; |
| 798 | } |
| 799 | |
| 800 | IDocument* doc = ICore::self()->documentController()->activeDocument(); |
| 801 | if (!doc) { |
| 802 | qCDebug(PLUGIN_QUICKOPEN) << "No active document"; |
| 803 | return; |
| 804 | } |
| 805 | |
| 806 | DUChainReadLocker lock; |
| 807 | |
| 808 | TopDUContext* context = DUChainUtils::standardContextForUrl(doc->url()); |
| 809 | |
| 810 | if (!context) { |
| 811 | qCDebug(PLUGIN_QUICKOPEN) << "Got no standard context"; |
| 812 | return; |
| 813 | } |
| 814 | |
| 815 | model = new QuickOpenModel(nullptr); |
| 816 | |
| 817 | OutlineFilter filter(items); |
| 818 | |
| 819 | DUChainUtils::collectItems(context, filter); |
| 820 | |
| 821 | if (noHtmlDestriptionInOutline) { |
| 822 | for (auto& item : items) { |
| 823 | item.m_noHtmlDestription = true; |
| 824 | } |
| 825 | } |
| 826 | |
| 827 | cursorDecl = cursorContextDeclaration(); |
| 828 | |
| 829 | model->registerProvider(QStringList(), QStringList(), new DeclarationListDataProvider(QuickOpenPlugin::self(), items, true)); |
| 830 | |
| 831 | dialog = new QuickOpenWidgetDialog(i18nc("@title:window", "Outline"), model, QStringList(), QStringList(), true); |
| 832 | dialog->widget()->setSortingEnabled(true); |
| 833 | |
| 834 | model->setParent(dialog->widget()); |
| 835 | } |
| 836 | void finish() |
| 837 | { |
| 838 | //Select the declaration that contains the cursor |
no test coverage detected