forked from qt-creator/qt-creator
Merge CppTools into CppEditor
There was no proper separation of responsibilities between these plugins. In particular, CppTools had lots of editor-related functionality, so it's not clear why it was separated out in the first place. In fact, for a lot of code, it seemed quite arbitrary where it was put (just one example: switchHeaderSource() was in CppTools, wheras switchDeclarationDefinition() was in CppEditor). Merging the plugins will enable us to get rid of various convoluted pseudo-abstractions that were only introduced to keep up the artificial separation. Change-Id: Iafc3bce625b4794f6d4aa03df6cddc7f2d26716a Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
add_qtc_plugin(Todo
|
||||
DEPENDS QmlJS
|
||||
PLUGIN_DEPENDS Core CppTools ProjectExplorer
|
||||
PLUGIN_DEPENDS Core CppEditor ProjectExplorer
|
||||
SOURCES
|
||||
constants.h
|
||||
cpptodoitemsscanner.cpp cpptodoitemsscanner.h
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
#include "cpptodoitemsscanner.h"
|
||||
|
||||
#include <cpptools/projectinfo.h>
|
||||
#include <cppeditor/projectinfo.h>
|
||||
|
||||
#include <projectexplorer/project.h>
|
||||
|
||||
@@ -42,9 +42,9 @@ namespace Internal {
|
||||
CppTodoItemsScanner::CppTodoItemsScanner(const KeywordList &keywordList, QObject *parent) :
|
||||
TodoItemsScanner(keywordList, parent)
|
||||
{
|
||||
CppTools::CppModelManager *modelManager = CppTools::CppModelManager::instance();
|
||||
CppEditor::CppModelManager *modelManager = CppEditor::CppModelManager::instance();
|
||||
|
||||
connect(modelManager, &CppTools::CppModelManager::documentUpdated,
|
||||
connect(modelManager, &CppEditor::CppModelManager::documentUpdated,
|
||||
this, &CppTodoItemsScanner::documentUpdated, Qt::DirectConnection);
|
||||
|
||||
setParams(keywordList);
|
||||
@@ -55,10 +55,10 @@ void CppTodoItemsScanner::scannerParamsChanged()
|
||||
// We need to rescan everything known to the code model
|
||||
// TODO: It would be nice to only tokenize the source files, not update the code model entirely.
|
||||
|
||||
CppTools::CppModelManager *modelManager = CppTools::CppModelManager::instance();
|
||||
CppEditor::CppModelManager *modelManager = CppEditor::CppModelManager::instance();
|
||||
|
||||
QSet<QString> filesToBeUpdated;
|
||||
foreach (const CppTools::ProjectInfo::ConstPtr &info, modelManager->projectInfos())
|
||||
foreach (const CppEditor::ProjectInfo::ConstPtr &info, modelManager->projectInfos())
|
||||
filesToBeUpdated.unite(info->sourceFiles());
|
||||
|
||||
modelManager->updateSourceFiles(filesToBeUpdated);
|
||||
@@ -66,7 +66,7 @@ void CppTodoItemsScanner::scannerParamsChanged()
|
||||
|
||||
void CppTodoItemsScanner::documentUpdated(CPlusPlus::Document::Ptr doc)
|
||||
{
|
||||
CppTools::CppModelManager *modelManager = CppTools::CppModelManager::instance();
|
||||
CppEditor::CppModelManager *modelManager = CppEditor::CppModelManager::instance();
|
||||
if (!modelManager->projectPart(doc->fileName()).isEmpty())
|
||||
processDocument(doc);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
#include "todoitemsscanner.h"
|
||||
|
||||
#include <cpptools/cppmodelmanager.h>
|
||||
#include <cppeditor/cppmodelmanager.h>
|
||||
|
||||
namespace Todo {
|
||||
namespace Internal {
|
||||
|
||||
@@ -10,7 +10,7 @@ QtcPlugin {
|
||||
|
||||
Depends { name: "Core" }
|
||||
Depends { name: "ProjectExplorer" }
|
||||
Depends { name: "CppTools" }
|
||||
Depends { name: "CppEditor" }
|
||||
|
||||
files: [
|
||||
"constants.h",
|
||||
|
||||
@@ -7,4 +7,4 @@ QTC_LIB_DEPENDS += \
|
||||
QTC_PLUGIN_DEPENDS += \
|
||||
coreplugin \
|
||||
projectexplorer \
|
||||
cpptools
|
||||
cppeditor
|
||||
|
||||
@@ -108,7 +108,7 @@ void TodoItemsProvider::createScanners()
|
||||
{
|
||||
qRegisterMetaType<QList<TodoItem> >("QList<TodoItem>");
|
||||
|
||||
if (CppTools::CppModelManager::instance())
|
||||
if (CppEditor::CppModelManager::instance())
|
||||
m_scanners << new CppTodoItemsScanner(m_settings.keywords, this);
|
||||
|
||||
if (QmlJS::ModelManagerInterface::instance())
|
||||
|
||||
Reference in New Issue
Block a user