RunConfigurationAspect: Add RunConfiguration parameter to factory method

Change-Id: I7fbb82dc3ff83593473a57c69d0eb89bc33f50f5
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
Tobias Hunger
2013-03-26 16:39:41 +01:00
parent 5d4c4a6968
commit 1650c22b7b
23 changed files with 75 additions and 58 deletions

View File

@@ -81,8 +81,9 @@ RunControl *AnalyzerRunControlFactory::create(RunConfiguration *runConfiguration
return rc; return rc;
} }
IRunConfigurationAspect *AnalyzerRunControlFactory::createRunConfigurationAspect() IRunConfigurationAspect *AnalyzerRunControlFactory::createRunConfigurationAspect(RunConfiguration *rc)
{ {
Q_UNUSED(rc);
return new AnalyzerRunConfigurationAspect; return new AnalyzerRunConfigurationAspect;
} }

View File

@@ -49,8 +49,8 @@ public:
ProjectExplorer::RunControl *create(RunConfiguration *runConfiguration, ProjectExplorer::RunControl *create(RunConfiguration *runConfiguration,
ProjectExplorer::RunMode mode, ProjectExplorer::RunMode mode,
QString *errorMessage); QString *errorMessage);
ProjectExplorer::IRunConfigurationAspect *createRunConfigurationAspect(); ProjectExplorer::IRunConfigurationAspect *createRunConfigurationAspect(ProjectExplorer::RunConfiguration *rc);
ProjectExplorer::RunConfigWidget *createConfigurationWidget(RunConfiguration *runConfiguration); ProjectExplorer::RunConfigWidget *createConfigurationWidget(ProjectExplorer::RunConfiguration *runConfiguration);
}; };

View File

@@ -102,10 +102,8 @@ QString AndroidRunConfigurationFactory::displayNameForId(const Core::Id id) cons
return QFileInfo(pathFromId(id)).completeBaseName(); return QFileInfo(pathFromId(id)).completeBaseName();
} }
RunConfiguration *AndroidRunConfigurationFactory::create(Target *parent, const Core::Id id) RunConfiguration *AndroidRunConfigurationFactory::doCreate(Target *parent, const Core::Id id)
{ {
if (!canCreate(parent, id))
return 0;
return new AndroidRunConfiguration(parent, id, pathFromId(id)); return new AndroidRunConfiguration(parent, id, pathFromId(id));
} }

View File

@@ -54,7 +54,6 @@ public:
QList<Core::Id> availableCreationIds(ProjectExplorer::Target *parent) const; QList<Core::Id> availableCreationIds(ProjectExplorer::Target *parent) const;
bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const; bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const;
ProjectExplorer::RunConfiguration *create(ProjectExplorer::Target *parent, const Core::Id id);
bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const; bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const;
ProjectExplorer::RunConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map); ProjectExplorer::RunConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map);
@@ -65,6 +64,11 @@ public:
bool canHandle(ProjectExplorer::Target *t) const; bool canHandle(ProjectExplorer::Target *t) const;
QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Target *t, QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Target *t,
ProjectExplorer::Node *n); ProjectExplorer::Node *n);
private:
bool canHandle(ProjectExplorer::Target *t) const;
ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, const Core::Id id);
}; };
class AndroidRunControlFactory : public ProjectExplorer::IRunControlFactory class AndroidRunControlFactory : public ProjectExplorer::IRunControlFactory

View File

@@ -513,11 +513,9 @@ bool CMakeRunConfigurationFactory::canCreate(ProjectExplorer::Target *parent, co
return project->hasBuildTarget(buildTargetFromId(id)); return project->hasBuildTarget(buildTargetFromId(id));
} }
ProjectExplorer::RunConfiguration *CMakeRunConfigurationFactory::create(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *CMakeRunConfigurationFactory::doCreate(ProjectExplorer::Target *parent,
const Core::Id id) const Core::Id id)
{ {
if (!canCreate(parent, id))
return 0;
CMakeProject *project = static_cast<CMakeProject *>(parent->project()); CMakeProject *project = static_cast<CMakeProject *>(parent->project());
const QString title(buildTargetFromId(id)); const QString title(buildTargetFromId(id));
const CMakeBuildTarget &ct = project->buildTargetForTitle(title); const CMakeBuildTarget &ct = project->buildTargetForTitle(title);

View File

@@ -162,7 +162,6 @@ public:
~CMakeRunConfigurationFactory(); ~CMakeRunConfigurationFactory();
bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const; bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const;
ProjectExplorer::RunConfiguration *create(ProjectExplorer::Target *parent, const Core::Id id);
bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const; bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const;
ProjectExplorer::RunConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map); ProjectExplorer::RunConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map);
bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *product) const; bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *product) const;
@@ -176,6 +175,8 @@ public:
private: private:
bool canHandle(ProjectExplorer::Target *parent) const; bool canHandle(ProjectExplorer::Target *parent) const;
ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, const Core::Id id);
}; };
} }

View File

@@ -132,10 +132,8 @@ QString MaemoRunConfigurationFactory::displayNameForId(const Core::Id id) const
+ QLatin1String(" (on remote Maemo device)"); + QLatin1String(" (on remote Maemo device)");
} }
RunConfiguration *MaemoRunConfigurationFactory::create(Target *parent, const Core::Id id) RunConfiguration *MaemoRunConfigurationFactory::doCreate(Target *parent, const Core::Id id)
{ {
if (!canCreate(parent, id))
return 0;
return new MaemoRunConfiguration(parent, id, pathFromId(id)); return new MaemoRunConfiguration(parent, id, pathFromId(id));
} }

View File

@@ -59,7 +59,6 @@ public:
QList<Core::Id> availableCreationIds(Target *parent) const; QList<Core::Id> availableCreationIds(Target *parent) const;
bool canCreate(Target *parent, const Core::Id id) const; bool canCreate(Target *parent, const Core::Id id) const;
RunConfiguration *create(Target *parent, const Core::Id id);
bool canRestore(Target *parent, const QVariantMap &map) const; bool canRestore(Target *parent, const QVariantMap &map) const;
RunConfiguration *restore(Target *parent, const QVariantMap &map); RunConfiguration *restore(Target *parent, const QVariantMap &map);
@@ -70,6 +69,9 @@ public:
bool canHandle(ProjectExplorer::Target *t) const; bool canHandle(ProjectExplorer::Target *t) const;
QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Target *t, QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Target *t,
ProjectExplorer::Node *n); ProjectExplorer::Node *n);
private:
RunConfiguration *doCreate(Target *parent, const Core::Id id);
}; };
class MaemoRunControlFactory : public IRunControlFactory class MaemoRunControlFactory : public IRunControlFactory

View File

@@ -37,7 +37,6 @@
#include "kitinformation.h" #include "kitinformation.h"
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <utils/qtcassert.h>
#include <utils/outputformatter.h> #include <utils/outputformatter.h>
#include <utils/checkablemessagebox.h> #include <utils/checkablemessagebox.h>
@@ -273,15 +272,16 @@ DebuggerRunConfigurationAspect *DebuggerRunConfigurationAspect::clone(RunConfigu
RunConfiguration::RunConfiguration(Target *target, const Core::Id id) : RunConfiguration::RunConfiguration(Target *target, const Core::Id id) :
ProjectConfiguration(target, id), ProjectConfiguration(target, id),
m_debuggerAspect(new DebuggerRunConfigurationAspect(this)) m_debuggerAspect(new DebuggerRunConfigurationAspect(this)),
m_aspectsInitialized(false)
{ {
Q_ASSERT(target); Q_ASSERT(target);
addExtraAspects();
} }
RunConfiguration::RunConfiguration(Target *target, RunConfiguration *source) : RunConfiguration::RunConfiguration(Target *target, RunConfiguration *source) :
ProjectConfiguration(target, source), ProjectConfiguration(target, source),
m_debuggerAspect(source->debuggerAspect()->clone(this)) m_debuggerAspect(source->debuggerAspect()->clone(this)),
m_aspectsInitialized(true)
{ {
Q_ASSERT(target); Q_ASSERT(target);
foreach (IRunConfigurationAspect *aspect, source->m_aspects) { foreach (IRunConfigurationAspect *aspect, source->m_aspects) {
@@ -299,9 +299,13 @@ RunConfiguration::~RunConfiguration()
void RunConfiguration::addExtraAspects() void RunConfiguration::addExtraAspects()
{ {
if (m_aspectsInitialized)
return;
foreach (IRunControlFactory *factory, ExtensionSystem::PluginManager::getObjects<IRunControlFactory>()) foreach (IRunControlFactory *factory, ExtensionSystem::PluginManager::getObjects<IRunControlFactory>())
if (IRunConfigurationAspect *aspect = factory->createRunConfigurationAspect()) if (IRunConfigurationAspect *aspect = factory->createRunConfigurationAspect(this))
m_aspects.append(aspect); m_aspects.append(aspect);
m_aspectsInitialized = true;
} }
/*! /*!
@@ -376,6 +380,7 @@ ProjectExplorer::Abi RunConfiguration::abi() const
bool RunConfiguration::fromMap(const QVariantMap &map) bool RunConfiguration::fromMap(const QVariantMap &map)
{ {
addExtraAspects();
m_debuggerAspect->fromMap(map); m_debuggerAspect->fromMap(map);
foreach (IRunConfigurationAspect *aspect, m_aspects) foreach (IRunConfigurationAspect *aspect, m_aspects)
@@ -402,6 +407,7 @@ bool RunConfiguration::fromMap(const QVariantMap &map)
QList<IRunConfigurationAspect *> RunConfiguration::extraAspects() const QList<IRunConfigurationAspect *> RunConfiguration::extraAspects() const
{ {
QTC_ASSERT(m_aspectsInitialized, return QList<IRunConfigurationAspect *>());
return m_aspects; return m_aspects;
} }
@@ -445,6 +451,17 @@ IRunConfigurationFactory::~IRunConfigurationFactory()
{ {
} }
RunConfiguration *IRunConfigurationFactory::create(Target *parent, const Core::Id id)
{
if (!canCreate(parent, id))
return 0;
RunConfiguration *rc = doCreate(parent, id);
if (!rc)
return 0;
rc->addExtraAspects();
return rc;
}
IRunConfigurationFactory *IRunConfigurationFactory::find(Target *parent, const QVariantMap &map) IRunConfigurationFactory *IRunConfigurationFactory::find(Target *parent, const QVariantMap &map)
{ {
QList<IRunConfigurationFactory *> factories QList<IRunConfigurationFactory *> factories
@@ -512,8 +529,9 @@ IRunControlFactory::~IRunControlFactory()
{ {
} }
IRunConfigurationAspect *IRunControlFactory::createRunConfigurationAspect() IRunConfigurationAspect *IRunControlFactory::createRunConfigurationAspect(RunConfiguration *rc)
{ {
Q_UNUSED(rc);
return 0; return 0;
} }

View File

@@ -35,6 +35,7 @@
#include "projectexplorerconstants.h" #include "projectexplorerconstants.h"
#include <utils/outputformat.h> #include <utils/outputformat.h>
#include <utils/qtcassert.h>
#include <QPointer> #include <QPointer>
#include <QWidget> #include <QWidget>
@@ -170,6 +171,7 @@ public:
QList<IRunConfigurationAspect *> extraAspects() const; QList<IRunConfigurationAspect *> extraAspects() const;
template <typename T> T *extraAspect() const template <typename T> T *extraAspect() const
{ {
QTC_ASSERT(m_aspectsInitialized, return 0);
IRunConfigurationAspect *typeCheck = static_cast<T *>(0); IRunConfigurationAspect *typeCheck = static_cast<T *>(0);
Q_UNUSED(typeCheck); Q_UNUSED(typeCheck);
T *result = 0; T *result = 0;
@@ -182,6 +184,8 @@ public:
virtual ProjectExplorer::Abi abi() const; virtual ProjectExplorer::Abi abi() const;
void addExtraAspects();
signals: signals:
void enabledChanged(); void enabledChanged();
@@ -193,10 +197,9 @@ protected:
BuildConfiguration *activeBuildConfiguration() const; BuildConfiguration *activeBuildConfiguration() const;
private: private:
void addExtraAspects();
QList<IRunConfigurationAspect *> m_aspects; QList<IRunConfigurationAspect *> m_aspects;
DebuggerRunConfigurationAspect *m_debuggerAspect; DebuggerRunConfigurationAspect *m_debuggerAspect;
bool m_aspectsInitialized;
}; };
class PROJECTEXPLORER_EXPORT IRunConfigurationFactory : public QObject class PROJECTEXPLORER_EXPORT IRunConfigurationFactory : public QObject
@@ -211,7 +214,7 @@ public:
virtual QString displayNameForId(const Core::Id id) const = 0; virtual QString displayNameForId(const Core::Id id) const = 0;
virtual bool canCreate(Target *parent, const Core::Id id) const = 0; virtual bool canCreate(Target *parent, const Core::Id id) const = 0;
virtual RunConfiguration *create(Target *parent, const Core::Id id) = 0; RunConfiguration *create(Target *parent, const Core::Id id);
virtual bool canRestore(Target *parent, const QVariantMap &map) const = 0; virtual bool canRestore(Target *parent, const QVariantMap &map) const = 0;
virtual RunConfiguration *restore(Target *parent, const QVariantMap &map) = 0; virtual RunConfiguration *restore(Target *parent, const QVariantMap &map) = 0;
virtual bool canClone(Target *parent, RunConfiguration *product) const = 0; virtual bool canClone(Target *parent, RunConfiguration *product) const = 0;
@@ -223,6 +226,9 @@ public:
signals: signals:
void availableCreationIdsChanged(); void availableCreationIdsChanged();
private:
virtual RunConfiguration *doCreate(Target *parent, const Core::Id id) = 0;
}; };
class RunConfigWidget; class RunConfigWidget;
@@ -239,7 +245,7 @@ public:
virtual QString displayName() const = 0; virtual QString displayName() const = 0;
virtual IRunConfigurationAspect *createRunConfigurationAspect(); virtual IRunConfigurationAspect *createRunConfigurationAspect(RunConfiguration *rc);
virtual RunConfigWidget *createConfigurationWidget(RunConfiguration *runConfiguration); virtual RunConfigWidget *createConfigurationWidget(RunConfiguration *runConfiguration);
}; };

View File

@@ -400,6 +400,7 @@ void Target::addRunConfiguration(RunConfiguration* runConfiguration)
{ {
QTC_ASSERT(runConfiguration && !d->m_runConfigurations.contains(runConfiguration), return); QTC_ASSERT(runConfiguration && !d->m_runConfigurations.contains(runConfiguration), return);
Q_ASSERT(runConfiguration->target() == this); Q_ASSERT(runConfiguration->target() == this);
runConfiguration->addExtraAspects();
// Check that we don't have a configuration with the same displayName // Check that we don't have a configuration with the same displayName
QString configurationDisplayName = runConfiguration->displayName(); QString configurationDisplayName = runConfiguration->displayName();

View File

@@ -110,10 +110,8 @@ bool QmlProjectRunConfigurationFactory::canCreate(ProjectExplorer::Target *paren
return false; return false;
} }
ProjectExplorer::RunConfiguration *QmlProjectRunConfigurationFactory::create(ProjectExplorer::Target *parent, const Core::Id id) ProjectExplorer::RunConfiguration *QmlProjectRunConfigurationFactory::doCreate(ProjectExplorer::Target *parent, const Core::Id id)
{ {
if (!canCreate(parent, id))
return 0;
return new QmlProjectRunConfiguration(parent, id); return new QmlProjectRunConfiguration(parent, id);
} }

View File

@@ -47,7 +47,6 @@ public:
QString displayNameForId(const Core::Id id) const; QString displayNameForId(const Core::Id id) const;
bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const; bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const;
ProjectExplorer::RunConfiguration *create(ProjectExplorer::Target *parent, const Core::Id id);
bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const; bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const;
ProjectExplorer::RunConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map); ProjectExplorer::RunConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map);
bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const; bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const;
@@ -55,6 +54,8 @@ public:
private: private:
bool canHandle(ProjectExplorer::Target *parent) const; bool canHandle(ProjectExplorer::Target *parent) const;
ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, const Core::Id id);
}; };
} // namespace Internal } // namespace Internal

View File

@@ -95,12 +95,9 @@ bool BlackBerryRunConfigurationFactory::canCreate(ProjectExplorer::Target *paren
return qt4Project->hasApplicationProFile(pathFromId(id)); return qt4Project->hasApplicationProFile(pathFromId(id));
} }
ProjectExplorer::RunConfiguration *BlackBerryRunConfigurationFactory::create(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *BlackBerryRunConfigurationFactory::doCreate(ProjectExplorer::Target *parent,
const Core::Id id) const Core::Id id)
{ {
if (!canCreate(parent, id))
return 0;
return new BlackBerryRunConfiguration(parent, id, pathFromId(id)); return new BlackBerryRunConfiguration(parent, id, pathFromId(id));
} }

View File

@@ -47,7 +47,7 @@ public:
QString displayNameForId(const Core::Id id) const; QString displayNameForId(const Core::Id id) const;
bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const; bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const;
ProjectExplorer::RunConfiguration *create(ProjectExplorer::Target *parent, const Core::Id id); ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, const Core::Id id);
bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const; bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const;
ProjectExplorer::RunConfiguration *restore(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *restore(ProjectExplorer::Target *parent,

View File

@@ -82,7 +82,7 @@ QString QnxRunConfigurationFactory::displayNameForId(const Core::Id id) const
bool QnxRunConfigurationFactory::canCreate(ProjectExplorer::Target *parent, const Core::Id id) const bool QnxRunConfigurationFactory::canCreate(ProjectExplorer::Target *parent, const Core::Id id) const
{ {
if (!canHandle(parent)) if (!canHandle(parent) || id.name().startsWith(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX))
return false; return false;
Qt4ProjectManager::Qt4Project *qt4Project = qobject_cast<Qt4ProjectManager::Qt4Project *>(parent->project()); Qt4ProjectManager::Qt4Project *qt4Project = qobject_cast<Qt4ProjectManager::Qt4Project *>(parent->project());
@@ -92,15 +92,9 @@ bool QnxRunConfigurationFactory::canCreate(ProjectExplorer::Target *parent, cons
return qt4Project->hasApplicationProFile(pathFromId(id)); return qt4Project->hasApplicationProFile(pathFromId(id));
} }
ProjectExplorer::RunConfiguration *QnxRunConfigurationFactory::create(ProjectExplorer::Target *parent, const Core::Id id) ProjectExplorer::RunConfiguration *QnxRunConfigurationFactory::doCreate(ProjectExplorer::Target *parent, const Core::Id id)
{ {
if (!canCreate(parent, id))
return 0;
if (id.name().startsWith(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX))
return new QnxRunConfiguration(parent, id, pathFromId(id)); return new QnxRunConfiguration(parent, id, pathFromId(id));
return 0;
} }
bool QnxRunConfigurationFactory::canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const bool QnxRunConfigurationFactory::canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const

View File

@@ -47,7 +47,6 @@ public:
QString displayNameForId(const Core::Id id) const; QString displayNameForId(const Core::Id id) const;
bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const; bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const;
ProjectExplorer::RunConfiguration *create(ProjectExplorer::Target *parent, const Core::Id id);
bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const; bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const;
ProjectExplorer::RunConfiguration *restore(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *restore(ProjectExplorer::Target *parent,
@@ -57,7 +56,10 @@ public:
ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent,
ProjectExplorer::RunConfiguration *source); ProjectExplorer::RunConfiguration *source);
private:
bool canHandle(ProjectExplorer::Target *t) const; bool canHandle(ProjectExplorer::Target *t) const;
ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, const Core::Id id);
}; };
} // namespace Internal } // namespace Internal

View File

@@ -735,11 +735,8 @@ bool Qt4RunConfigurationFactory::canCreate(ProjectExplorer::Target *parent, cons
return project->hasApplicationProFile(pathFromId(id)); return project->hasApplicationProFile(pathFromId(id));
} }
ProjectExplorer::RunConfiguration *Qt4RunConfigurationFactory::create(ProjectExplorer::Target *parent, const Core::Id id) ProjectExplorer::RunConfiguration *Qt4RunConfigurationFactory::doCreate(ProjectExplorer::Target *parent, const Core::Id id)
{ {
if (!canCreate(parent, id))
return 0;
Qt4RunConfiguration *rc = new Qt4RunConfiguration(parent, id); Qt4RunConfiguration *rc = new Qt4RunConfiguration(parent, id);
QList<Qt4ProFileNode *> profiles = static_cast<Qt4Project *>(parent->project())->applicationProFiles(); QList<Qt4ProFileNode *> profiles = static_cast<Qt4Project *>(parent->project())->applicationProFiles();
foreach (Qt4ProFileNode *node, profiles) { foreach (Qt4ProFileNode *node, profiles) {

View File

@@ -213,7 +213,6 @@ public:
~Qt4RunConfigurationFactory(); ~Qt4RunConfigurationFactory();
bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const; bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const;
ProjectExplorer::RunConfiguration *create(ProjectExplorer::Target *parent, const Core::Id id);
bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const; bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const;
ProjectExplorer::RunConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map); ProjectExplorer::RunConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map);
bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const; bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const;
@@ -225,6 +224,9 @@ public:
bool canHandle(ProjectExplorer::Target *t) const; bool canHandle(ProjectExplorer::Target *t) const;
QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Target *t, QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Target *t,
ProjectExplorer::Node *n); ProjectExplorer::Node *n);
private:
ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, const Core::Id id);
}; };
} // namespace Internal } // namespace Internal

View File

@@ -400,11 +400,9 @@ bool CustomExecutableRunConfigurationFactory::canCreate(ProjectExplorer::Target
} }
ProjectExplorer::RunConfiguration * ProjectExplorer::RunConfiguration *
CustomExecutableRunConfigurationFactory::create(ProjectExplorer::Target *parent, const Core::Id id) CustomExecutableRunConfigurationFactory::doCreate(ProjectExplorer::Target *parent, const Core::Id id)
{ {
if (!canCreate(parent, id)) Q_UNUSED(id);
return 0;
return new CustomExecutableRunConfiguration(parent); return new CustomExecutableRunConfiguration(parent);
} }

View File

@@ -138,7 +138,6 @@ public:
QString displayNameForId(const Core::Id id) const; QString displayNameForId(const Core::Id id) const;
bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const; bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const;
ProjectExplorer::RunConfiguration *create(ProjectExplorer::Target *parent, const Core::Id id);
bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const; bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const;
ProjectExplorer::RunConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map); ProjectExplorer::RunConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map);
bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *product) const; bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *product) const;
@@ -147,6 +146,8 @@ public:
private: private:
bool canHandle(ProjectExplorer::Target *parent) const; bool canHandle(ProjectExplorer::Target *parent) const;
ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, const Core::Id id);
}; };
} // namespace QtSupport } // namespace QtSupport

View File

@@ -105,9 +105,8 @@ QString RemoteLinuxRunConfigurationFactory::displayNameForId(const Core::Id id)
+ tr(" (on Remote Generic Linux Host)"); + tr(" (on Remote Generic Linux Host)");
} }
RunConfiguration *RemoteLinuxRunConfigurationFactory::create(Target *parent, const Core::Id id) RunConfiguration *RemoteLinuxRunConfigurationFactory::doCreate(Target *parent, const Core::Id id)
{ {
QTC_ASSERT(canCreate(parent, id), return 0);
return new RemoteLinuxRunConfiguration(parent, id, pathFromId(id)); return new RemoteLinuxRunConfiguration(parent, id, pathFromId(id));
} }

View File

@@ -46,7 +46,6 @@ public:
QList<Core::Id> availableCreationIds(ProjectExplorer::Target *parent) const; QList<Core::Id> availableCreationIds(ProjectExplorer::Target *parent) const;
bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const; bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const;
ProjectExplorer::RunConfiguration *create(ProjectExplorer::Target *parent, const Core::Id id);
bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const; bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const;
ProjectExplorer::RunConfiguration *restore(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *restore(ProjectExplorer::Target *parent,
@@ -58,6 +57,8 @@ public:
private: private:
bool canHandle(const ProjectExplorer::Target *target) const; bool canHandle(const ProjectExplorer::Target *target) const;
ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, const Core::Id id);
}; };
} // namespace Internal } // namespace Internal