forked from qt-creator/qt-creator
		
	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>
This commit is contained in:
		| @@ -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(); | ||||
|   | ||||
| @@ -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(); | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -69,3 +69,8 @@ CppCompletionAssistProvider *ModelManagerSupportInternal::completionAssistProvid | ||||
| { | ||||
|     return m_completionAssistProvider.data(); | ||||
| } | ||||
|  | ||||
| FollowSymbolInterface *ModelManagerSupportInternal::followSymbolInterface() | ||||
| { | ||||
|     return nullptr; | ||||
| } | ||||
|   | ||||
| @@ -43,6 +43,7 @@ public: | ||||
|     virtual CppCompletionAssistProvider *completionAssistProvider(); | ||||
|     virtual BaseEditorDocumentProcessor *editorDocumentProcessor( | ||||
|                 TextEditor::TextDocument *baseTextDocument); | ||||
|     FollowSymbolInterface *followSymbolInterface() override; | ||||
|  | ||||
| private: | ||||
|     QScopedPointer<CppCompletionAssistProvider> m_completionAssistProvider; | ||||
|   | ||||
| @@ -63,6 +63,7 @@ HEADERS += \ | ||||
|     cppworkingcopy.h \ | ||||
|     doxygengenerator.h \ | ||||
|     editordocumenthandle.h \ | ||||
|     followsymbolinterface.h \ | ||||
|     functionutils.h \ | ||||
|     generatedcodemodelsupport.h \ | ||||
|     includeutils.h \ | ||||
|   | ||||
| @@ -164,6 +164,7 @@ Project { | ||||
|             "doxygengenerator.h", | ||||
|             "editordocumenthandle.cpp", | ||||
|             "editordocumenthandle.h", | ||||
|             "followsymbolinterface.h", | ||||
|             "functionutils.cpp", | ||||
|             "functionutils.h", | ||||
|             "generatedcodemodelsupport.cpp", | ||||
|   | ||||
							
								
								
									
										53
									
								
								src/plugins/cpptools/followsymbolinterface.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								src/plugins/cpptools/followsymbolinterface.h
									
									
									
									
									
										Normal file
									
								
							| @@ -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 | ||||
		Reference in New Issue
	
	Block a user