Commit 07d486ce authored by Tobias Hunger's avatar Tobias Hunger Committed by hjk
Browse files

PluginManager: Do not use instance() when that is not needed



Change-Id: I68e1b20561098c375557be6db1fb528e0ae040f6
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent 13d9a7b5
......@@ -573,7 +573,7 @@ bool CMakeProject::fromMap(const QVariantMap &map)
t->addBuildConfiguration(bc);
DeployConfigurationFactory *fac = ExtensionSystem::PluginManager::instance()->getObject<DeployConfigurationFactory>();
DeployConfigurationFactory *fac = ExtensionSystem::PluginManager::getObject<DeployConfigurationFactory>();
ProjectExplorer::DeployConfiguration *dc = fac->create(t, ProjectExplorer::Constants::DEFAULT_DEPLOYCONFIGURATION_ID);
t->addDeployConfiguration(dc);
......@@ -630,14 +630,14 @@ bool CMakeProject::fromMap(const QVariantMap &map)
bool CMakeProject::setupTarget(Target *t)
{
CMakeBuildConfigurationFactory *factory
= ExtensionSystem::PluginManager::instance()->getObject<CMakeBuildConfigurationFactory>();
= ExtensionSystem::PluginManager::getObject<CMakeBuildConfigurationFactory>();
CMakeBuildConfiguration *bc = factory->create(t, Constants::CMAKE_BC_ID, QLatin1String("all"));
if (!bc)
return false;
t->addBuildConfiguration(bc);
DeployConfigurationFactory *fac = ExtensionSystem::PluginManager::instance()->getObject<DeployConfigurationFactory>();
DeployConfigurationFactory *fac = ExtensionSystem::PluginManager::getObject<DeployConfigurationFactory>();
ProjectExplorer::DeployConfiguration *dc = fac->create(t, ProjectExplorer::Constants::DEFAULT_DEPLOYCONFIGURATION_ID);
t->addDeployConfiguration(dc);
return true;
......
......@@ -303,7 +303,7 @@ IBuildConfigurationFactory::~IBuildConfigurationFactory()
IBuildConfigurationFactory *IBuildConfigurationFactory::find(Target *parent, const QVariantMap &map)
{
QList<IBuildConfigurationFactory *> factories
= ExtensionSystem::PluginManager::instance()->getObjects<IBuildConfigurationFactory>();
= ExtensionSystem::PluginManager::getObjects<IBuildConfigurationFactory>();
foreach (IBuildConfigurationFactory *factory, factories) {
if (factory->canRestore(parent, map))
return factory;
......@@ -315,7 +315,7 @@ IBuildConfigurationFactory *IBuildConfigurationFactory::find(Target *parent, con
IBuildConfigurationFactory * IBuildConfigurationFactory::find(Target *parent)
{
QList<IBuildConfigurationFactory *> factories
= ExtensionSystem::PluginManager::instance()->getObjects<IBuildConfigurationFactory>();
= ExtensionSystem::PluginManager::getObjects<IBuildConfigurationFactory>();
foreach (IBuildConfigurationFactory *factory, factories) {
if (!factory->availableCreationIds(parent).isEmpty())
return factory;
......@@ -327,7 +327,7 @@ IBuildConfigurationFactory * IBuildConfigurationFactory::find(Target *parent)
IBuildConfigurationFactory *IBuildConfigurationFactory::find(Target *parent, BuildConfiguration *bc)
{
QList<IBuildConfigurationFactory *> factories
= ExtensionSystem::PluginManager::instance()->getObjects<IBuildConfigurationFactory>();
= ExtensionSystem::PluginManager::getObjects<IBuildConfigurationFactory>();
foreach (IBuildConfigurationFactory *factory, factories) {
if (factory->canClone(parent, bc))
return factory;
......
......@@ -232,7 +232,7 @@ DeployConfiguration *DeployConfigurationFactory::clone(Target *parent, DeployCon
DeployConfigurationFactory *DeployConfigurationFactory::find(Target *parent, const QVariantMap &map)
{
QList<DeployConfigurationFactory *> factories
= ExtensionSystem::PluginManager::instance()->getObjects<DeployConfigurationFactory>();
= ExtensionSystem::PluginManager::getObjects<DeployConfigurationFactory>();
foreach (DeployConfigurationFactory *factory, factories) {
if (factory->canRestore(parent, map))
return factory;
......@@ -244,7 +244,7 @@ QList<DeployConfigurationFactory *> DeployConfigurationFactory::find(Target *par
{
QList<DeployConfigurationFactory *> result;
QList<DeployConfigurationFactory *> factories
= ExtensionSystem::PluginManager::instance()->getObjects<DeployConfigurationFactory>();
= ExtensionSystem::PluginManager::getObjects<DeployConfigurationFactory>();
foreach (DeployConfigurationFactory *factory, factories) {
if (!factory->availableCreationIds(parent).isEmpty())
result << factory;
......@@ -255,7 +255,7 @@ QList<DeployConfigurationFactory *> DeployConfigurationFactory::find(Target *par
DeployConfigurationFactory *DeployConfigurationFactory::find(Target *parent, DeployConfiguration *dc)
{
QList<DeployConfigurationFactory *> factories
= ExtensionSystem::PluginManager::instance()->getObjects<DeployConfigurationFactory>();
= ExtensionSystem::PluginManager::getObjects<DeployConfigurationFactory>();
foreach (DeployConfigurationFactory *factory, factories) {
if (factory->canClone(parent, dc))
return factory;
......
......@@ -328,7 +328,7 @@ KitInformation::ItemList DeviceTypeKitInformation::toUserOutput(const Kit *k) co
QString typeDisplayName = tr("Unknown device type");
if (type.isValid()) {
QList<IDeviceFactory *> factories
= ExtensionSystem::PluginManager::instance()->getObjects<IDeviceFactory>();
= ExtensionSystem::PluginManager::getObjects<IDeviceFactory>();
foreach (IDeviceFactory *factory, factories) {
if (factory->availableCreationIds().contains(type)) {
typeDisplayName = factory->displayNameForId(type);
......
......@@ -248,7 +248,7 @@ DeviceTypeInformationConfigWidget::DeviceTypeInformationConfigWidget(Kit *workin
KitConfigWidget(workingCopy, sticky), m_isReadOnly(false), m_comboBox(new QComboBox)
{
QList<IDeviceFactory *> factories
= ExtensionSystem::PluginManager::instance()->getObjects<IDeviceFactory>();
= ExtensionSystem::PluginManager::getObjects<IDeviceFactory>();
foreach (IDeviceFactory *factory, factories) {
foreach (Core::Id id, factory->availableCreationIds())
m_comboBox->addItem(factory->displayNameForId(id), id.uniqueIdentifier());
......
......@@ -340,7 +340,7 @@ RunConfiguration *IRunConfigurationFactory::restore(Target *parent, const QVaria
IRunConfigurationFactory *IRunConfigurationFactory::find(Target *parent, const QVariantMap &map)
{
QList<IRunConfigurationFactory *> factories
= ExtensionSystem::PluginManager::instance()->getObjects<IRunConfigurationFactory>();
= ExtensionSystem::PluginManager::getObjects<IRunConfigurationFactory>();
foreach (IRunConfigurationFactory *factory, factories) {
if (factory->canRestore(parent, map))
return factory;
......@@ -351,7 +351,7 @@ IRunConfigurationFactory *IRunConfigurationFactory::find(Target *parent, const Q
IRunConfigurationFactory *IRunConfigurationFactory::find(Target *parent, RunConfiguration *rc)
{
QList<IRunConfigurationFactory *> factories
= ExtensionSystem::PluginManager::instance()->getObjects<IRunConfigurationFactory>();
= ExtensionSystem::PluginManager::getObjects<IRunConfigurationFactory>();
foreach (IRunConfigurationFactory *factory, factories) {
if (factory->canClone(parent, rc))
return factory;
......@@ -362,7 +362,7 @@ IRunConfigurationFactory *IRunConfigurationFactory::find(Target *parent, RunConf
QList<IRunConfigurationFactory *> IRunConfigurationFactory::find(Target *parent)
{
QList<IRunConfigurationFactory *> factories
= ExtensionSystem::PluginManager::instance()->getObjects<IRunConfigurationFactory>();
= ExtensionSystem::PluginManager::getObjects<IRunConfigurationFactory>();
QList<IRunConfigurationFactory *> result;
foreach (IRunConfigurationFactory *factory, factories) {
if (!factory->availableCreationIds(parent).isEmpty())
......
......@@ -41,7 +41,7 @@ ProFileHighlighter::ProFileHighlighter(QTextDocument *document) :
TextEditor::SyntaxHighlighter(document)
{
ProFileCompletionAssistProvider *pcap
= ExtensionSystem::PluginManager::instance()->getObject<ProFileCompletionAssistProvider>();
= ExtensionSystem::PluginManager::getObject<ProFileCompletionAssistProvider>();
m_keywords = TextEditor::Keywords(pcap->variables(), pcap->functions(), QMap<QString, QStringList>());
}
......
......@@ -47,7 +47,7 @@ ProFileHoverHandler::ProFileHoverHandler(QObject *parent)
m_manualKind(UnknownManual)
{
ProFileCompletionAssistProvider *pcap
= ExtensionSystem::PluginManager::instance()->getObject<ProFileCompletionAssistProvider>();
= ExtensionSystem::PluginManager::getObject<ProFileCompletionAssistProvider>();
m_keywords = TextEditor::Keywords(pcap->variables(), pcap->functions(), QMap<QString, QStringList>());
}
......
......@@ -43,7 +43,7 @@ QmakeRunConfigurationFactory *QmakeRunConfigurationFactory::find(ProjectExplorer
return 0;
QList<QmakeRunConfigurationFactory *> factories
= ExtensionSystem::PluginManager::instance()->getObjects<QmakeRunConfigurationFactory>();
= ExtensionSystem::PluginManager::getObjects<QmakeRunConfigurationFactory>();
foreach (QmakeRunConfigurationFactory *factory, factories) {
if (factory->canHandle(t))
return factory;
......
......@@ -222,7 +222,7 @@ void Qt4TargetSetupWidget::targetCheckBoxToggled(bool b)
void Qt4TargetSetupWidget::manageKit()
{
ProjectExplorer::KitOptionsPage *page =
ExtensionSystem::PluginManager::instance()->getObject<ProjectExplorer::KitOptionsPage>();
ExtensionSystem::PluginManager::getObject<ProjectExplorer::KitOptionsPage>();
if (!page || !m_kit)
return;
......
......@@ -167,8 +167,7 @@ WelcomeMode::WelcomeMode() :
scrollArea->setWidgetResizable(true);
m_welcomePage->setMinimumWidth(880);
m_welcomePage->setMinimumHeight(548);
PluginManager *pluginManager = PluginManager::instance();
connect(pluginManager, SIGNAL(objectAdded(QObject*)), SLOT(welcomePluginAdded(QObject*)));
connect(PluginManager::instance(), SIGNAL(objectAdded(QObject*)), SLOT(welcomePluginAdded(QObject*)));
setWidget(m_modeWidget);
}
......
......@@ -50,7 +50,7 @@ bool MyPlugin1::initialize(const QStringList & /*arguments*/, QString *errorStri
bool found2 = false;
bool found3 = false;
foreach (QObject *object, ExtensionSystem::PluginManager::instance()->allObjects()) {
foreach (QObject *object, ExtensionSystem::PluginManager::allObjects()) {
if (object->objectName() == QLatin1String("MyPlugin2"))
found2 = true;
else if (object->objectName() == QLatin1String("MyPlugin3"))
......
......@@ -49,7 +49,7 @@ bool MyPlugin3::initialize(const QStringList & /*arguments*/, QString *errorStri
addAutoReleasedObject(obj);
bool found2 = false;
foreach (QObject *object, ExtensionSystem::PluginManager::instance()->allObjects()) {
foreach (QObject *object, ExtensionSystem::PluginManager::allObjects()) {
if (object->objectName() == QLatin1String("MyPlugin2"))
found2 = true;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment