ProjectExplorer: Move ITargetFactory to object pool

Makes multiple target factories per project possible

Reviewed-By: hunger
This commit is contained in:
dt
2010-12-06 16:15:41 +01:00
parent 95d7639bb7
commit 8697072ce4
15 changed files with 65 additions and 51 deletions

View File

@@ -80,7 +80,6 @@ CMakeProject::CMakeProject(CMakeManager *manager, const QString &fileName)
m_fileName(fileName),
m_rootNode(new CMakeProjectNode(m_fileName)),
m_insideFileChanged(false),
m_targetFactory(new CMakeTargetFactory(this)),
m_lastEditor(0)
{
m_file = new CMakeFile(this, fileName);
@@ -454,11 +453,6 @@ Core::IFile *CMakeProject::file() const
return m_file;
}
CMakeTargetFactory *CMakeProject::targetFactory() const
{
return m_targetFactory;
}
CMakeManager *CMakeProject::projectManager() const
{
return m_manager;
@@ -500,7 +494,10 @@ bool CMakeProject::fromMap(const QVariantMap &map)
bool hasUserFile = activeTarget();
if (!hasUserFile) {
CMakeTarget *t = targetFactory()->create(this, QLatin1String(DEFAULT_CMAKE_TARGET_ID));
CMakeTargetFactory *factory =
ExtensionSystem::PluginManager::instance()->getObject<CMakeTargetFactory>();
CMakeTarget *t = factory->create(this, QLatin1String(DEFAULT_CMAKE_TARGET_ID));
Q_ASSERT(t);
Q_ASSERT(t->activeBuildConfiguration());

View File

@@ -78,7 +78,6 @@ public:
QString displayName() const;
QString id() const;
Core::IFile *file() const;
CMakeTargetFactory *targetFactory() const;
CMakeManager *projectManager() const;
CMakeTarget *activeTarget() const;
@@ -142,7 +141,6 @@ private:
ProjectExplorer::FileWatcher *m_watcher;
bool m_insideFileChanged;
QSet<QString> m_watchedFiles;
CMakeTargetFactory *m_targetFactory;
QFuture<void> m_codeModelFuture;
QMap<QString, CMakeUiCodeModelSupport *> m_uiCodeModelSupport;

View File

@@ -33,6 +33,7 @@
#include "cmakeeditorfactory.h"
#include "makestep.h"
#include "cmakeprojectconstants.h"
#include "cmaketarget.h"
#include <coreplugin/icore.h>
#include <coreplugin/mimedatabase.h>
@@ -67,6 +68,7 @@ bool CMakeProjectPlugin::initialize(const QStringList & /*arguments*/, QString *
= new TextEditor::TextEditorActionHandler(CMakeProjectManager::Constants::C_CMAKEEDITOR);
addAutoReleasedObject(new CMakeEditorFactory(manager, editorHandler));
addAutoReleasedObject(new CMakeTargetFactory);
return true;
}