aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2022-04-29 16:52:48 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2022-05-04 10:05:31 +0000
commit969b1f711f9844d64e79ddb19f5a9ba358dcf1aa (patch)
tree1f99cff9a349dc05bd84a9afd7da978b35a0bac0
parentda0f95082195d783eb34387e4cc8d10b98ab9bf4 (diff)
CppEditor: Remove RefactoringEngine
Another useless indirection. Change-Id: Icfcc0704a1056d8002a674edbe74b946cb56ff27 Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
-rw-r--r--src/plugins/clangcodemodel/CMakeLists.txt1
-rw-r--r--src/plugins/clangcodemodel/clangcodemodel.qbs2
-rw-r--r--src/plugins/clangcodemodel/clangdclient.cpp6
-rw-r--r--src/plugins/clangcodemodel/clangdclient.h4
-rw-r--r--src/plugins/clangcodemodel/clangmodelmanagersupport.cpp59
-rw-r--r--src/plugins/clangcodemodel/clangmodelmanagersupport.h9
-rw-r--r--src/plugins/clangcodemodel/clangrefactoringengine.cpp87
-rw-r--r--src/plugins/clangcodemodel/clangrefactoringengine.h58
-rw-r--r--src/plugins/cppeditor/CMakeLists.txt2
-rw-r--r--src/plugins/cppeditor/cppbuiltinmodelmanagersupport.cpp76
-rw-r--r--src/plugins/cppeditor/cppbuiltinmodelmanagersupport.h8
-rw-r--r--src/plugins/cppeditor/cppeditor.qbs3
-rw-r--r--src/plugins/cppeditor/cppeditorwidget.cpp5
-rw-r--r--src/plugins/cppeditor/cppmodelmanager.cpp73
-rw-r--r--src/plugins/cppeditor/cppmodelmanager.h52
-rw-r--r--src/plugins/cppeditor/cppmodelmanagersupport.h13
-rw-r--r--src/plugins/cppeditor/cpprefactoringengine.cpp106
-rw-r--r--src/plugins/cppeditor/cpprefactoringengine.h43
-rw-r--r--src/plugins/cppeditor/cursorineditor.h8
-rw-r--r--src/plugins/cppeditor/refactoringengineinterface.h73
20 files changed, 195 insertions, 493 deletions
diff --git a/src/plugins/clangcodemodel/CMakeLists.txt b/src/plugins/clangcodemodel/CMakeLists.txt
index 31533298c69..4adc57a0d4d 100644
--- a/src/plugins/clangcodemodel/CMakeLists.txt
+++ b/src/plugins/clangcodemodel/CMakeLists.txt
@@ -26,7 +26,6 @@ add_qtc_plugin(ClangCodeModel
clangpreprocessorassistproposalitem.cpp clangpreprocessorassistproposalitem.h
clangprojectsettings.cpp clangprojectsettings.h
clangprojectsettingswidget.cpp clangprojectsettingswidget.h clangprojectsettingswidget.ui
- clangrefactoringengine.cpp clangrefactoringengine.h
clangtextmark.cpp clangtextmark.h
clanguiheaderondiskmanager.cpp clanguiheaderondiskmanager.h
clangutils.cpp clangutils.h
diff --git a/src/plugins/clangcodemodel/clangcodemodel.qbs b/src/plugins/clangcodemodel/clangcodemodel.qbs
index 48f4ae846d4..1ad7223b1ae 100644
--- a/src/plugins/clangcodemodel/clangcodemodel.qbs
+++ b/src/plugins/clangcodemodel/clangcodemodel.qbs
@@ -59,8 +59,6 @@ QtcPlugin {
"clangprojectsettingswidget.cpp",
"clangprojectsettingswidget.h",
"clangprojectsettingswidget.ui",
- "clangrefactoringengine.cpp",
- "clangrefactoringengine.h",
"clangtextmark.cpp",
"clangtextmark.h",
"clanguiheaderondiskmanager.cpp",
diff --git a/src/plugins/clangcodemodel/clangdclient.cpp b/src/plugins/clangcodemodel/clangdclient.cpp
index b6c0ff9890f..e48d9ea7824 100644
--- a/src/plugins/clangcodemodel/clangdclient.cpp
+++ b/src/plugins/clangcodemodel/clangdclient.cpp
@@ -826,7 +826,7 @@ public:
class LocalRefsData {
public:
LocalRefsData(quint64 id, TextDocument *doc, const QTextCursor &cursor,
- CppEditor::RefactoringEngineInterface::RenameCallback &&callback)
+ CppEditor::RenameCallback &&callback)
: id(id), document(doc), cursor(cursor), callback(std::move(callback)),
uri(DocumentUri::fromFilePath(doc->filePath())), revision(doc->document()->revision())
{}
@@ -840,7 +840,7 @@ public:
const quint64 id;
const QPointer<TextDocument> document;
const QTextCursor cursor;
- CppEditor::RefactoringEngineInterface::RenameCallback callback;
+ CppEditor::RenameCallback callback;
const DocumentUri uri;
const int revision;
};
@@ -2187,7 +2187,7 @@ void ClangdClient::switchDeclDef(TextDocument *document, const QTextCursor &curs
}
void ClangdClient::findLocalUsages(TextDocument *document, const QTextCursor &cursor,
- CppEditor::RefactoringEngineInterface::RenameCallback &&callback)
+ CppEditor::RenameCallback &&callback)
{
QTC_ASSERT(documentOpen(document), openDocument(document));
diff --git a/src/plugins/clangcodemodel/clangdclient.h b/src/plugins/clangcodemodel/clangdclient.h
index aa67e3c7898..5532b4fed29 100644
--- a/src/plugins/clangcodemodel/clangdclient.h
+++ b/src/plugins/clangcodemodel/clangdclient.h
@@ -27,7 +27,7 @@
#include <cppeditor/baseeditordocumentparser.h>
#include <cppeditor/cppcodemodelsettings.h>
-#include <cppeditor/refactoringengineinterface.h>
+#include <cppeditor/cursorineditor.h>
#include <languageclient/client.h>
#include <utils/link.h>
#include <utils/optional.h>
@@ -74,7 +74,7 @@ public:
Utils::ProcessLinkCallback &&callback);
void findLocalUsages(TextEditor::TextDocument *document, const QTextCursor &cursor,
- CppEditor::RefactoringEngineInterface::RenameCallback &&callback);
+ CppEditor::RenameCallback &&callback);
void gatherHelpItemForTooltip(
const LanguageServerProtocol::HoverRequest::Response &hoverResponse,
diff --git a/src/plugins/clangcodemodel/clangmodelmanagersupport.cpp b/src/plugins/clangcodemodel/clangmodelmanagersupport.cpp
index 9ab0c7e4178..15cb17d9fc1 100644
--- a/src/plugins/clangcodemodel/clangmodelmanagersupport.cpp
+++ b/src/plugins/clangcodemodel/clangmodelmanagersupport.cpp
@@ -31,7 +31,6 @@
#include "clangeditordocumentprocessor.h"
#include "clangdlocatorfilters.h"
#include "clangprojectsettings.h"
-#include "clangrefactoringengine.h"
#include "clangutils.h"
#include <coreplugin/documentmanager.h>
@@ -49,7 +48,6 @@
#include <cppeditor/cppprojectfile.h>
#include <cppeditor/cpptoolsreuse.h>
#include <cppeditor/editordocumenthandle.h>
-#include <cppeditor/symbolfinder.h>
#include <languageclient/languageclientmanager.h>
@@ -104,7 +102,7 @@ static const QList<TextEditor::TextDocument *> allCppDocuments()
return Utils::qobject_container_cast<TextEditor::TextDocument *>(documents);
}
-ClangModelManagerSupport::ClangModelManagerSupport() : m_refactoringEngine(new RefactoringEngine)
+ClangModelManagerSupport::ClangModelManagerSupport()
{
QTC_CHECK(!m_instance);
m_instance = this;
@@ -189,10 +187,8 @@ void ClangModelManagerSupport::followSymbol(const CppEditor::CursorInEditor &dat
return;
}
- SymbolFinder finder;
- CppModelManager::builtinFollowSymbol().findLink(data, std::move(processLinkCallback),
- resolveTarget, CppModelManager::instance()->snapshot(),
- data.editorWidget()->semanticInfo().doc, &finder, inNextSplit);
+ CppModelManager::followSymbol(data, std::move(processLinkCallback), resolveTarget, inNextSplit,
+ CppModelManager::Backend::Builtin);
}
void ClangModelManagerSupport::switchDeclDef(const CppEditor::CursorInEditor &data,
@@ -205,15 +201,52 @@ void ClangModelManagerSupport::switchDeclDef(const CppEditor::CursorInEditor &da
return;
}
- SymbolFinder finder;
- CppModelManager::builtinFollowSymbol().switchDeclDef(data, std::move(processLinkCallback),
- CppModelManager::instance()->snapshot(), data.editorWidget()->semanticInfo().doc,
- &finder);
+ CppModelManager::switchDeclDef(data, std::move(processLinkCallback),
+ CppModelManager::Backend::Builtin);
}
-CppEditor::RefactoringEngineInterface &ClangModelManagerSupport::refactoringEngineInterface()
+void ClangModelManagerSupport::startLocalRenaming(const CppEditor::CursorInEditor &data,
+ const CppEditor::ProjectPart *projectPart,
+ RenameCallback &&renameSymbolsCallback)
{
- return *m_refactoringEngine;
+ if (ClangdClient * const client = clientForFile(data.filePath());
+ client && client->reachable()) {
+ client->findLocalUsages(data.textDocument(), data.cursor(),
+ std::move(renameSymbolsCallback));
+ return;
+ }
+
+ CppModelManager::startLocalRenaming(data, projectPart,
+ std::move(renameSymbolsCallback), CppModelManager::Backend::Builtin);
+}
+
+void ClangModelManagerSupport::globalRename(const CppEditor::CursorInEditor &cursor,
+ CppEditor::UsagesCallback &&callback,
+ const QString &replacement)
+{
+ if (ClangdClient * const client = clientForFile(cursor.filePath());
+ client && client->isFullyIndexed()) {
+ QTC_ASSERT(client->documentOpen(cursor.textDocument()),
+ client->openDocument(cursor.textDocument()));
+ client->findUsages(cursor.textDocument(), cursor.cursor(), replacement);
+ return;
+ }
+ CppModelManager::globalRename(cursor, std::move(callback), replacement,
+ CppModelManager::Backend::Builtin);
+}
+
+void ClangModelManagerSupport::findUsages(const CppEditor::CursorInEditor &cursor,
+ CppEditor::UsagesCallback &&callback) const
+{
+ if (ClangdClient * const client = clientForFile(cursor.filePath());
+ client && client->isFullyIndexed()) {
+ QTC_ASSERT(client->documentOpen(cursor.textDocument()),
+ client->openDocument(cursor.textDocument()));
+ client->findUsages(cursor.textDocument(), cursor.cursor(), {});
+
+ return;
+ }
+ CppModelManager::findUsages(cursor, std::move(callback), CppModelManager::Backend::Builtin);
}
std::unique_ptr<CppEditor::AbstractOverviewModel> ClangModelManagerSupport::createOverviewModel()
diff --git a/src/plugins/clangcodemodel/clangmodelmanagersupport.h b/src/plugins/clangcodemodel/clangmodelmanagersupport.h
index 8ffbe9041ed..7f0749e3d68 100644
--- a/src/plugins/clangcodemodel/clangmodelmanagersupport.h
+++ b/src/plugins/clangcodemodel/clangmodelmanagersupport.h
@@ -68,7 +68,6 @@ public:
TextEditor::BaseHoverHandler *createHoverHandler() override { return nullptr; }
CppEditor::BaseEditorDocumentProcessor *createEditorDocumentProcessor(
TextEditor::TextDocument *baseTextDocument) override;
- CppEditor::RefactoringEngineInterface &refactoringEngineInterface() override;
std::unique_ptr<CppEditor::AbstractOverviewModel> createOverviewModel() override;
bool supportsOutline(const TextEditor::TextDocument *document) const override;
bool supportsLocalUses(const TextEditor::TextDocument *document) const override;
@@ -93,6 +92,13 @@ private:
bool inNextSplit) override;
void switchDeclDef(const CppEditor::CursorInEditor &data,
Utils::ProcessLinkCallback &&processLinkCallback) override;
+ void startLocalRenaming(const CppEditor::CursorInEditor &data,
+ const CppEditor::ProjectPart *projectPart,
+ CppEditor::RenameCallback &&renameSymbolsCallback) override;
+ void globalRename(const CppEditor::CursorInEditor &cursor, CppEditor::UsagesCallback &&callback,
+ const QString &replacement) override;
+ void findUsages(const CppEditor::CursorInEditor &cursor,
+ CppEditor::UsagesCallback &&callback) const override;
void onEditorOpened(Core::IEditor *editor);
void onCurrentEditorChanged(Core::IEditor *newCurrent);
@@ -128,7 +134,6 @@ private:
void watchForInternalChanges();
UiHeaderOnDiskManager m_uiHeaderOnDiskManager;
- std::unique_ptr<CppEditor::RefactoringEngineInterface> m_refactoringEngine;
QHash<ProjectExplorer::Project *, ClangProjectSettings *> m_projectSettings;
Utils::FutureSynchronizer m_generatorSynchronizer;
diff --git a/src/plugins/clangcodemodel/clangrefactoringengine.cpp b/src/plugins/clangcodemodel/clangrefactoringengine.cpp
deleted file mode 100644
index 1edb6f6ae21..00000000000
--- a/src/plugins/clangcodemodel/clangrefactoringengine.cpp
+++ /dev/null
@@ -1,87 +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 "clangrefactoringengine.h"
-
-#include "clangdclient.h"
-#include "clangmodelmanagersupport.h"
-
-#include <cppeditor/cppmodelmanager.h>
-#include <languageclient/languageclientsymbolsupport.h>
-#include <utils/textutils.h>
-#include <utils/qtcassert.h>
-
-namespace ClangCodeModel {
-namespace Internal {
-
-void RefactoringEngine::startLocalRenaming(const CppEditor::CursorInEditor &data,
- const CppEditor::ProjectPart *projectPart,
- RenameCallback &&renameSymbolsCallback)
-{
- ClangdClient * const client
- = ClangModelManagerSupport::instance()->clientForFile(data.filePath());
- if (client && client->reachable()) {
- client->findLocalUsages(data.textDocument(), data.cursor(),
- std::move(renameSymbolsCallback));
- return;
- }
-
- CppEditor::CppModelManager::builtinRefactoringEngine()
- ->startLocalRenaming(data, projectPart, std::move(renameSymbolsCallback));
-}
-
-void RefactoringEngine::globalRename(const CppEditor::CursorInEditor &cursor,
- CppEditor::UsagesCallback &&callback,
- const QString &replacement)
-{
- ClangdClient * const client
- = ClangModelManagerSupport::instance()->clientForFile(cursor.filePath());
- if (!client || !client->isFullyIndexed()) {
- CppEditor::CppModelManager::builtinRefactoringEngine()
- ->globalRename(cursor, std::move(callback), replacement);
- return;
- }
- QTC_ASSERT(client->documentOpen(cursor.textDocument()),
- client->openDocument(cursor.textDocument()));
- client->findUsages(cursor.textDocument(), cursor.cursor(), replacement);
-}
-
-void RefactoringEngine::findUsages(const CppEditor::CursorInEditor &cursor,
- CppEditor::UsagesCallback &&callback) const
-{
- ClangdClient * const client
- = ClangModelManagerSupport::instance()->clientForFile(cursor.filePath());
- if (!client || !client->isFullyIndexed()) {
- CppEditor::CppModelManager::builtinRefactoringEngine()
- ->findUsages(cursor, std::move(callback));
- return;
- }
- QTC_ASSERT(client->documentOpen(cursor.textDocument()),
- client->openDocument(cursor.textDocument()));
- client->findUsages(cursor.textDocument(), cursor.cursor(), {});
-}
-
-} // namespace Internal
-} // namespace ClangCodeModel
diff --git a/src/plugins/clangcodemodel/clangrefactoringengine.h b/src/plugins/clangcodemodel/clangrefactoringengine.h
deleted file mode 100644
index 407e267b8eb..00000000000
--- a/src/plugins/clangcodemodel/clangrefactoringengine.h
+++ /dev/null
@@ -1,58 +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/refactoringengineinterface.h>
-#include <cppeditor/cppcursorinfo.h>
-
-#include <QFutureWatcher>
-
-namespace ClangBackEnd {
-class RefactoringClientInterface;
-class RefactoringServerInterface;
-}
-
-namespace ClangCodeModel {
-namespace Internal {
-
-class RefactoringEngine : public CppEditor::RefactoringEngineInterface
-{
-public:
- void startLocalRenaming(const CppEditor::CursorInEditor &data,
- const CppEditor::ProjectPart *projectPart,
- RenameCallback &&renameSymbolsCallback) override;
- void globalRename(const CppEditor::CursorInEditor &cursor, CppEditor::UsagesCallback &&callback,
- const QString &replacement) override;
- void findUsages(const CppEditor::CursorInEditor &cursor,
- CppEditor::UsagesCallback &&callback) const override;
-
-private:
- using FutureCursorWatcher = QFutureWatcher<CppEditor::CursorInfo>;
- std::unique_ptr<FutureCursorWatcher> m_watcher;
-};
-
-} // namespace Internal
-} // namespace ClangRefactoring
diff --git a/src/plugins/cppeditor/CMakeLists.txt b/src/plugins/cppeditor/CMakeLists.txt
index 7a4d9d68038..e8858620967 100644
--- a/src/plugins/cppeditor/CMakeLists.txt
+++ b/src/plugins/cppeditor/CMakeLists.txt
@@ -85,7 +85,6 @@ add_qtc_plugin(CppEditor
cppquickfixsettingspage.cpp cppquickfixsettingspage.h
cppquickfixsettingswidget.cpp cppquickfixsettingswidget.h cppquickfixsettingswidget.ui
cpprefactoringchanges.cpp cpprefactoringchanges.h
- cpprefactoringengine.cpp cpprefactoringengine.h
cppselectionchanger.cpp cppselectionchanger.h
cppsemanticinfo.h
cppsemanticinfoupdater.cpp cppsemanticinfoupdater.h
@@ -109,7 +108,6 @@ add_qtc_plugin(CppEditor
insertionpointlocator.cpp insertionpointlocator.h
projectinfo.cpp projectinfo.h
projectpart.cpp projectpart.h
- refactoringengineinterface.h
resourcepreviewhoverhandler.cpp resourcepreviewhoverhandler.h
searchsymbols.cpp searchsymbols.h
semantichighlighter.cpp semantichighlighter.h
diff --git a/src/plugins/cppeditor/cppbuiltinmodelmanagersupport.cpp b/src/plugins/cppeditor/cppbuiltinmodelmanagersupport.cpp
index ed9defff588..34d3c65efea 100644
--- a/src/plugins/cppeditor/cppbuiltinmodelmanagersupport.cpp
+++ b/src/plugins/cppeditor/cppbuiltinmodelmanagersupport.cpp
@@ -26,18 +26,20 @@
#include "cppbuiltinmodelmanagersupport.h"
#include "builtineditordocumentprocessor.h"
+#include "cppcanonicalsymbol.h"
#include "cppcompletionassist.h"
#include "cppeditorwidget.h"
#include "cppelementevaluator.h"
#include "cppfollowsymbolundercursor.h"
#include "cppoverviewmodel.h"
-#include "cpprefactoringengine.h"
#include "cpptoolsreuse.h"
#include "symbolfinder.h"
#include <app/app_version.h>
+#include <clangsupport/sourcelocationscontainer.h>
#include <texteditor/basehoverhandler.h>
#include <utils/executeondestruction.h>
+#include <utils/qtcassert.h>
#include <QCoreApplication>
@@ -105,8 +107,7 @@ ModelManagerSupport::Ptr BuiltinModelManagerSupportProvider::createModelManagerS
BuiltinModelManagerSupport::BuiltinModelManagerSupport()
: m_completionAssistProvider(new InternalCompletionAssistProvider),
- m_followSymbol(new FollowSymbolUnderCursor),
- m_refactoringEngine(new CppRefactoringEngine)
+ m_followSymbol(new FollowSymbolUnderCursor)
{
}
@@ -134,11 +135,6 @@ TextEditor::BaseHoverHandler *BuiltinModelManagerSupport::createHoverHandler()
return new CppHoverHandler;
}
-RefactoringEngineInterface &BuiltinModelManagerSupport::refactoringEngineInterface()
-{
- return *m_refactoringEngine;
-}
-
std::unique_ptr<AbstractOverviewModel> BuiltinModelManagerSupport::createOverviewModel()
{
return std::make_unique<OverviewModel>();
@@ -163,4 +159,68 @@ void BuiltinModelManagerSupport::switchDeclDef(const CursorInEditor &data,
&finder);
}
+void BuiltinModelManagerSupport::startLocalRenaming(const CursorInEditor &data,
+ const ProjectPart *,
+ RenameCallback &&renameSymbolsCallback)
+{
+ CppEditorWidget *editorWidget = data.editorWidget();
+ QTC_ASSERT(editorWidget, renameSymbolsCallback(QString(),
+ ClangBackEnd::SourceLocationsContainer(),
+ 0); return;);
+ editorWidget->updateSemanticInfo();
+ // Call empty callback
+ renameSymbolsCallback(QString(),
+ ClangBackEnd::SourceLocationsContainer(),
+ data.cursor().document()->revision());
+}
+
+void BuiltinModelManagerSupport::globalRename(const CursorInEditor &data,
+ UsagesCallback &&,
+ const QString &replacement)
+{
+ CppModelManager *modelManager = CppModelManager::instance();
+ if (!modelManager)
+ return;
+
+ CppEditorWidget *editorWidget = data.editorWidget();
+ QTC_ASSERT(editorWidget, return;);
+
+ SemanticInfo info = editorWidget->semanticInfo();
+ info.snapshot = modelManager->snapshot();
+ info.snapshot.insert(info.doc);
+ const QTextCursor &cursor = data.cursor();
+ if (const CPlusPlus::Macro *macro = findCanonicalMacro(cursor, info.doc)) {
+ modelManager->renameMacroUsages(*macro, replacement);
+ } else {
+ Internal::CanonicalSymbol cs(info.doc, info.snapshot);
+ CPlusPlus::Symbol *canonicalSymbol = cs(cursor);
+ if (canonicalSymbol)
+ modelManager->renameUsages(canonicalSymbol, cs.context(), replacement);
+ }
+}
+
+void BuiltinModelManagerSupport::findUsages(const CursorInEditor &data,
+ UsagesCallback &&) const
+{
+ CppModelManager *modelManager = CppModelManager::instance();
+ if (!modelManager)
+ return;
+
+ CppEditorWidget *editorWidget = data.editorWidget();
+ QTC_ASSERT(editorWidget, return;);
+
+ SemanticInfo info = editorWidget->semanticInfo();
+ info.snapshot = modelManager->snapshot();
+ info.snapshot.insert(info.doc);
+ const QTextCursor &cursor = data.cursor();
+ if (const CPlusPlus::Macro *macro = findCanonicalMacro(cursor, info.doc)) {
+ modelManager->findMacroUsages(*macro);
+ } else {
+ Internal::CanonicalSymbol cs(info.doc, info.snapshot);
+ CPlusPlus::Symbol *canonicalSymbol = cs(cursor);
+ if (canonicalSymbol)
+ modelManager->findUsages(canonicalSymbol, cs.context());
+ }
+}
+
} // namespace CppEditor::Internal
diff --git a/src/plugins/cppeditor/cppbuiltinmodelmanagersupport.h b/src/plugins/cppeditor/cppbuiltinmodelmanagersupport.h
index bd4b2cf8638..66ec4f5ca0c 100644
--- a/src/plugins/cppeditor/cppbuiltinmodelmanagersupport.h
+++ b/src/plugins/cppeditor/cppbuiltinmodelmanagersupport.h
@@ -46,7 +46,6 @@ public:
TextEditor::BaseHoverHandler *createHoverHandler() final;
BaseEditorDocumentProcessor *createEditorDocumentProcessor(
TextEditor::TextDocument *baseTextDocument) final;
- RefactoringEngineInterface &refactoringEngineInterface() final;
std::unique_ptr<AbstractOverviewModel> createOverviewModel() final;
FollowSymbolUnderCursor &followSymbolInterface() { return *m_followSymbol; }
@@ -56,10 +55,15 @@ private:
bool resolveTarget, bool inNextSplit) override;
void switchDeclDef(const CursorInEditor &data,
Utils::ProcessLinkCallback &&processLinkCallback) override;
+ void startLocalRenaming(const CursorInEditor &data,
+ const ProjectPart *projectPart,
+ RenameCallback &&renameSymbolsCallback) override;
+ void globalRename(const CursorInEditor &data, UsagesCallback &&,
+ const QString &replacement) override;
+ void findUsages(const CursorInEditor &data, UsagesCallback &&) const override;
QScopedPointer<CppCompletionAssistProvider> m_completionAssistProvider;
QScopedPointer<FollowSymbolUnderCursor> m_followSymbol;
- QScopedPointer<RefactoringEngineInterface> m_refactoringEngine;
};
class BuiltinModelManagerSupportProvider : public ModelManagerSupportProvider
diff --git a/src/plugins/cppeditor/cppeditor.qbs b/src/plugins/cppeditor/cppeditor.qbs
index bd93199cd27..9941a54c50e 100644
--- a/src/plugins/cppeditor/cppeditor.qbs
+++ b/src/plugins/cppeditor/cppeditor.qbs
@@ -189,8 +189,6 @@ QtcPlugin {
"cppqtstyleindenter.h",
"cpprefactoringchanges.cpp",
"cpprefactoringchanges.h",
- "cpprefactoringengine.cpp",
- "cpprefactoringengine.h",
"cppselectionchanger.cpp",
"cppselectionchanger.h",
"cppsemanticinfo.h",
@@ -235,7 +233,6 @@ QtcPlugin {
"projectinfo.h",
"projectpart.cpp",
"projectpart.h",
- "refactoringengineinterface.h",
"resourcepreviewhoverhandler.cpp",
"resourcepreviewhoverhandler.h",
"searchsymbols.cpp",
diff --git a/src/plugins/cppeditor/cppeditorwidget.cpp b/src/plugins/cppeditor/cppeditorwidget.cpp
index e77272efe56..36524e663ef 100644
--- a/src/plugins/cppeditor/cppeditorwidget.cpp
+++ b/src/plugins/cppeditor/cppeditorwidget.cpp
@@ -50,7 +50,6 @@
#include "cpptoolssettings.h"
#include "cppuseselectionsupdater.h"
#include "cppworkingcopy.h"
-#include "refactoringengineinterface.h"
#include "symbolfinder.h"
#include <clangsupport/sourcelocationscontainer.h>
@@ -1044,7 +1043,7 @@ void CppEditorWidget::switchDeclarationDefinition(bool inNextSplit)
if (self && link.hasValidTarget())
self->openLink(link, split);
};
- CppModelManager::instance()->switchDeclDef(cursor, std::move(callback));
+ CppModelManager::switchDeclDef(cursor, std::move(callback));
}
void CppEditorWidget::findLinkAt(const QTextCursor &cursor,
@@ -1084,7 +1083,7 @@ void CppEditorWidget::findLinkAt(const QTextCursor &cursor,
}
callback(link);
};
- CppModelManager::instance()->followSymbol(
+ CppModelManager::followSymbol(
CursorInEditor{cursor, filePath, this, textDocument()},
std::move(callbackWrapper),
resolveTarget,
diff --git a/src/plugins/cppeditor/cppmodelmanager.cpp b/src/plugins/cppeditor/cppmodelmanager.cpp
index 1ab7d1b3b37..4a3963136c2 100644
--- a/src/plugins/cppeditor/cppmodelmanager.cpp
+++ b/src/plugins/cppeditor/cppmodelmanager.cpp
@@ -40,7 +40,6 @@
#include "cpplocatorfilter.h"
#include "cppbuiltinmodelmanagersupport.h"
#include "cpprefactoringchanges.h"
-#include "cpprefactoringengine.h"
#include "cppsourceprocessor.h"
#include "cpptoolsjsextension.h"
#include "cpptoolsreuse.h"
@@ -136,8 +135,6 @@ protected:
namespace CppEditor {
-using REType = RefactoringEngineType;
-
namespace Internal {
static CppModelManager *m_instance;
@@ -197,10 +194,6 @@ public:
QTimer m_delayedGcTimer;
QTimer m_fallbackProjectPartTimer;
- // Refactoring
- using REHash = QMap<REType, RefactoringEngineInterface *>;
- REHash m_refactoringEngines;
-
CppLocatorData m_locatorData;
std::unique_ptr<Core::ILocatorFilter> m_locatorFilter;
std::unique_ptr<Core::ILocatorFilter> m_classesFilter;
@@ -308,43 +301,32 @@ QString CppModelManager::editorConfigurationFileName()
return QLatin1String("<per-editor-defines>");
}
-static RefactoringEngineInterface *getRefactoringEngine(CppModelManagerPrivate::REHash &engines)
+ModelManagerSupport *CppModelManager::modelManagerSupport(Backend backend) const
{
- QTC_ASSERT(!engines.empty(), return nullptr;);
- RefactoringEngineInterface *currentEngine = engines[REType::BuiltIn];
- if (engines.find(REType::ClangCodeModel) != engines.end()) {
- currentEngine = engines[REType::ClangCodeModel];
- } else if (engines.find(REType::ClangRefactoring) != engines.end()) {
- RefactoringEngineInterface *engine = engines[REType::ClangRefactoring];
- if (engine->isRefactoringEngineAvailable())
- currentEngine = engine;
- }
- return currentEngine;
+ return (backend == Backend::Builtin
+ ? d->m_builtinModelManagerSupport : d->m_activeModelManagerSupport).data();
}
void CppModelManager::startLocalRenaming(const CursorInEditor &data,
const ProjectPart *projectPart,
- RenameCallback &&renameSymbolsCallback)
+ RenameCallback &&renameSymbolsCallback,
+ Backend backend)
{
- RefactoringEngineInterface *engine = getRefactoringEngine(d->m_refactoringEngines);
- QTC_ASSERT(engine, return;);
- engine->startLocalRenaming(data, projectPart, std::move(renameSymbolsCallback));
+ instance()->modelManagerSupport(backend)
+ ->startLocalRenaming(data, projectPart, std::move(renameSymbolsCallback));
}
void CppModelManager::globalRename(const CursorInEditor &data, UsagesCallback &&renameCallback,
- const QString &replacement)
+ const QString &replacement, Backend backend)
{
- RefactoringEngineInterface *engine = getRefactoringEngine(d->m_refactoringEngines);
- QTC_ASSERT(engine, return;);
- engine->globalRename(data, std::move(renameCallback), replacement);
+ instance()->modelManagerSupport(backend)
+ ->globalRename(data, std::move(renameCallback), replacement);
}
void CppModelManager::findUsages(const CursorInEditor &data,
- UsagesCallback &&showUsagesCallback) const
+ UsagesCallback &&showUsagesCallback, Backend backend)
{
- RefactoringEngineInterface *engine = getRefactoringEngine(d->m_refactoringEngines);
- QTC_ASSERT(engine, return;);
- engine->findUsages(data, std::move(showUsagesCallback));
+ instance()->modelManagerSupport(backend)->findUsages(data, std::move(showUsagesCallback));
}
bool CppModelManager::positionRequiresSignal(const QString &filePath, const QByteArray &content,
@@ -456,22 +438,6 @@ bool CppModelManager::positionRequiresSignal(const QString &filePath, const QByt
return false;
}
-void CppModelManager::addRefactoringEngine(RefactoringEngineType type,
- RefactoringEngineInterface *refactoringEngine)
-{
- instance()->d->m_refactoringEngines[type] = refactoringEngine;
-}
-
-void CppModelManager::removeRefactoringEngine(RefactoringEngineType type)
-{
- instance()->d->m_refactoringEngines.remove(type);
-}
-
-RefactoringEngineInterface *CppModelManager::builtinRefactoringEngine()
-{
- return instance()->d->m_refactoringEngines.value(RefactoringEngineType::BuiltIn);
-}
-
FollowSymbolUnderCursor &CppModelManager::builtinFollowSymbol()
{
return instance()->d->m_builtinModelManagerSupport.staticCast<BuiltinModelManagerSupport>()
@@ -622,8 +588,6 @@ void CppModelManager::initializeBuiltinModelManagerSupport()
d->m_builtinModelManagerSupport
= BuiltinModelManagerSupportProvider().createModelManagerSupport();
d->m_activeModelManagerSupport = d->m_builtinModelManagerSupport;
- d->m_refactoringEngines[RefactoringEngineType::BuiltIn] =
- &d->m_activeModelManagerSupport->refactoringEngineInterface();
}
CppModelManager::CppModelManager()
@@ -1647,8 +1611,6 @@ void CppModelManager::activateClangCodeModel(
QTC_ASSERT(modelManagerSupportProvider, return);
d->m_activeModelManagerSupport = modelManagerSupportProvider->createModelManagerSupport();
- d->m_refactoringEngines[RefactoringEngineType::ClangCodeModel] =
- &d->m_activeModelManagerSupport->refactoringEngineInterface();
}
CppCompletionAssistProvider *CppModelManager::completionAssistProvider() const
@@ -1668,16 +1630,17 @@ TextEditor::BaseHoverHandler *CppModelManager::createHoverHandler() const
void CppModelManager::followSymbol(const CursorInEditor &data,
Utils::ProcessLinkCallback &&processLinkCallback,
- bool resolveTarget, bool inNextSplit)
+ bool resolveTarget, bool inNextSplit, Backend backend)
{
- d->m_activeModelManagerSupport->followSymbol(data, std::move(processLinkCallback),
- resolveTarget, inNextSplit);
+ instance()->modelManagerSupport(backend)->followSymbol(data, std::move(processLinkCallback),
+ resolveTarget, inNextSplit);
}
void CppModelManager::switchDeclDef(const CursorInEditor &data,
- Utils::ProcessLinkCallback &&processLinkCallback)
+ Utils::ProcessLinkCallback &&processLinkCallback,
+ Backend backend)
{
- d->m_activeModelManagerSupport->switchDeclDef(data, std::move(processLinkCallback));
+ instance()->modelManagerSupport(backend)->switchDeclDef(data, std::move(processLinkCallback));
}
Core::ILocatorFilter *CppModelManager::createAuxiliaryCurrentDocumentFilter()
diff --git a/src/plugins/cppeditor/cppmodelmanager.h b/src/plugins/cppeditor/cppmodelmanager.h
index f66228cc92d..4b56d03e985 100644
--- a/src/plugins/cppeditor/cppmodelmanager.h
+++ b/src/plugins/cppeditor/cppmodelmanager.h
@@ -27,14 +27,16 @@
#include "cppeditor_global.h"
-#include "refactoringengineinterface.h"
+#include "cursorineditor.h"
#include "projectinfo.h"
#include "projectpart.h"
-#include <projectexplorer/headerpath.h>
+#include "usages.h"
#include <cplusplus/cppmodelmanagerbase.h>
#include <coreplugin/find/ifindfilter.h>
#include <coreplugin/locator/ilocatorfilter.h>
+#include <projectexplorer/headerpath.h>
+#include <utils/link.h>
#include <QFuture>
#include <QObject>
@@ -62,6 +64,7 @@ class CppIndexingSupport;
class CppLocatorData;
class FollowSymbolUnderCursor;
class ModelManagerSupportProvider;
+class ModelManagerSupport;
class SymbolFinder;
class WorkingCopy;
@@ -73,15 +76,7 @@ class CppModelManagerPrivate;
namespace Tests { class ModelManagerTestHelper; }
-enum class RefactoringEngineType : int
-{
- BuiltIn = 0,
- ClangCodeModel = 1,
- ClangRefactoring = 2
-};
-
-class CPPEDITOR_EXPORT CppModelManager final : public CPlusPlus::CppModelManagerBase,
- public RefactoringEngineInterface
+class CPPEDITOR_EXPORT CppModelManager final : public CPlusPlus::CppModelManagerBase
{
Q_OBJECT
@@ -156,14 +151,6 @@ public:
QList<int> references(CPlusPlus::Symbol *symbol, const CPlusPlus::LookupContext &context);
- void startLocalRenaming(const CursorInEditor &data,
- const ProjectPart *projectPart,
- RenameCallback &&renameSymbolsCallback) final;
- void globalRename(const CursorInEditor &data, UsagesCallback &&renameCallback,
- const QString &replacement) final;
- void findUsages(const CursorInEditor &data,
- UsagesCallback &&showUsagesCallback) const final;
-
bool positionRequiresSignal(const QString &filePath, const QByteArray &content,
int position) const;
@@ -183,10 +170,22 @@ public:
TextEditor::TextDocument *baseTextDocument) const;
TextEditor::BaseHoverHandler *createHoverHandler() const;
static FollowSymbolUnderCursor &builtinFollowSymbol();
- void followSymbol(const CursorInEditor &data, Utils::ProcessLinkCallback &&processLinkCallback,
- bool resolveTarget, bool inNextSplit);
- void switchDeclDef(const CursorInEditor &data,
- Utils::ProcessLinkCallback &&processLinkCallback);
+
+ enum class Backend { Builtin, Best };
+ static void followSymbol(const CursorInEditor &data,
+ Utils::ProcessLinkCallback &&processLinkCallback,
+ bool resolveTarget, bool inNextSplit, Backend backend = Backend::Best);
+ static void switchDeclDef(const CursorInEditor &data,
+ Utils::ProcessLinkCallback &&processLinkCallback,
+ Backend backend = Backend::Best);
+ static void startLocalRenaming(const CursorInEditor &data, const ProjectPart *projectPart,
+ RenameCallback &&renameSymbolsCallback,
+ Backend backend = Backend::Best);
+ static void globalRename(const CursorInEditor &data, UsagesCallback &&renameCallback,
+ const QString &replacement, Backend backend = Backend::Best);
+ static void findUsages(const CursorInEditor &data, UsagesCallback &&showUsagesCallback,
+ Backend backend = Backend::Best);
+
static Core::ILocatorFilter *createAuxiliaryCurrentDocumentFilter();
std::unique_ptr<AbstractOverviewModel> createOverviewModel() const;
@@ -214,11 +213,6 @@ public:
static QString configurationFileName();
static QString editorConfigurationFileName();
- static void addRefactoringEngine(RefactoringEngineType type,
- RefactoringEngineInterface *refactoringEngine);
- static void removeRefactoringEngine(RefactoringEngineType type);
- static RefactoringEngineInterface *builtinRefactoringEngine();
-
void setLocatorFilter(std::unique_ptr<Core::ILocatorFilter> &&filter);
void setClassesFilter(std::unique_ptr<Core::ILocatorFilter> &&filter);
void setIncludesFilter(std::unique_ptr<Core::ILocatorFilter> &&filter);
@@ -292,6 +286,8 @@ private:
WorkingCopy buildWorkingCopyList();
+ ModelManagerSupport *modelManagerSupport(Backend backend) const;
+
void ensureUpdated();
QStringList internalProjectFiles() const;
ProjectExplorer::HeaderPaths internalHeaderPaths() const;
diff --git a/src/plugins/cppeditor/cppmodelmanagersupport.h b/src/plugins/cppeditor/cppmodelmanagersupport.h
index ca4f3f050d7..f5eec64fbaa 100644
--- a/src/plugins/cppeditor/cppmodelmanagersupport.h
+++ b/src/plugins/cppeditor/cppmodelmanagersupport.h
@@ -26,6 +26,8 @@
#pragma once
#include "cppeditor_global.h"
+#include "cursorineditor.h"
+#include "usages.h"
#include <utils/link.h>
@@ -44,7 +46,7 @@ namespace CppEditor {
class AbstractOverviewModel;
class BaseEditorDocumentProcessor;
class CppCompletionAssistProvider;
-class CursorInEditor;
+class ProjectPart;
class RefactoringEngineInterface;
class CPPEDITOR_EXPORT ModelManagerSupport
@@ -60,7 +62,6 @@ public:
virtual TextEditor::BaseHoverHandler *createHoverHandler() = 0;
virtual BaseEditorDocumentProcessor *createEditorDocumentProcessor(
TextEditor::TextDocument *baseTextDocument) = 0;
- virtual RefactoringEngineInterface &refactoringEngineInterface() = 0;
virtual std::unique_ptr<AbstractOverviewModel> createOverviewModel() = 0;
virtual bool supportsOutline(const TextEditor::TextDocument *) const { return true; }
virtual bool hasSpecialHoverHandler(const TextEditor::TextDocument *) const { return false; }
@@ -71,6 +72,14 @@ public:
bool resolveTarget, bool inNextSplit) = 0;
virtual void switchDeclDef(const CursorInEditor &data,
Utils::ProcessLinkCallback &&processLinkCallback) = 0;
+ virtual void startLocalRenaming(const CursorInEditor &data,
+ const ProjectPart *projectPart,
+ RenameCallback &&renameSymbolsCallback) = 0;
+ virtual void globalRename(const CursorInEditor &data,
+ UsagesCallback &&renameCallback,
+ const QString &replacement) = 0;
+ virtual void findUsages(const CursorInEditor &data,
+ UsagesCallback &&showUsagesCallback) const = 0;
};
class CPPEDITOR_EXPORT ModelManagerSupportProvider
diff --git a/src/plugins/cppeditor/cpprefactoringengine.cpp b/src/plugins/cppeditor/cpprefactoringengine.cpp
deleted file mode 100644
index 4a88f75d3a0..00000000000
--- a/src/plugins/cppeditor/cpprefactoringengine.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-/****************************************************************************
-**
-** 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.
-**
-****************************************************************************/
-
-#include "cpprefactoringengine.h"
-
-#include "cppcanonicalsymbol.h"
-#include "cppeditorwidget.h"
-#include "cppmodelmanager.h"
-#include "cppsemanticinfo.h"
-#include "cpptoolsreuse.h"
-#include "cppfollowsymbolundercursor.h"
-
-#include <clangsupport/sourcelocationscontainer.h>
-#include <texteditor/texteditor.h>
-
-#include <utils/qtcassert.h>
-
-namespace CppEditor::Internal {
-
-void CppRefactoringEngine::startLocalRenaming(const CursorInEditor &data,
- const ProjectPart *,
- RenameCallback &&renameSymbolsCallback)
-{
- CppEditorWidget *editorWidget = data.editorWidget();
- QTC_ASSERT(editorWidget, renameSymbolsCallback(QString(),
- ClangBackEnd::SourceLocationsContainer(),
- 0); return;);
- editorWidget->updateSemanticInfo();
- // Call empty callback
- renameSymbolsCallback(QString(),
- ClangBackEnd::SourceLocationsContainer(),
- data.cursor().document()->revision());
-}
-
-void CppRefactoringEngine::globalRename(const CursorInEditor &data,
- UsagesCallback &&,
- const QString &replacement)
-{
- CppModelManager *modelManager = CppModelManager::instance();
- if (!modelManager)
- return;
-
- CppEditorWidget *editorWidget = data.editorWidget();
- QTC_ASSERT(editorWidget, return;);
-
- SemanticInfo info = editorWidget->semanticInfo();
- info.snapshot = modelManager->snapshot();
- info.snapshot.insert(info.doc);
- const QTextCursor &cursor = data.cursor();
- if (const CPlusPlus::Macro *macro = findCanonicalMacro(cursor, info.doc)) {
- modelManager->renameMacroUsages(*macro, replacement);
- } else {
- Internal::CanonicalSymbol cs(info.doc, info.snapshot);
- CPlusPlus::Symbol *canonicalSymbol = cs(cursor);
- if (canonicalSymbol)
- modelManager->renameUsages(canonicalSymbol, cs.context(), replacement);
- }
-}
-
-void CppRefactoringEngine::findUsages(const CursorInEditor &data,
- UsagesCallback &&) const
-{
- CppModelManager *modelManager = CppModelManager::instance();
- if (!modelManager)
- return;
-
- CppEditorWidget *editorWidget = data.editorWidget();
- QTC_ASSERT(editorWidget, return;);
-
- SemanticInfo info = editorWidget->semanticInfo();
- info.snapshot = modelManager->snapshot();
- info.snapshot.insert(info.doc);
- const QTextCursor &cursor = data.cursor();
- if (const CPlusPlus::Macro *macro = findCanonicalMacro(cursor, info.doc)) {
- modelManager->findMacroUsages(*macro);
- } else {
- Internal::CanonicalSymbol cs(info.doc, info.snapshot);
- CPlusPlus::Symbol *canonicalSymbol = cs(cursor);
- if (canonicalSymbol)
- modelManager->findUsages(canonicalSymbol, cs.context());
- }
-}
-
-} // namespace CppEditor::Internal
diff --git a/src/plugins/cppeditor/cpprefactoringengine.h b/src/plugins/cppeditor/cpprefactoringengine.h
deleted file mode 100644
index 765e8eece64..00000000000
--- a/src/plugins/cppeditor/cpprefactoringengine.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/****************************************************************************
-**
-** 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 "refactoringengineinterface.h"
-
-namespace CppEditor::Internal {
-
-class CppRefactoringEngine : public RefactoringEngineInterface
-{
-public:
- void startLocalRenaming(const CursorInEditor &data,
- const ProjectPart *projectPart,
- RenameCallback &&renameSymbolsCallback) override;
- void globalRename(const CursorInEditor &data, UsagesCallback &&,
- const QString &replacement) override;
- void findUsages(const CursorInEditor &data, UsagesCallback &&) const override;
-};
-
-} // namespace CppEditor::Internal
diff --git a/src/plugins/cppeditor/cursorineditor.h b/src/plugins/cppeditor/cursorineditor.h
index 6bd2e83af2e..a6d8edb5872 100644
--- a/src/plugins/cppeditor/cursorineditor.h
+++ b/src/plugins/cppeditor/cursorineditor.h
@@ -29,11 +29,19 @@
#include <QTextCursor>
+#include <functional>
+
+namespace ClangBackEnd { class SourceLocationsContainer; }
namespace TextEditor { class TextDocument; }
namespace CppEditor {
class CppEditorWidget;
+// TODO: Move to a better place.
+using RenameCallback = std::function<void(const QString &,
+ const ClangBackEnd::SourceLocationsContainer &,
+ int)>;
+
class CursorInEditor
{
public:
diff --git a/src/plugins/cppeditor/refactoringengineinterface.h b/src/plugins/cppeditor/refactoringengineinterface.h
deleted file mode 100644
index 55299aee26b..00000000000
--- a/src/plugins/cppeditor/refactoringengineinterface.h
+++ /dev/null
@@ -1,73 +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 "cursorineditor.h"
-#include "usages.h"
-
-#include <utils/link.h>
-#include <utils/fileutils.h>
-
-#include <cplusplus/CppDocument.h>
-
-namespace ClangBackEnd { class SourceLocationsContainer; }
-namespace TextEditor { class TextEditorWidget; }
-
-namespace CppEditor {
-
-class ProjectPart;
-class SymbolFinder;
-
-enum class CallType
-{
- Synchronous,
- Asynchronous
-};
-
-// NOTE: This interface is not supposed to be owned as an interface pointer
-class CPPEDITOR_EXPORT RefactoringEngineInterface
-{
-public:
- using RenameCallback = std::function<void(const QString &,
- const ClangBackEnd::SourceLocationsContainer &,
- int)>;
- using Link = Utils::Link;
-
- virtual ~RefactoringEngineInterface() = default;
-
- virtual void startLocalRenaming(const CursorInEditor &data,
- const ProjectPart *projectPart,
- RenameCallback &&renameSymbolsCallback) = 0;
- virtual void globalRename(const CursorInEditor &data,
- UsagesCallback &&renameCallback,
- const QString &replacement) = 0;
- virtual void findUsages(const CursorInEditor &data,
- UsagesCallback &&showUsagesCallback) const = 0;
- virtual bool isRefactoringEngineAvailable() const { return true; }
-};
-
-} // namespace CppEditor