aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cppeditor/cppvirtualfunctionproposalitem.cpp
blob: 54ff3a056b7cf6407753382ffd978ce197d9670f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#include "cppvirtualfunctionproposalitem.h"

#include "cppeditorconstants.h"

#include <coreplugin/editormanager/editormanager.h>

namespace CppEditor {

VirtualFunctionProposalItem::VirtualFunctionProposalItem(
        const Utils::Link &link, bool openInSplit)
    : m_link(link), m_openInSplit(openInSplit)
{
}

void VirtualFunctionProposalItem::apply(TextEditor::TextDocumentManipulatorInterface &,
                                        int) const
{
    if (!m_link.hasValidTarget())
        return;

    Core::EditorManager::OpenEditorFlags flags = Core::EditorManager::NoFlags;
    if (m_openInSplit)
        flags |= Core::EditorManager::OpenInOtherSplit;
    Core::EditorManager::openEditorAt(m_link, CppEditor::Constants::CPPEDITOR_ID, flags);
}

} // namespace CppEditor