diff options
author | Ivan Donchevskii <ivan.donchevskii@qt.io> | 2017-08-03 16:43:38 +0200 |
---|---|---|
committer | Ivan Donchevskii <ivan.donchevskii@qt.io> | 2017-09-15 14:14:01 +0000 |
commit | a137b08eaa90028c5c0da6a5d880c57caec7dbf2 (patch) | |
tree | deefff71cf65cd2a063c4baadaa8da938c41dfe4 /src/plugins/cpptools | |
parent | 76d12dc2d5c604205f0c19848511980c361d2bae (diff) | |
download | qt-creator-a137b08eaa90028c5c0da6a5d880c57caec7dbf2.tar.gz |
CppEditor: refactor FollowSymbol
Create an interface to get the ability to use
another FollowSymbol implementation
Change-Id: I5802f62523ff3ee47b8a14e487adf43edcb6c9b1
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Diffstat (limited to 'src/plugins/cpptools')
-rw-r--r-- | src/plugins/cpptools/cppmodelmanager.cpp | 6 | ||||
-rw-r--r-- | src/plugins/cpptools/cppmodelmanager.h | 2 | ||||
-rw-r--r-- | src/plugins/cpptools/cppmodelmanagersupport.h | 2 | ||||
-rw-r--r-- | src/plugins/cpptools/cppmodelmanagersupportinternal.cpp | 5 | ||||
-rw-r--r-- | src/plugins/cpptools/cppmodelmanagersupportinternal.h | 1 | ||||
-rw-r--r-- | src/plugins/cpptools/cpptools.pro | 1 | ||||
-rw-r--r-- | src/plugins/cpptools/cpptools.qbs | 1 | ||||
-rw-r--r-- | src/plugins/cpptools/followsymbolinterface.h | 53 |
8 files changed, 71 insertions, 0 deletions
diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp index 08799709b1..5a6db12be0 100644 --- a/src/plugins/cpptools/cppmodelmanager.cpp +++ b/src/plugins/cpptools/cppmodelmanager.cpp @@ -39,6 +39,7 @@ #include "cpptoolsreuse.h" #include "editordocumenthandle.h" #include "symbolfinder.h" +#include "followsymbolinterface.h" #include <coreplugin/documentmanager.h> #include <coreplugin/icore.h> @@ -274,6 +275,11 @@ RefactoringEngineInterface *CppModelManager::refactoringEngine() return instance()->d->m_refactoringEngine; } +FollowSymbolInterface *CppModelManager::followSymbolInterface() const +{ + return d->m_activeModelManagerSupport->followSymbolInterface(); +} + QString CppModelManager::configurationFileName() { return Preprocessor::configurationFileName(); diff --git a/src/plugins/cpptools/cppmodelmanager.h b/src/plugins/cpptools/cppmodelmanager.h index 1cabaf50ef..229cfcef7d 100644 --- a/src/plugins/cpptools/cppmodelmanager.h +++ b/src/plugins/cpptools/cppmodelmanager.h @@ -54,6 +54,7 @@ class CppEditorDocumentHandle; class CppIndexingSupport; class ModelManagerSupportProvider; class RefactoringEngineInterface; +class FollowSymbolInterface; class SymbolFinder; class WorkingCopy; @@ -152,6 +153,7 @@ public: CppCompletionAssistProvider *completionAssistProvider() const; BaseEditorDocumentProcessor *editorDocumentProcessor( TextEditor::TextDocument *baseTextDocument) const; + FollowSymbolInterface *followSymbolInterface() const; void setIndexingSupport(CppIndexingSupport *indexingSupport); CppIndexingSupport *indexingSupport(); diff --git a/src/plugins/cpptools/cppmodelmanagersupport.h b/src/plugins/cpptools/cppmodelmanagersupport.h index cfef02e1a0..0a56de102c 100644 --- a/src/plugins/cpptools/cppmodelmanagersupport.h +++ b/src/plugins/cpptools/cppmodelmanagersupport.h @@ -36,6 +36,7 @@ namespace CppTools { class BaseEditorDocumentProcessor; class CppCompletionAssistProvider; +class FollowSymbolInterface; class CPPTOOLS_EXPORT ModelManagerSupport { @@ -48,6 +49,7 @@ public: virtual CppCompletionAssistProvider *completionAssistProvider() = 0; virtual BaseEditorDocumentProcessor *editorDocumentProcessor( TextEditor::TextDocument *baseTextDocument) = 0; + virtual FollowSymbolInterface *followSymbolInterface() = 0; }; class CPPTOOLS_EXPORT ModelManagerSupportProvider diff --git a/src/plugins/cpptools/cppmodelmanagersupportinternal.cpp b/src/plugins/cpptools/cppmodelmanagersupportinternal.cpp index e2135a76eb..a7c48674c9 100644 --- a/src/plugins/cpptools/cppmodelmanagersupportinternal.cpp +++ b/src/plugins/cpptools/cppmodelmanagersupportinternal.cpp @@ -69,3 +69,8 @@ CppCompletionAssistProvider *ModelManagerSupportInternal::completionAssistProvid { return m_completionAssistProvider.data(); } + +FollowSymbolInterface *ModelManagerSupportInternal::followSymbolInterface() +{ + return nullptr; +} diff --git a/src/plugins/cpptools/cppmodelmanagersupportinternal.h b/src/plugins/cpptools/cppmodelmanagersupportinternal.h index 0a2290f595..fba0cb23e3 100644 --- a/src/plugins/cpptools/cppmodelmanagersupportinternal.h +++ b/src/plugins/cpptools/cppmodelmanagersupportinternal.h @@ -43,6 +43,7 @@ public: virtual CppCompletionAssistProvider *completionAssistProvider(); virtual BaseEditorDocumentProcessor *editorDocumentProcessor( TextEditor::TextDocument *baseTextDocument); + FollowSymbolInterface *followSymbolInterface() override; private: QScopedPointer<CppCompletionAssistProvider> m_completionAssistProvider; diff --git a/src/plugins/cpptools/cpptools.pro b/src/plugins/cpptools/cpptools.pro index 3a0e1f2bcd..016294dc93 100644 --- a/src/plugins/cpptools/cpptools.pro +++ b/src/plugins/cpptools/cpptools.pro @@ -63,6 +63,7 @@ HEADERS += \ cppworkingcopy.h \ doxygengenerator.h \ editordocumenthandle.h \ + followsymbolinterface.h \ functionutils.h \ generatedcodemodelsupport.h \ includeutils.h \ diff --git a/src/plugins/cpptools/cpptools.qbs b/src/plugins/cpptools/cpptools.qbs index 640e91d6df..0af071828a 100644 --- a/src/plugins/cpptools/cpptools.qbs +++ b/src/plugins/cpptools/cpptools.qbs @@ -164,6 +164,7 @@ Project { "doxygengenerator.h", "editordocumenthandle.cpp", "editordocumenthandle.h", + "followsymbolinterface.h", "functionutils.cpp", "functionutils.h", "generatedcodemodelsupport.cpp", diff --git a/src/plugins/cpptools/followsymbolinterface.h b/src/plugins/cpptools/followsymbolinterface.h new file mode 100644 index 0000000000..1d662ae65a --- /dev/null +++ b/src/plugins/cpptools/followsymbolinterface.h @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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 "cpptools_global.h" +#include "cursorineditor.h" + +#include <cplusplus/CppDocument.h> + +#include <texteditor/texteditor.h> + +namespace CppTools { + +class SymbolFinder; + +class CPPTOOLS_EXPORT FollowSymbolInterface +{ +public: + using Link = TextEditor::TextEditorWidget::Link; + + virtual ~FollowSymbolInterface() {} + virtual Link findLink(const CursorInEditor &data, + bool resolveTarget, + const CPlusPlus::Snapshot &snapshot, + const CPlusPlus::Document::Ptr &documentFromSemanticInfo, + SymbolFinder *symbolFinder, + bool inNextSplit) = 0; +}; + +} // namespace CppTools |