From 548e19370e492a1fbaaa5533d819c837f81c3e99 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 2 Sep 2021 12:15:59 +0200 Subject: [PATCH] CppEditor: Remove CppToolsBridge & friends This redirection did nothing except to horribly obfuscate the code. Note that most callers already accessed the model manager directly, and some bridge functions were not called at all. Change-Id: Ic1c728afe79bf98544da23a1955ee82d0dbde94f Reviewed-by: Qt CI Bot Reviewed-by: Christian Stenger --- .../clangbackendcommunicator.cpp | 3 +- .../clangcodemodel/clangbackendreceiver.cpp | 2 - .../clangcompletionassistprocessor.cpp | 1 - .../clangeditordocumentprocessor.cpp | 6 +- src/plugins/cppeditor/CMakeLists.txt | 3 - .../cppeditor/baseeditordocumentprocessor.cpp | 3 +- .../cppeditor/cppcodemodelinspectordialog.cpp | 3 +- src/plugins/cppeditor/cppeditor.pro | 5 - src/plugins/cppeditor/cppeditor.qbs | 5 - src/plugins/cppeditor/cppeditorplugin.cpp | 4 - src/plugins/cppeditor/cppincludehierarchy.cpp | 3 +- src/plugins/cppeditor/cppmodelmanager.cpp | 6 ++ src/plugins/cppeditor/cppmodelmanager.h | 1 + src/plugins/cppeditor/cppquickfixes.cpp | 4 +- .../cppeditor/cppsourceprocessor_test.cpp | 3 +- src/plugins/cppeditor/cpptoolsbridge.cpp | 66 ------------- src/plugins/cppeditor/cpptoolsbridge.h | 57 ----------- .../cppeditor/cpptoolsbridgeinterface.h | 51 ---------- .../cpptoolsbridgeqtcreatorimplementation.cpp | 94 ------------------- .../cpptoolsbridgeqtcreatorimplementation.h | 42 --------- 20 files changed, 16 insertions(+), 346 deletions(-) delete mode 100644 src/plugins/cppeditor/cpptoolsbridge.cpp delete mode 100644 src/plugins/cppeditor/cpptoolsbridge.h delete mode 100644 src/plugins/cppeditor/cpptoolsbridgeinterface.h delete mode 100644 src/plugins/cppeditor/cpptoolsbridgeqtcreatorimplementation.cpp delete mode 100644 src/plugins/cppeditor/cpptoolsbridgeqtcreatorimplementation.h diff --git a/src/plugins/clangcodemodel/clangbackendcommunicator.cpp b/src/plugins/clangcodemodel/clangbackendcommunicator.cpp index 0b6136d535b..679b47677c4 100644 --- a/src/plugins/clangcodemodel/clangbackendcommunicator.cpp +++ b/src/plugins/clangcodemodel/clangbackendcommunicator.cpp @@ -39,7 +39,6 @@ #include #include #include -#include #include #include @@ -164,7 +163,7 @@ void removeNonCppEditors(QList &visibleEditors) Utf8StringVector visibleCppEditorDocumentsFilePaths() { - auto visibleEditors = CppEditor::CppToolsBridge::visibleEditors(); + auto visibleEditors = Core::EditorManager::visibleEditors(); removeNonCppEditors(visibleEditors); diff --git a/src/plugins/clangcodemodel/clangbackendreceiver.cpp b/src/plugins/clangcodemodel/clangbackendreceiver.cpp index 34c05d9676f..1346fbe8d0e 100644 --- a/src/plugins/clangcodemodel/clangbackendreceiver.cpp +++ b/src/plugins/clangcodemodel/clangbackendreceiver.cpp @@ -30,8 +30,6 @@ #include "clangcompletionassistprocessor.h" #include "clangeditordocumentprocessor.h" -#include - #include #include diff --git a/src/plugins/clangcodemodel/clangcompletionassistprocessor.cpp b/src/plugins/clangcodemodel/clangcompletionassistprocessor.cpp index 6bc86339c2d..363aac03c38 100644 --- a/src/plugins/clangcodemodel/clangcompletionassistprocessor.cpp +++ b/src/plugins/clangcodemodel/clangcompletionassistprocessor.cpp @@ -36,7 +36,6 @@ #include #include -#include #include #include diff --git a/src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp b/src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp index 5ba395d94b6..a9d4f01c726 100644 --- a/src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp +++ b/src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp @@ -42,7 +42,6 @@ #include #include #include -#include #include #include #include @@ -416,9 +415,8 @@ void ClangEditorDocumentProcessor::clearDiagnosticsWithFixIts() ClangEditorDocumentProcessor *ClangEditorDocumentProcessor::get(const QString &filePath) { - auto *processor = CppEditor::CppToolsBridge::baseEditorDocumentProcessor(filePath); - - return qobject_cast(processor); + return qobject_cast( + CppEditor::CppModelManager::cppEditorDocumentProcessor(filePath)); } static bool isProjectPartLoadedOrIsFallback(CppEditor::ProjectPart::ConstPtr projectPart) diff --git a/src/plugins/cppeditor/CMakeLists.txt b/src/plugins/cppeditor/CMakeLists.txt index c53b5a57360..b481c562d29 100644 --- a/src/plugins/cppeditor/CMakeLists.txt +++ b/src/plugins/cppeditor/CMakeLists.txt @@ -96,9 +96,6 @@ add_qtc_plugin(CppEditor cppsemanticinfoupdater.cpp cppsemanticinfoupdater.h cppsourceprocessor.cpp cppsourceprocessor.h cppsymbolinfo.h - cpptoolsbridge.cpp cpptoolsbridge.h - cpptoolsbridgeinterface.h - cpptoolsbridgeqtcreatorimplementation.cpp cpptoolsbridgeqtcreatorimplementation.h cpptoolsjsextension.cpp cpptoolsjsextension.h cpptoolsreuse.cpp cpptoolsreuse.h cpptoolssettings.cpp cpptoolssettings.h diff --git a/src/plugins/cppeditor/baseeditordocumentprocessor.cpp b/src/plugins/cppeditor/baseeditordocumentprocessor.cpp index 57732174009..2f2b16461fc 100644 --- a/src/plugins/cppeditor/baseeditordocumentprocessor.cpp +++ b/src/plugins/cppeditor/baseeditordocumentprocessor.cpp @@ -28,7 +28,6 @@ #include "cppcodemodelsettings.h" #include "cppeditor_utils.h" #include "cppmodelmanager.h" -#include "cpptoolsbridge.h" #include "cpptoolsreuse.h" #include "editordocumenthandle.h" @@ -104,7 +103,7 @@ void BaseEditorDocumentProcessor::runParser(QFutureInterface &future, } parser->update(future, updateParams); - CppToolsBridge::finishedRefreshingSourceFiles({parser->filePath()}); + CppModelManager::instance()->finishedRefreshingSourceFiles({parser->filePath()}); future.setProgressValue(1); } diff --git a/src/plugins/cppeditor/cppcodemodelinspectordialog.cpp b/src/plugins/cppeditor/cppcodemodelinspectordialog.cpp index a19a895c60d..f5a0a5025af 100644 --- a/src/plugins/cppeditor/cppcodemodelinspectordialog.cpp +++ b/src/plugins/cppeditor/cppcodemodelinspectordialog.cpp @@ -31,7 +31,6 @@ #include "cppeditorwidget.h" #include "cppeditordocument.h" #include "cppmodelmanager.h" -#include "cpptoolsbridge.h" #include "cpptoolsreuse.h" #include "cppworkingcopy.h" @@ -1539,7 +1538,7 @@ void CppCodeModelInspectorDialog::refresh() if (editor) { const QString editorFilePath = editor->document()->filePath().toString(); cppEditorDocument = cmmi->cppEditorDocument(editorFilePath); - if (auto documentProcessor = CppToolsBridge::baseEditorDocumentProcessor(editorFilePath)) { + if (auto documentProcessor = CppModelManager::cppEditorDocumentProcessor(editorFilePath)) { const Snapshot editorSnapshot = documentProcessor->snapshot(); m_snapshotInfos->append(SnapshotInfo(editorSnapshot, SnapshotInfo::EditorSnapshot)); const QString editorSnapshotTitle diff --git a/src/plugins/cppeditor/cppeditor.pro b/src/plugins/cppeditor/cppeditor.pro index c4c5fa8b43b..5e5810d4604 100644 --- a/src/plugins/cppeditor/cppeditor.pro +++ b/src/plugins/cppeditor/cppeditor.pro @@ -91,9 +91,6 @@ HEADERS += \ cppsemanticinfoupdater.h \ cppsourceprocessor.h \ cppsymbolinfo.h \ - cpptoolsbridge.h \ - cpptoolsbridgeinterface.h \ - cpptoolsbridgeqtcreatorimplementation.h \ cpptoolsjsextension.h \ cpptoolsreuse.h \ cpptoolssettings.h \ @@ -205,8 +202,6 @@ SOURCES += \ cppselectionchanger.cpp \ cppsemanticinfoupdater.cpp \ cppsourceprocessor.cpp \ - cpptoolsbridge.cpp \ - cpptoolsbridgeqtcreatorimplementation.cpp \ cpptoolsjsextension.cpp \ cpptoolsreuse.cpp \ cpptoolssettings.cpp \ diff --git a/src/plugins/cppeditor/cppeditor.qbs b/src/plugins/cppeditor/cppeditor.qbs index cdaeb40514e..14412320716 100644 --- a/src/plugins/cppeditor/cppeditor.qbs +++ b/src/plugins/cppeditor/cppeditor.qbs @@ -205,11 +205,6 @@ QtcPlugin { "cppsourceprocessor.cpp", "cppsourceprocessor.h", "cppsymbolinfo.h", - "cpptoolsbridge.cpp", - "cpptoolsbridge.h", - "cpptoolsbridgeinterface.h", - "cpptoolsbridgeqtcreatorimplementation.cpp", - "cpptoolsbridgeqtcreatorimplementation.h", "cpptoolsjsextension.cpp", "cpptoolsjsextension.h", "cpptoolsreuse.cpp", diff --git a/src/plugins/cppeditor/cppeditorplugin.cpp b/src/plugins/cppeditor/cppeditorplugin.cpp index 11816eb196d..af7f9d68602 100644 --- a/src/plugins/cppeditor/cppeditorplugin.cpp +++ b/src/plugins/cppeditor/cppeditorplugin.cpp @@ -44,8 +44,6 @@ #include "cppquickfixes.h" #include "cppquickfixprojectsettingswidget.h" #include "cppquickfixsettingspage.h" -#include "cpptoolsbridge.h" -#include "cpptoolsbridgeqtcreatorimplementation.h" #include "cpptoolsreuse.h" #include "cpptoolssettings.h" #include "cpptypehierarchy.h" @@ -227,8 +225,6 @@ static QHash m_headerSourceMapping; CppEditorPlugin::CppEditorPlugin() { m_instance = this; - CppToolsBridge::setCppToolsBridgeImplementation( - std::make_unique()); } CppEditorPlugin::~CppEditorPlugin() diff --git a/src/plugins/cppeditor/cppincludehierarchy.cpp b/src/plugins/cppeditor/cppincludehierarchy.cpp index 6a711709ce5..b11c4f28028 100644 --- a/src/plugins/cppeditor/cppincludehierarchy.cpp +++ b/src/plugins/cppeditor/cppincludehierarchy.cpp @@ -33,7 +33,6 @@ #include "cppeditorplugin.h" #include "cppelementevaluator.h" #include "cppmodelmanager.h" -#include "cpptoolsbridge.h" #include #include @@ -224,7 +223,7 @@ void CppIncludeHierarchyItem::fetchMore() setChildrenChecked(); if (m_subTree == InIncludes) { - auto processor = CppToolsBridge::baseEditorDocumentProcessor(editorFilePath); + auto processor = CppModelManager::cppEditorDocumentProcessor(editorFilePath); QTC_ASSERT(processor, return); const Snapshot snapshot = processor->snapshot(); const FileAndLines includes = findIncludes(filePath(), snapshot); diff --git a/src/plugins/cppeditor/cppmodelmanager.cpp b/src/plugins/cppeditor/cppmodelmanager.cpp index 933af040bd5..3cf9a043460 100644 --- a/src/plugins/cppeditor/cppmodelmanager.cpp +++ b/src/plugins/cppeditor/cppmodelmanager.cpp @@ -849,6 +849,12 @@ CppEditorDocumentHandle *CppModelManager::cppEditorDocument(const QString &fileP return d->m_cppEditorDocuments.value(filePath, 0); } +BaseEditorDocumentProcessor *CppModelManager::cppEditorDocumentProcessor(const QString &filePath) +{ + const auto document = instance()->cppEditorDocument(filePath); + return document ? document->processor() : nullptr; +} + void CppModelManager::registerCppEditorDocument(CppEditorDocumentHandle *editorDocument) { QTC_ASSERT(editorDocument, return); diff --git a/src/plugins/cppeditor/cppmodelmanager.h b/src/plugins/cppeditor/cppmodelmanager.h index 5d7cb901f7f..3a05368e15a 100644 --- a/src/plugins/cppeditor/cppmodelmanager.h +++ b/src/plugins/cppeditor/cppmodelmanager.h @@ -148,6 +148,7 @@ public: QList cppEditorDocuments() const; CppEditorDocumentHandle *cppEditorDocument(const QString &filePath) const; + static BaseEditorDocumentProcessor *cppEditorDocumentProcessor(const QString &filePath); void registerCppEditorDocument(CppEditorDocumentHandle *cppEditorDocument); void unregisterCppEditorDocument(const QString &filePath); diff --git a/src/plugins/cppeditor/cppquickfixes.cpp b/src/plugins/cppeditor/cppquickfixes.cpp index d780ae3387d..258d021dee9 100644 --- a/src/plugins/cppeditor/cppquickfixes.cpp +++ b/src/plugins/cppeditor/cppquickfixes.cpp @@ -37,7 +37,6 @@ #include "cppquickfixassistant.h" #include "cppquickfixprojectsettings.h" #include "cpprefactoringchanges.h" -#include "cpptoolsbridge.h" #include "cpptoolsreuse.h" #include "cppvirtualfunctionassistprovider.h" #include "includeutils.h" @@ -7551,7 +7550,8 @@ void ConvertQt4Connect::match(const CppQuickFixInterface &interface, QuickFixOpe void ExtraRefactoringOperations::match(const CppQuickFixInterface &interface, QuickFixOperations &result) { - const auto processor = CppToolsBridge::baseEditorDocumentProcessor(interface.filePath().toString()); + const auto processor = CppModelManager::cppEditorDocumentProcessor( + interface.filePath().toString()); if (processor) { const auto clangFixItOperations = processor->extraRefactoringOperations(interface); result.append(clangFixItOperations); diff --git a/src/plugins/cppeditor/cppsourceprocessor_test.cpp b/src/plugins/cppeditor/cppsourceprocessor_test.cpp index c8d35cca091..89ae5e7aaa9 100644 --- a/src/plugins/cppeditor/cppsourceprocessor_test.cpp +++ b/src/plugins/cppeditor/cppsourceprocessor_test.cpp @@ -29,7 +29,6 @@ #include "cppmodelmanager.h" #include "cppsourceprocessertesthelper.h" #include "cppsourceprocessor.h" -#include "cpptoolsbridge.h" #include "cpptoolstestcase.h" #include "editordocumenthandle.h" @@ -132,7 +131,7 @@ void SourceProcessorTest::testIncludesCyclic() // Check editor snapshot const QString filePath = editor->document()->filePath().toString(); - auto *processor = CppToolsBridge::baseEditorDocumentProcessor(filePath); + auto *processor = CppModelManager::cppEditorDocumentProcessor(filePath); QVERIFY(processor); QVERIFY(TestCase::waitForProcessedEditorDocument(filePath)); Snapshot snapshot = processor->snapshot(); diff --git a/src/plugins/cppeditor/cpptoolsbridge.cpp b/src/plugins/cppeditor/cpptoolsbridge.cpp deleted file mode 100644 index 592ef11dc44..00000000000 --- a/src/plugins/cppeditor/cpptoolsbridge.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#include "cpptoolsbridge.h" - -#include "cpptoolsbridgeinterface.h" - -#include - -namespace CppEditor { - -std::unique_ptr CppToolsBridge::m_interface; - -void CppToolsBridge::setCppToolsBridgeImplementation(std::unique_ptr &&interface) -{ - m_interface = std::move(interface); -} - -CppEditorDocumentHandle *CppToolsBridge::cppEditorDocument(const QString &filePath) -{ - return m_interface->cppEditorDocument(filePath); -} - -QString CppToolsBridge::projectPartIdForFile(const QString &filePath) -{ - return m_interface->projectPartIdForFile(filePath); -} - -BaseEditorDocumentProcessor *CppToolsBridge::baseEditorDocumentProcessor(const QString &filePath) -{ - return m_interface->baseEditorDocumentProcessor(filePath); -} - -void CppToolsBridge::finishedRefreshingSourceFiles(const QSet &filePaths) -{ - m_interface->finishedRefreshingSourceFiles(filePaths); -} - -QList CppToolsBridge::visibleEditors() -{ - return m_interface->visibleEditors(); -} - -} // namespace CppEditor diff --git a/src/plugins/cppeditor/cpptoolsbridge.h b/src/plugins/cppeditor/cpptoolsbridge.h deleted file mode 100644 index 5a422522393..00000000000 --- a/src/plugins/cppeditor/cpptoolsbridge.h +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#pragma once - -#include "cppeditor_global.h" - -#include - -#include - -namespace Core { class IEditor; } - -namespace CppEditor { -class CppEditorDocumentHandle; -class BaseEditorDocumentProcessor; -class CppToolsBridgeInterface; - -class CPPEDITOR_EXPORT CppToolsBridge -{ -public: - static void setCppToolsBridgeImplementation(std::unique_ptr &&interface -); - - static CppEditorDocumentHandle *cppEditorDocument(const QString &filePath); - static QString projectPartIdForFile(const QString &filePath); - static BaseEditorDocumentProcessor *baseEditorDocumentProcessor(const QString &filePath); - static void finishedRefreshingSourceFiles(const QSet &filePaths); - static QList visibleEditors(); - -private: - static std::unique_ptr m_interface; -}; - -} // namespace CppEditor diff --git a/src/plugins/cppeditor/cpptoolsbridgeinterface.h b/src/plugins/cppeditor/cpptoolsbridgeinterface.h deleted file mode 100644 index a617412c5e7..00000000000 --- a/src/plugins/cppeditor/cpptoolsbridgeinterface.h +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#pragma once - -#include - -QT_BEGIN_NAMESPACE -class QString; -QT_END_NAMESPACE - -namespace Core { class IEditor; } - -namespace CppEditor { -class CppEditorDocumentHandle; -class BaseEditorDocumentProcessor; - -class CppToolsBridgeInterface -{ -public: - virtual ~CppToolsBridgeInterface() = default; - virtual CppEditorDocumentHandle *cppEditorDocument(const QString &filePath) const = 0; - virtual QString projectPartIdForFile(const QString &filePath) const = 0; - virtual BaseEditorDocumentProcessor *baseEditorDocumentProcessor(const QString &filePath) const = 0; - virtual void finishedRefreshingSourceFiles(const QSet &filePaths) const = 0; - virtual QList visibleEditors() const = 0; -}; - -} // namespace CppEditor diff --git a/src/plugins/cppeditor/cpptoolsbridgeqtcreatorimplementation.cpp b/src/plugins/cppeditor/cpptoolsbridgeqtcreatorimplementation.cpp deleted file mode 100644 index 5e57e977305..00000000000 --- a/src/plugins/cppeditor/cpptoolsbridgeqtcreatorimplementation.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#include "cpptoolsbridgeqtcreatorimplementation.h" - -#include "baseeditordocumentparser.h" -#include "cppmodelmanager.h" -#include "projectpart.h" -#include "editordocumenthandle.h" - -#include - -namespace CppEditor::Internal { - -CppEditorDocumentHandle * -CppToolsBridgeQtCreatorImplementation::cppEditorDocument(const QString &filePath) const -{ - return CppModelManager::instance()->cppEditorDocument(filePath); -} - -namespace { - -ProjectPart::ConstPtr projectPartForFile(const QString &filePath) -{ - if (const auto parser = BaseEditorDocumentParser::get(filePath)) - return parser->projectPartInfo().projectPart; - - return ProjectPart::ConstPtr(); -} - -bool isProjectPartValid(const ProjectPart::ConstPtr projectPart) -{ - if (projectPart) - return !CppModelManager::instance()->projectPartForId(projectPart->id()).isNull(); - - return false; -} - -} // anonymous namespace - -QString CppToolsBridgeQtCreatorImplementation::projectPartIdForFile(const QString &filePath) const -{ - const ProjectPart::ConstPtr projectPart = projectPartForFile(filePath); - - if (isProjectPartValid(projectPart)) - return projectPart->id(); // OK, Project Part is still loaded - - return QString(); -} - -BaseEditorDocumentProcessor * -CppToolsBridgeQtCreatorImplementation::baseEditorDocumentProcessor(const QString &filePath) const -{ - auto *document = cppEditorDocument(filePath); - if (document) - return document->processor(); - - return nullptr; -} - -void CppToolsBridgeQtCreatorImplementation::finishedRefreshingSourceFiles( - const QSet &filePaths) const -{ - CppModelManager::instance()->finishedRefreshingSourceFiles(filePaths); -} - -QList CppToolsBridgeQtCreatorImplementation::visibleEditors() const -{ - return Core::EditorManager::visibleEditors(); -} - -} // namespace CppEditor::Internal diff --git a/src/plugins/cppeditor/cpptoolsbridgeqtcreatorimplementation.h b/src/plugins/cppeditor/cpptoolsbridgeqtcreatorimplementation.h deleted file mode 100644 index 3460c3784bb..00000000000 --- a/src/plugins/cppeditor/cpptoolsbridgeqtcreatorimplementation.h +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#pragma once - -#include "cpptoolsbridgeinterface.h" - -namespace CppEditor::Internal { - -class CppToolsBridgeQtCreatorImplementation final : public CppToolsBridgeInterface -{ -public: - CppEditorDocumentHandle *cppEditorDocument(const QString &filePath) const override; - QString projectPartIdForFile(const QString &filePath) const override; - BaseEditorDocumentProcessor *baseEditorDocumentProcessor(const QString &filePath) const override; - void finishedRefreshingSourceFiles(const QSet &filePaths) const override; - QList visibleEditors() const override; -}; - -} // namespace CppEditor::Internal