diff options
author | Eike Ziller <eike.ziller@nokia.com> | 2012-06-18 11:34:15 +0200 |
---|---|---|
committer | hjk <qthjk@ovi.com> | 2012-06-19 16:11:40 +0200 |
commit | e3c354d8f2ece80ec221ea85cf0058f433f7af98 (patch) | |
tree | 9f68a2e946a37d690b9def642dea85ecc3b0caf2 /src | |
parent | 9daa34003dd64df6795b781cf0286f9e6c71b7dc (diff) | |
download | qt-creator-e3c354d8f2ece80ec221ea85cf0058f433f7af98.tar.gz |
Make PluginManager mostly static.
Change-Id: Ib938aa4999c7c418a82304c5cca2e8748ef9d228
Reviewed-by: hjk <qthjk@ovi.com>
Diffstat (limited to 'src')
88 files changed, 287 insertions, 395 deletions
diff --git a/src/app/main.cpp b/src/app/main.cpp index 4b1a327f0c..e974f1ff2c 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -61,6 +61,8 @@ #include <qtsystemexceptionhandler.h> #endif +using namespace ExtensionSystem; + enum { OptionIndent = 4, DescriptionIndent = 34 }; static const char appNameC[] = "Qt Creator"; @@ -89,7 +91,7 @@ static const char SETTINGS_OPTION[] = "-settingspath"; static const char PID_OPTION[] = "-pid"; #endif -typedef QList<ExtensionSystem::PluginSpec *> PluginSpecSet; +typedef QList<PluginSpec *> PluginSpecSet; // Helpers for displaying messages. Note that there is no console on Windows. #ifdef Q_OS_WIN @@ -128,24 +130,23 @@ static void displayError(const QString &t) #endif -static void printVersion(const ExtensionSystem::PluginSpec *coreplugin, - const ExtensionSystem::PluginManager &pm) +static void printVersion(const PluginSpec *coreplugin) { QString version; QTextStream str(&version); str << '\n' << appNameC << ' ' << coreplugin->version()<< " based on Qt " << qVersion() << "\n\n"; - pm.formatPluginVersions(str); + PluginManager::formatPluginVersions(str); str << '\n' << coreplugin->copyright() << '\n'; displayHelpText(version); } -static void printHelp(const QString &a0, const ExtensionSystem::PluginManager &pm) +static void printHelp(const QString &a0) { QString help; QTextStream str(&help); str << "Usage: " << a0 << fixedOptionsC; - ExtensionSystem::PluginManager::formatOptions(str, OptionIndent, DescriptionIndent); - pm.formatPluginOptions(str, OptionIndent, DescriptionIndent); + PluginManager::formatOptions(str, OptionIndent, DescriptionIndent); + PluginManager::formatPluginOptions(str, OptionIndent, DescriptionIndent); displayHelpText(help); } @@ -264,10 +265,10 @@ int main(int argc, char **argv) QSettings *globalSettings = new QSettings(QSettings::IniFormat, QSettings::SystemScope, QLatin1String(Core::Constants::IDE_SETTINGSVARIANT_STR), QLatin1String("QtCreator")); - ExtensionSystem::PluginManager pluginManager; - pluginManager.setFileExtension(QLatin1String("pluginspec")); - pluginManager.setGlobalSettings(globalSettings); - pluginManager.setSettings(settings); + PluginManager pluginManager; + PluginManager::setFileExtension(QLatin1String("pluginspec")); + PluginManager::setGlobalSettings(globalSettings); + PluginManager::setSettings(settings); QTranslator translator; QTranslator qtTranslator; @@ -323,7 +324,7 @@ int main(int argc, char **argv) #endif // Load const QStringList pluginPaths = getPluginPaths(); - pluginManager.setPluginPaths(pluginPaths); + PluginManager::setPluginPaths(pluginPaths); QMap<QString, QString> foundAppOptions; if (arguments.size() > 1) { @@ -338,16 +339,16 @@ int main(int argc, char **argv) appOptions.insert(QLatin1String(PID_OPTION), true); #endif QString errorMessage; - if (!pluginManager.parseOptions(arguments, appOptions, &foundAppOptions, &errorMessage)) { + if (!PluginManager::parseOptions(arguments, appOptions, &foundAppOptions, &errorMessage)) { displayError(errorMessage); - printHelp(QFileInfo(app.applicationFilePath()).baseName(), pluginManager); + printHelp(QFileInfo(app.applicationFilePath()).baseName()); return -1; } } - const PluginSpecSet plugins = pluginManager.plugins(); - ExtensionSystem::PluginSpec *coreplugin = 0; - foreach (ExtensionSystem::PluginSpec *spec, plugins) { + const PluginSpecSet plugins = PluginManager::plugins(); + PluginSpec *coreplugin = 0; + foreach (PluginSpec *spec, plugins) { if (spec->name() == QLatin1String(corePluginNameC)) { coreplugin = spec; break; @@ -364,14 +365,14 @@ int main(int argc, char **argv) return 1; } if (foundAppOptions.contains(QLatin1String(VERSION_OPTION))) { - printVersion(coreplugin, pluginManager); + printVersion(coreplugin); return 0; } if (foundAppOptions.contains(QLatin1String(HELP_OPTION1)) || foundAppOptions.contains(QLatin1String(HELP_OPTION2)) || foundAppOptions.contains(QLatin1String(HELP_OPTION3)) || foundAppOptions.contains(QLatin1String(HELP_OPTION4))) { - printHelp(QFileInfo(app.applicationFilePath()).baseName(), pluginManager); + printHelp(QFileInfo(app.applicationFilePath()).baseName()); return 0; } @@ -387,7 +388,7 @@ int main(int argc, char **argv) #endif if (app.isRunning() && (pid != -1 || foundAppOptions.contains(QLatin1String(CLIENT_OPTION)))) { - if (app.sendMessage(pluginManager.serializedArguments(), 5000 /*timeout*/, pid)) + if (app.sendMessage(PluginManager::serializedArguments(), 5000 /*timeout*/, pid)) return 0; // Message could not be send, maybe it was in the process of quitting @@ -395,7 +396,7 @@ int main(int argc, char **argv) // Nah app is still running, ask the user int button = askMsgSendFailed(); while(button == QMessageBox::Retry) { - if (app.sendMessage(pluginManager.serializedArguments(), 5000 /*timeout*/, pid)) + if (app.sendMessage(PluginManager::serializedArguments(), 5000 /*timeout*/, pid)) return 0; if (!app.isRunning(pid)) // App quit while we were trying so start a new creator button = QMessageBox::Yes; @@ -407,13 +408,13 @@ int main(int argc, char **argv) } } - pluginManager.loadPlugins(); + PluginManager::loadPlugins(); if (coreplugin->hasError()) { displayError(msgCoreLoadFailure(coreplugin->errorString())); return 1; } - if (pluginManager.hasError()) { - ExtensionSystem::PluginErrorOverview errorOverview(&pluginManager); + if (PluginManager::hasError()) { + PluginErrorOverview errorOverview; errorOverview.exec(); } @@ -430,7 +431,7 @@ int main(int argc, char **argv) #ifdef WITH_TESTS // Do this after the event loop has started - if (pluginManager.runningTests()) + if (PluginManager::runningTests()) QTimer::singleShot(100, &pluginManager, SLOT(startTests())); #endif diff --git a/src/libs/extensionsystem/extensionsystem.pro b/src/libs/extensionsystem/extensionsystem.pro index 9a0937742f..13e1f39809 100644 --- a/src/libs/extensionsystem/extensionsystem.pro +++ b/src/libs/extensionsystem/extensionsystem.pro @@ -23,7 +23,6 @@ HEADERS += pluginerrorview.h \ pluginspec.h \ pluginspec_p.h \ pluginview.h \ - pluginview_p.h \ optionsparser.h \ plugincollection.h \ pluginerroroverview.h diff --git a/src/libs/extensionsystem/iplugin.cpp b/src/libs/extensionsystem/iplugin.cpp index e6ee6e4a6b..0817e1efc8 100644 --- a/src/libs/extensionsystem/iplugin.cpp +++ b/src/libs/extensionsystem/iplugin.cpp @@ -185,9 +185,8 @@ IPlugin::IPlugin() */ IPlugin::~IPlugin() { - PluginManager *pm = PluginManager::instance(); foreach (QObject *obj, d->addedObjectsInReverseOrder) - pm->removeObject(obj); + PluginManager::removeObject(obj); qDeleteAll(d->addedObjectsInReverseOrder); d->addedObjectsInReverseOrder.clear(); delete d; @@ -211,7 +210,7 @@ PluginSpec *IPlugin::pluginSpec() const */ void IPlugin::addObject(QObject *obj) { - PluginManager::instance()->addObject(obj); + PluginManager::addObject(obj); } /*! @@ -227,7 +226,7 @@ void IPlugin::addObject(QObject *obj) void IPlugin::addAutoReleasedObject(QObject *obj) { d->addedObjectsInReverseOrder.prepend(obj); - PluginManager::instance()->addObject(obj); + PluginManager::addObject(obj); } /*! @@ -237,6 +236,6 @@ void IPlugin::addAutoReleasedObject(QObject *obj) */ void IPlugin::removeObject(QObject *obj) { - PluginManager::instance()->removeObject(obj); + PluginManager::removeObject(obj); } diff --git a/src/libs/extensionsystem/pluginerroroverview.cpp b/src/libs/extensionsystem/pluginerroroverview.cpp index ad87241603..1d65f52dc5 100644 --- a/src/libs/extensionsystem/pluginerroroverview.cpp +++ b/src/libs/extensionsystem/pluginerroroverview.cpp @@ -44,7 +44,7 @@ class PluginErrorOverviewPrivate : public QObject { Q_OBJECT public: - PluginErrorOverviewPrivate(PluginManager *manager, QDialog *dialog); + PluginErrorOverviewPrivate(QDialog *dialog); ~PluginErrorOverviewPrivate(); private slots: @@ -52,7 +52,6 @@ private slots: private: Ui::PluginErrorOverview *m_ui; - PluginManager *m_manager; }; } // Internal @@ -61,9 +60,9 @@ private: using namespace ExtensionSystem; using namespace ExtensionSystem::Internal; -PluginErrorOverview::PluginErrorOverview(PluginManager *manager, QWidget *parent) : +PluginErrorOverview::PluginErrorOverview(QWidget *parent) : QDialog(parent), - d(new PluginErrorOverviewPrivate(manager, this)) + d(new PluginErrorOverviewPrivate(this)) { } @@ -72,14 +71,13 @@ PluginErrorOverview::~PluginErrorOverview() delete d; } -PluginErrorOverviewPrivate::PluginErrorOverviewPrivate(PluginManager *manager, QDialog *dialog) - : m_ui(new Ui::PluginErrorOverview), - m_manager(manager) +PluginErrorOverviewPrivate::PluginErrorOverviewPrivate(QDialog *dialog) + : m_ui(new Ui::PluginErrorOverview) { m_ui->setupUi(dialog); m_ui->buttonBox->addButton(tr("Continue"), QDialogButtonBox::AcceptRole); - foreach (PluginSpec *spec, m_manager->plugins()) { + foreach (PluginSpec *spec, PluginManager::plugins()) { // only show errors on startup if plugin is enabled. if (spec->hasError() && spec->isEnabled() && !spec->isDisabledIndirectly()) { QListWidgetItem *item = new QListWidgetItem(spec->name()); diff --git a/src/libs/extensionsystem/pluginerroroverview.h b/src/libs/extensionsystem/pluginerroroverview.h index 148b67bed3..4e65335b0f 100644 --- a/src/libs/extensionsystem/pluginerroroverview.h +++ b/src/libs/extensionsystem/pluginerroroverview.h @@ -50,7 +50,7 @@ class EXTENSIONSYSTEM_EXPORT PluginErrorOverview : public QDialog Q_OBJECT public: - explicit PluginErrorOverview(PluginManager *manager, QWidget *parent = 0); + explicit PluginErrorOverview(QWidget *parent = 0); ~PluginErrorOverview(); private: diff --git a/src/libs/extensionsystem/pluginmanager.cpp b/src/libs/extensionsystem/pluginmanager.cpp index cd311c9858..e8a90249f1 100644 --- a/src/libs/extensionsystem/pluginmanager.cpp +++ b/src/libs/extensionsystem/pluginmanager.cpp @@ -290,7 +290,7 @@ PluginManager::~PluginManager() */ void PluginManager::addObject(QObject *obj) { - d->addObject(obj); + m_instance->d->addObject(obj); } /*! @@ -300,7 +300,7 @@ void PluginManager::addObject(QObject *obj) */ void PluginManager::removeObject(QObject *obj) { - d->removeObject(obj); + m_instance->d->removeObject(obj); } /*! @@ -310,9 +310,9 @@ void PluginManager::removeObject(QObject *obj) \sa PluginManager::getObject() \sa PluginManager::getObjects() */ -QList<QObject *> PluginManager::allObjects() const +QList<QObject *> PluginManager::allObjects() { - return d->allObjects; + return m_instance->d->allObjects; } /*! @@ -326,7 +326,7 @@ QList<QObject *> PluginManager::allObjects() const */ void PluginManager::loadPlugins() { - return d->loadPlugins(); + return m_instance->d->loadPlugins(); } /*! @@ -334,7 +334,7 @@ void PluginManager::loadPlugins() Returns true if any plugin has errors even though it is enabled. Most useful to call after loadPlugins(). */ -bool PluginManager::hasError() const +bool PluginManager::hasError() { foreach (PluginSpec *spec, plugins()) { // only show errors on startup if plugin is enabled. @@ -360,9 +360,9 @@ void PluginManager::shutdown() \sa setPluginPaths() */ -QStringList PluginManager::pluginPaths() const +QStringList PluginManager::pluginPaths() { - return d->pluginPaths; + return m_instance->d->pluginPaths; } /*! @@ -376,7 +376,7 @@ QStringList PluginManager::pluginPaths() const */ void PluginManager::setPluginPaths(const QStringList &paths) { - d->setPluginPaths(paths); + m_instance->d->setPluginPaths(paths); } /*! @@ -386,9 +386,9 @@ void PluginManager::setPluginPaths(const QStringList &paths) \sa setFileExtension() */ -QString PluginManager::fileExtension() const +QString PluginManager::fileExtension() { - return d->extension; + return m_instance->d->extension; } /*! @@ -400,7 +400,7 @@ QString PluginManager::fileExtension() const */ void PluginManager::setFileExtension(const QString &extension) { - d->extension = extension; + m_instance->d->extension = extension; } /*! @@ -409,7 +409,7 @@ void PluginManager::setFileExtension(const QString &extension) */ void PluginManager::setSettings(QSettings *settings) { - d->setSettings(settings); + m_instance->d->setSettings(settings); } /*! @@ -418,28 +418,28 @@ void PluginManager::setSettings(QSettings *settings) */ void PluginManager::setGlobalSettings(QSettings *settings) { - d->setGlobalSettings(settings); + m_instance->d->setGlobalSettings(settings); } /*! Returns the user specific settings used for information about enabled/disabled plugins. */ -QSettings *PluginManager::settings() const +QSettings *PluginManager::settings() { - return d->settings; + return m_instance->d->settings; } /*! Returns the global (user-independent) settings used for information about default disabled plugins. */ -QSettings *PluginManager::globalSettings() const +QSettings *PluginManager::globalSettings() { - return d->globalSettings; + return m_instance->d->globalSettings; } void PluginManager::writeSettings() { - d->writeSettings(); + m_instance->d->writeSettings(); } /*! @@ -447,9 +447,9 @@ void PluginManager::writeSettings() The arguments left over after parsing (Neither startup nor plugin arguments). Typically, this will be the list of files to open. */ -QStringList PluginManager::arguments() const +QStringList PluginManager::arguments() { - return d->arguments; + return m_instance->d->arguments; } /*! @@ -462,14 +462,14 @@ QStringList PluginManager::arguments() const \sa setPluginPaths() */ -QList<PluginSpec *> PluginManager::plugins() const +QList<PluginSpec *> PluginManager::plugins() { - return d->pluginSpecs; + return m_instance->d->pluginSpecs; } -QHash<QString, PluginCollection *> PluginManager::pluginCollections() const +QHash<QString, PluginCollection *> PluginManager::pluginCollections() { - return d->pluginCategories; + return m_instance->d->pluginCategories; } /*! @@ -485,7 +485,7 @@ QHash<QString, PluginCollection *> PluginManager::pluginCollections() const static const char argumentKeywordC[] = ":arguments"; -QString PluginManager::serializedArguments() const +QString PluginManager::serializedArguments() { const QChar separator = QLatin1Char('|'); QString rc; @@ -499,13 +499,13 @@ QString PluginManager::serializedArguments() const rc += ps->arguments().join(QString(separator)); } } - if (!d->arguments.isEmpty()) { + if (!m_instance->d->arguments.isEmpty()) { if (!rc.isEmpty()) rc += separator; rc += QLatin1String(argumentKeywordC); // If the argument appears to be a file, make it absolute // when sending to another instance. - foreach(const QString &argument, d->arguments) { + foreach (const QString &argument, m_instance->d->arguments) { rc += separator; const QFileInfo fi(argument); if (fi.exists() && fi.isRelative()) { @@ -578,7 +578,7 @@ bool PluginManager::parseOptions(const QStringList &args, QMap<QString, QString> *foundAppOptions, QString *errorString) { - OptionsParser options(args, appOptions, foundAppOptions, errorString, d); + OptionsParser options(args, appOptions, foundAppOptions, errorString, m_instance->d); return options.parse(); } @@ -633,12 +633,12 @@ void PluginManager::formatOptions(QTextStream &str, int optionIndentation, int d Format the plugin options of the plugin specs for command line help. */ -void PluginManager::formatPluginOptions(QTextStream &str, int optionIndentation, int descriptionIndentation) const +void PluginManager::formatPluginOptions(QTextStream &str, int optionIndentation, int descriptionIndentation) { typedef PluginSpec::PluginArgumentDescriptions PluginArgumentDescriptions; // Check plugins for options - const PluginSpecSet::const_iterator pcend = d->pluginSpecs.constEnd(); - for (PluginSpecSet::const_iterator pit = d->pluginSpecs.constBegin(); pit != pcend; ++pit) { + const PluginSpecSet::const_iterator pcend = m_instance->d->pluginSpecs.constEnd(); + for (PluginSpecSet::const_iterator pit = m_instance->d->pluginSpecs.constBegin(); pit != pcend; ++pit) { const PluginArgumentDescriptions pargs = (*pit)->argumentDescriptions(); if (!pargs.empty()) { str << "\nPlugin: " << (*pit)->name() << '\n'; @@ -655,10 +655,10 @@ void PluginManager::formatPluginOptions(QTextStream &str, int optionIndentation, Format the version of the plugin specs for command line help. */ -void PluginManager::formatPluginVersions(QTextStream &str) const +void PluginManager::formatPluginVersions(QTextStream &str) { - const PluginSpecSet::const_iterator cend = d->pluginSpecs.constEnd(); - for (PluginSpecSet::const_iterator it = d->pluginSpecs.constBegin(); it != cend; ++it) { + const PluginSpecSet::const_iterator cend = m_instance->d->pluginSpecs.constEnd(); + for (PluginSpecSet::const_iterator it = m_instance->d->pluginSpecs.constBegin(); it != cend; ++it) { const PluginSpec *ps = *it; str << " " << ps->name() << ' ' << ps->version() << ' ' << ps->description() << '\n'; } @@ -699,16 +699,16 @@ void PluginManager::startTests() * \fn bool PluginManager::runningTests() const * \internal */ -bool PluginManager::runningTests() const +bool PluginManager::runningTests() { - return !d->testSpecs.isEmpty(); + return !m_instance->d->testSpecs.isEmpty(); } /*! * \fn QString PluginManager::testDataDirectory() const * \internal */ -QString PluginManager::testDataDirectory() const +QString PluginManager::testDataDirectory() { QByteArray ba = qgetenv("QTCREATOR_TEST_DIR"); QString s = QString::fromLocal8Bit(ba.constData(), ba.size()); @@ -728,7 +728,7 @@ QString PluginManager::testDataDirectory() const void PluginManager::profilingReport(const char *what, const PluginSpec *spec) { - d->profilingReport(what, spec); + m_instance->d->profilingReport(what, spec); } @@ -739,7 +739,7 @@ void PluginManager::profilingReport(const char *what, const PluginSpec *spec) */ QList<PluginSpec *> PluginManager::loadQueue() { - return d->loadQueue(); + return m_instance->d->loadQueue(); } //============PluginManagerPrivate=========== @@ -1286,9 +1286,9 @@ void PluginManagerPrivate::profilingReport(const char *what, const PluginSpec *s \sa addObject() */ -QObject *PluginManager::getObjectByName(const QString &name) const +QObject *PluginManager::getObjectByName(const QString &name) { - QReadLocker lock(&m_lock); + QReadLocker lock(&m_instance->m_lock); QList<QObject *> all = allObjects(); foreach (QObject *obj, all) { if (obj->objectName() == name) @@ -1303,10 +1303,10 @@ QObject *PluginManager::getObjectByName(const QString &name) const \sa addObject() */ -QObject *PluginManager::getObjectByClassName(const QString &className) const +QObject *PluginManager::getObjectByClassName(const QString &className) { const QByteArray ba = className.toUtf8(); - QReadLocker lock(&m_lock); + QReadLocker lock(&m_instance->m_lock); QList<QObject *> all = allObjects(); foreach (QObject *obj, all) { if (obj->inherits(ba.constData())) diff --git a/src/libs/extensionsystem/pluginmanager.h b/src/libs/extensionsystem/pluginmanager.h index b0d555dd64..2d0529b375 100644 --- a/src/libs/extensionsystem/pluginmanager.h +++ b/src/libs/extensionsystem/pluginmanager.h @@ -66,12 +66,12 @@ public: virtual ~PluginManager(); // Object pool operations - void addObject(QObject *obj); - void removeObject(QObject *obj); - QList<QObject *> allObjects() const; - template <typename T> QList<T *> getObjects() const + static void addObject(QObject *obj); + static void removeObject(QObject *obj); + static QList<QObject *> allObjects(); + template <typename T> static QList<T *> getObjects() { - QReadLocker lock(&m_lock); + QReadLocker lock(&m_instance->m_lock); QList<T *> results; QList<QObject *> all = allObjects(); QList<T *> result; @@ -82,9 +82,9 @@ public: } return results; } - template <typename T> T *getObject() const + template <typename T> static T *getObject() { - QReadLocker lock(&m_lock); + QReadLocker lock(&m_instance->m_lock); QList<QObject *> all = allObjects(); T *result = 0; foreach (QObject *obj, all) { @@ -94,43 +94,43 @@ public: return result; } - QObject *getObjectByName(const QString &name) const; - QObject *getObjectByClassName(const QString &className) const; + static QObject *getObjectByName(const QString &name); + static QObject *getObjectByClassName(const QString &className); // Plugin operations - QList<PluginSpec *> loadQueue(); - void loadPlugins(); - QStringList pluginPaths() const; - void setPluginPaths(const QStringList &paths); - QList<PluginSpec *> plugins() const; - QHash<QString, PluginCollection *> pluginCollections() const; - void setFileExtension(const QString &extension); - QString fileExtension() const; - bool hasError() const; + static QList<PluginSpec *> loadQueue(); + static void loadPlugins(); + static QStringList pluginPaths(); + static void setPluginPaths(const QStringList &paths); + static QList<PluginSpec *> plugins(); + static QHash<QString, PluginCollection *> pluginCollections(); + static void setFileExtension(const QString &extension); + static QString fileExtension(); + static bool hasError(); // Settings - void setSettings(QSettings *settings); - QSettings *settings() const; - void setGlobalSettings(QSettings *settings); - QSettings *globalSettings() const; - void writeSettings(); + static void setSettings(QSettings *settings); + static QSettings *settings(); + static void setGlobalSettings(QSettings *settings); + static QSettings *globalSettings(); + static void writeSettings(); // command line arguments - QStringList arguments() const; - bool parseOptions(const QStringList &args, + static QStringList arguments(); + static bool parseOptions(const QStringList &args, const QMap<QString, bool> &appOptions, QMap<QString, QString> *foundAppOptions, QString *errorString); static void formatOptions(QTextStream &str, int optionIndentation, int descriptionIndentation); - void formatPluginOptions(QTextStream &str, int optionIndentation, int descriptionIndentation) const; - void formatPluginVersions(QTextStream &str) const; + static void formatPluginOptions(QTextStream &str, int optionIndentation, int descriptionIndentation); + static void formatPluginVersions(QTextStream &str); - QString serializedArguments() const; + static QString serializedArguments(); - bool runningTests() const; - QString testDataDirectory() const; + static bool runningTests(); + static QString testDataDirectory(); - void profilingReport(const char *what, const PluginSpec *spec = 0); + static void profilingReport(const char *what, const PluginSpec *spec = 0); signals: void objectAdded(QObject *obj); diff --git a/src/libs/extensionsystem/pluginview.cpp b/src/libs/extensionsystem/pluginview.cpp index b4e0699b6e..e04ef78652 100644 --- a/src/libs/extensionsystem/pluginview.cpp +++ b/src/libs/extensionsystem/pluginview.cpp @@ -31,7 +31,6 @@ **************************************************************************/ #include "pluginview.h" -#include "pluginview_p.h" #include "pluginmanager.h" #include "pluginspec.h" #include "plugincollection.h" @@ -78,10 +77,9 @@ Q_DECLARE_METATYPE(ExtensionSystem::PluginCollection*) Constructs a PluginView that gets the list of plugins from the given plugin \a manager with a given \a parent widget. */ -PluginView::PluginView(PluginManager *manager, QWidget *parent) +PluginView::PluginView(QWidget *parent) : QWidget(parent), m_ui(new Internal::Ui::PluginView), - p(new Internal::PluginViewPrivate), m_allowCheckStateUpdate(true), C_LOAD(1) { @@ -100,8 +98,7 @@ PluginView::PluginView(PluginManager *manager, QWidget *parent) m_whitelist << QString("Core") << QString("Locator") << QString("Find") << QString("TextEditor"); - p->manager = manager; - connect(p->manager, SIGNAL(pluginsChanged()), this, SLOT(updateList())); + connect(PluginManager::instance(), SIGNAL(pluginsChanged()), this, SLOT(updateList())); connect(m_ui->categoryWidget, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(selectPlugin(QTreeWidgetItem*))); connect(m_ui->categoryWidget, SIGNAL(itemActivated(QTreeWidgetItem*,int)), @@ -116,7 +113,6 @@ PluginView::PluginView(PluginManager *manager, QWidget *parent) */ PluginView::~PluginView() { - delete p; delete m_ui; } @@ -139,7 +135,7 @@ void PluginView::updateList() this, SLOT(updatePluginSettings(QTreeWidgetItem*,int))); PluginCollection *defaultCollection = 0; - foreach(PluginCollection *collection, p->manager->pluginCollections()) { + foreach (PluginCollection *collection, PluginManager::pluginCollections()) { if (collection->name().isEmpty()) { defaultCollection = collection; continue; @@ -345,7 +341,7 @@ void PluginView::updatePluginSettings(QTreeWidgetItem *item, int column) void PluginView::updatePluginDependencies() { - foreach (PluginSpec *spec, PluginManager::instance()->loadQueue()) { + foreach (PluginSpec *spec, PluginManager::loadQueue()) { bool disableIndirectly = false; if (m_whitelist.contains(spec->name())) continue; diff --git a/src/libs/extensionsystem/pluginview.h b/src/libs/extensionsystem/pluginview.h index c0ee0501b5..18b4d97f3a 100644 --- a/src/libs/extensionsystem/pluginview.h +++ b/src/libs/extensionsystem/pluginview.h @@ -50,7 +50,6 @@ class PluginSpec; class PluginCollection; namespace Internal { - class PluginViewPrivate; namespace Ui { class PluginView; } // namespace Ui @@ -61,7 +60,7 @@ class EXTENSIONSYSTEM_EXPORT PluginView : public QWidget Q_OBJECT public: - explicit PluginView(PluginManager *manager, QWidget *parent = 0); + explicit PluginView(QWidget *parent = 0); ~PluginView(); PluginSpec *currentPlugin() const; @@ -84,7 +83,6 @@ private: int parsePluginSpecs(QTreeWidgetItem *parentItem, Qt::CheckState &groupState, QList<PluginSpec*> plugins); Internal::Ui::PluginView *m_ui; - Internal::PluginViewPrivate *p; QList<QTreeWidgetItem*> m_items; QHash<PluginSpec*, QTreeWidgetItem*> m_specToItem; diff --git a/src/libs/extensionsystem/pluginview_p.h b/src/libs/extensionsystem/pluginview_p.h deleted file mode 100644 index 9e79d09cae..0000000000 --- a/src/libs/extensionsystem/pluginview_p.h +++ /dev/null @@ -1,51 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#ifndef PLUGINVIEW_P_H -#define PLUGINVIEW_P_H - -namespace ExtensionSystem { - -class PluginManager; - -namespace Internal { - -class PluginViewPrivate -{ -public: - PluginManager *manager; -}; - -} // namespace Internal -} // namespace ExtensionSystem - -#endif // PLUGINVIEW_P_H diff --git a/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp b/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp index 180e40c888..190792f830 100644 --- a/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp +++ b/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp @@ -188,7 +188,7 @@ bool AutotoolsProject::fromMap(const QVariantMap &map) bool hasUserFile = activeTarget(); if (!hasUserFile) { AutotoolsTargetFactory *factory = - ExtensionSystem::PluginManager::instance()->getObject<AutotoolsTargetFactory>(); + ExtensionSystem::PluginManager::getObject<AutotoolsTargetFactory>(); AutotoolsTarget *t = factory->create(this, Core::Id(Constants::DEFAULT_AUTOTOOLS_TARGET_ID)); QTC_ASSERT(t, return false); diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp index e0129942eb..1e2b642a40 100644 --- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp @@ -533,7 +533,7 @@ bool CMakeProject::fromMap(const QVariantMap &map) bool hasUserFile = activeTarget(); if (!hasUserFile) { CMakeTargetFactory *factory = - ExtensionSystem::PluginManager::instance()->getObject<CMakeTargetFactory>(); + ExtensionSystem::PluginManager::getObject<CMakeTargetFactory>(); CMakeTarget *t = factory->create(this, Core::Id(DEFAULT_CMAKE_TARGET_ID)); Q_ASSERT(t); diff --git a/src/plugins/coreplugin/basefilewizard.cpp b/src/plugins/coreplugin/basefilewizard.cpp index 28d560075d..ef2ac00330 100644 --- a/src/plugins/coreplugin/basefilewizard.cpp +++ b/src/plugins/coreplugin/basefilewizard.cpp @@ -442,7 +442,7 @@ void BaseFileWizard::runWizard(const QString &path, QWidget *parent, const QStri QString errorMessage; // Compile extension pages, purge out unused ones - ExtensionList extensions = ExtensionSystem::PluginManager::instance()->getObjects<IFileWizardExtension>(); + ExtensionList extensions = ExtensionSystem::PluginManager::getObjects<IFileWizardExtension>(); WizardPageList allExtensionPages; for (ExtensionList::iterator it = extensions.begin(); it != extensions.end(); ) { const WizardPageList extensionPages = (*it)->extensionPages(this); diff --git a/src/plugins/coreplugin/designmode.cpp b/src/plugins/coreplugin/designmode.cpp index e5ce5226fb..23e1fc37bd 100644 --- a/src/plugins/coreplugin/designmode.cpp +++ b/src/plugins/coreplugin/designmode.cpp @@ -133,7 +133,7 @@ DesignMode::DesignMode() setId(Constants::MODE_DESIGN); setType(Constants::MODE_DESIGN_TYPE); - ExtensionSystem::PluginManager::instance()->addObject(d->m_coreListener); + ExtensionSystem::PluginManager::addObject(d->m_coreListener); connect(EditorManager::instance(), SIGNAL(currentEditorChanged(Core::IEditor*)), this, SLOT(currentEditorChanged(Core::IEditor*))); @@ -144,7 +144,7 @@ DesignMode::DesignMode() DesignMode::~DesignMode() { - ExtensionSystem::PluginManager::instance()->removeObject(d->m_coreListener); + ExtensionSystem::PluginManager::removeObject(d->m_coreListener); delete d->m_coreListener; qDeleteAll(d->m_editors); diff --git a/src/plugins/coreplugin/dialogs/iwizard.cpp b/src/plugins/coreplugin/dialogs/iwizard.cpp index 3b16d7f59b..054b256dc9 100644 --- a/src/plugins/coreplugin/dialogs/iwizard.cpp +++ b/src/plugins/coreplugin/dialogs/iwizard.cpp @@ -160,7 +160,7 @@ QList<IWizard*> IWizard::allWizards() { // Hack: Trigger delayed creation of wizards ICore::emitNewItemsDialogRequested(); - return ExtensionSystem::PluginManager::instance()->getObjects<IWizard>(); + return ExtensionSystem::PluginManager::getObjects<IWizard>(); } // Utility to find all registered wizards of a certain kind @@ -182,7 +182,7 @@ bool IWizard::isAvailable(const QString &platformName) const { FeatureSet availableFeatures; - const QList<Core::IFeatureProvider*> featureManagers = ExtensionSystem::PluginManager::instance()->getObjects<Core::IFeatureProvider>(); + const QList<Core::IFeatureProvider*> featureManagers = ExtensionSystem::PluginManager::getObjects<Core::IFeatureProvider>(); foreach (const Core::IFeatureProvider *featureManager, featureManagers) availableFeatures |= featureManager->availableFeatures(platformName); @@ -207,7 +207,7 @@ QStringList IWizard::allAvailablePlatforms() QStringList platforms; const QList<Core::IFeatureProvider*> featureManagers = - ExtensionSystem::PluginManager::instance()->getObjects<Core::IFeatureProvider>(); + ExtensionSystem::PluginManager::getObjects<Core::IFeatureProvider>(); foreach (const Core::IFeatureProvider *featureManager, featureManagers) platforms.append(featureManager->availablePlatforms()); @@ -218,7 +218,7 @@ QStringList IWizard::allAvailablePlatforms() QString IWizard::displayNameForPlatform(const QString &string) { const QList<Core::IFeatureProvider*> featureManagers = - ExtensionSystem::PluginManager::instance()->getObjects<Core::IFeatureProvider>(); + ExtensionSystem::PluginManager::getObjects<Core::IFeatureProvider>(); foreach (const Core::IFeatureProvider *featureManager, featureManagers) { QString displayName = featureManager->displayNameForPlatform(string); diff --git a/src/plugins/coreplugin/dialogs/settingsdialog.cpp b/src/plugins/coreplugin/dialogs/settingsdialog.cpp index ac0b594831..12742ccf62 100644 --- a/src/plugins/coreplugin/dialogs/settingsdialog.cpp +++ b/src/plugins/coreplugin/dialogs/settingsdialog.cpp @@ -275,7 +275,7 @@ bool optionsPageLessThan(const IOptionsPage *p1, const IOptionsPage *p2) static inline QList<Core::IOptionsPage*> sortedOptionsPages() { - QList<Core::IOptionsPage*> rc = ExtensionSystem::PluginManager::instance()->getObjects<IOptionsPage>(); + QList<Core::IOptionsPage*> rc = ExtensionSystem::PluginManager::getObjects<IOptionsPage>(); qStableSort(rc.begin(), rc.end(), optionsPageLessThan); return rc; } @@ -304,7 +304,7 @@ SettingsDialog::SettingsDialog(QWidget *parent) : #endif m_model->setPages(m_pages, - ExtensionSystem::PluginManager::instance()->getObjects<IOptionsPageProvider>()); + ExtensionSystem::PluginManager::getObjects<IOptionsPageProvider>()); m_proxyModel->setSourceModel(m_model); m_proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive); diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index 54f4c424c1..3a73707f64 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -94,11 +94,6 @@ static const char kCurrentDocumentPath[] = "CurrentDocument:Path"; static const char kCurrentDocumentXPos[] = "CurrentDocument:XPos"; static const char kCurrentDocumentYPos[] = "CurrentDocument:YPos"; -static inline ExtensionSystem::PluginManager *pluginManager() -{ - return ExtensionSystem::PluginManager::instance(); -} - //===================EditorClosingCoreListener====================== namespace Core { @@ -443,12 +438,11 @@ EditorManager::~EditorManager() { m_instance = 0; if (ICore::instance()) { - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); if (d->m_coreListener) { - pm->removeObject(d->m_coreListener); + ExtensionSystem::PluginManager::removeObject(d->m_coreListener); delete d->m_coreListener; } - pm->removeObject(d->m_openEditorsFactory); + ExtensionSystem::PluginManager::removeObject(d->m_openEditorsFactory); delete d->m_openEditorsFactory; } delete d; @@ -457,10 +451,10 @@ EditorManager::~EditorManager() void EditorManager::init() { d->m_coreListener = new EditorClosingCoreListener(this); - pluginManager()->addObject(d->m_coreListener); + ExtensionSystem::PluginManager::addObject(d->m_coreListener); d->m_openEditorsFactory = new OpenEditorsViewFactory(); - pluginManager()->addObject(d->m_openEditorsFactory); + ExtensionSystem::PluginManager::addObject(d->m_openEditorsFactory); VariableManager *vm = VariableManager::instance(); vm->registerVariable(kCurrentDocumentFilePath, @@ -807,7 +801,7 @@ bool EditorManager::closeEditors(const QList<IEditor*> &editorsToClose, bool ask QList<IEditor*> acceptedEditors; //ask all core listeners to check whether the editor can be closed const QList<ICoreListener *> listeners = - pluginManager()->getObjects<ICoreListener>(); + ExtensionSystem::PluginManager::getObjects<ICoreListener>(); foreach (IEditor *editor, editorsToClose) { bool editorAccepted = true; if (d->m_editorModel->isDuplicate(editor)) @@ -1091,7 +1085,7 @@ EditorManager::EditorFactoryList EditorManager::editorFactories(const MimeType &mimeType, bool bestMatchOnly) { EditorFactoryList rc; - const EditorFactoryList allFactories = pluginManager()->getObjects<IEditorFactory>(); + const EditorFactoryList allFactories = ExtensionSystem::PluginManager::getObjects<IEditorFactory>(); mimeTypeFactoryRecursion(ICore::mimeDatabase(), mimeType, allFactories, bestMatchOnly, &rc); if (debugEditorManager) qDebug() << Q_FUNC_INFO << mimeType.type() << " returns " << rc; @@ -1102,7 +1096,7 @@ EditorManager::ExternalEditorList EditorManager::externalEditors(const MimeType &mimeType, bool bestMatchOnly) { ExternalEditorList rc; - const ExternalEditorList allEditors = pluginManager()->getObjects<IExternalEditor>(); + const ExternalEditorList allEditors = ExtensionSystem::PluginManager::getObjects<IExternalEditor>(); mimeTypeFactoryRecursion(ICore::mimeDatabase(), mimeType, allEditors, bestMatchOnly, &rc); if (debugEditorManager) qDebug() << Q_FUNC_INFO << mimeType.type() << " returns " << rc; @@ -1112,9 +1106,9 @@ EditorManager::ExternalEditorList /* For something that has a 'QString id' (IEditorFactory * or IExternalEditor), find the one matching a id. */ template <class EditorFactoryLike> -EditorFactoryLike *findById(ExtensionSystem::PluginManager *pm, const Core::Id &id) +EditorFactoryLike *findById(const Core::Id &id) { - const QList<EditorFactoryLike *> factories = pm->template getObjects<EditorFactoryLike>(); + const QList<EditorFactoryLike *> factories = ExtensionSystem::PluginManager::getObjects<EditorFactoryLike>(); foreach(EditorFactoryLike *efl, factories) if (id == efl->id()) return efl; @@ -1142,7 +1136,7 @@ IEditor *EditorManager::createEditor(const Id &editorId, const QString &fileName factories = editorFactories(mimeType, true); } else { // Find by editor id - if (IEditorFactory *factory = findById<IEditorFactory>(pluginManager(), editorId)) + if (IEditorFactory *factory = findById<IEditorFactory>(editorId)) factories.push_back(factory); } if (factories.empty()) { @@ -1317,7 +1311,7 @@ IEditor *EditorManager::openEditor(Core::Internal::EditorView *view, const QStri bool EditorManager::openExternalEditor(const QString &fileName, const Core::Id &editorId) { - IExternalEditor *ee = findById<IExternalEditor>(pluginManager(), editorId); + IExternalEditor *ee = findById<IExternalEditor>(editorId); if (!ee) return false; QString errorMessage; diff --git a/src/plugins/coreplugin/findplaceholder.cpp b/src/plugins/coreplugin/findplaceholder.cpp index 50eb340c94..6d1f1797a4 100644 --- a/src/plugins/coreplugin/findplaceholder.cpp +++ b/src/plugins/coreplugin/findplaceholder.cpp @@ -47,12 +47,12 @@ FindToolBarPlaceHolder::FindToolBarPlaceHolder(QWidget *owner, QWidget *parent) setLayout(new QVBoxLayout); setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum); layout()->setMargin(0); - ExtensionSystem::PluginManager::instance()->addObject(this); + ExtensionSystem::PluginManager::addObject(this); } FindToolBarPlaceHolder::~FindToolBarPlaceHolder() { - ExtensionSystem::PluginManager::instance()->removeObject(this); + ExtensionSystem::PluginManager::removeObject(this); if (m_subWidget) { m_subWidget->setVisible(false); m_subWidget->setParent(0); diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index 4064b1d5f3..04089f542f 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -133,8 +133,8 @@ MainWindow::MainWindow() : Utils::AppMainWindow(), m_coreImpl(new ICore(this)), m_additionalContexts(Constants::C_GLOBAL), - m_settings(ExtensionSystem::PluginManager::instance()->settings()), - m_globalSettings(ExtensionSystem::PluginManager::instance()->globalSettings()), + m_settings(ExtensionSystem::PluginManager::settings()), + m_globalSettings(ExtensionSystem::PluginManager::globalSettings()), m_settingsDatabase(new SettingsDatabase(QFileInfo(m_settings->fileName()).path(), QLatin1String("QtCreator"), this)), @@ -277,12 +277,11 @@ void MainWindow::setIsFullScreen(bool fullScreen) MainWindow::~MainWindow() { - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - pm->removeObject(m_shortcutSettings); - pm->removeObject(m_generalSettings); - pm->removeObject(m_toolSettings); - pm->removeObject(m_mimeTypeSettings); - pm->removeObject(m_systemEditor); + ExtensionSystem::PluginManager::removeObject(m_shortcutSettings); + ExtensionSystem::PluginManager::removeObject(m_generalSettings); + ExtensionSystem::PluginManager::removeObject(m_toolSettings); + ExtensionSystem::PluginManager::removeObject(m_mimeTypeSettings); + ExtensionSystem::PluginManager::removeObject(m_systemEditor); delete m_externalToolManager; m_externalToolManager = 0; delete m_messageManager; @@ -310,7 +309,7 @@ MainWindow::~MainWindow() OutputPaneManager::destroy(); // Now that the OutputPaneManager is gone, is a good time to delete the view - pm->removeObject(m_outputView); + ExtensionSystem::PluginManager::removeObject(m_outputView); delete m_outputView; delete m_editorManager; @@ -319,7 +318,7 @@ MainWindow::~MainWindow() m_statusBarManager = 0; delete m_progressManager; m_progressManager = 0; - pm->removeObject(m_coreImpl); + ExtensionSystem::PluginManager::removeObject(m_coreImpl); delete m_coreImpl; m_coreImpl = 0; @@ -342,24 +341,23 @@ bool MainWindow::init(QString *errorMessage) if (!mimeDatabase()->addMimeTypes(QLatin1String(":/core/editormanager/BinFiles.mimetypes.xml"), errorMessage)) return false; - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - pm->addObject(m_coreImpl); + ExtensionSystem::PluginManager::addObject(m_coreImpl); m_statusBarManager->init(); m_modeManager->init(); m_progressManager->init(); - pm->addObject(m_generalSettings); - pm->addObject(m_shortcutSettings); - pm->addObject(m_toolSettings); - pm->addObject(m_mimeTypeSettings); - pm->addObject(m_systemEditor); + ExtensionSystem::PluginManager::addObject(m_generalSettings); + ExtensionSystem::PluginManager::addObject(m_shortcutSettings); + ExtensionSystem::PluginManager::addObject(m_toolSettings); + ExtensionSystem::PluginManager::addObject(m_mimeTypeSettings); + ExtensionSystem::PluginManager::addObject(m_systemEditor); // Add widget to the bottom, we create the view here instead of inside the // OutputPaneManager, since the StatusBarManager needs to be initialized before m_outputView = new Core::StatusBarWidget; m_outputView->setWidget(OutputPaneManager::instance()->buttonsWidget()); m_outputView->setPosition(Core::StatusBarWidget::Second); - pm->addObject(m_outputView); + ExtensionSystem::PluginManager::addObject(m_outputView); m_messageManager->init(); return true; } @@ -370,7 +368,7 @@ void MainWindow::extensionsInitialized() m_statusBarManager->extensionsInitalized(); OutputPaneManager::instance()->init(); m_vcsManager->extensionsInitialized(); - m_navigationWidget->setFactories(ExtensionSystem::PluginManager::instance()->getObjects<INavigationWidgetFactory>()); + m_navigationWidget->setFactories(ExtensionSystem::PluginManager::getObjects<INavigationWidgetFactory>()); // reading the shortcut settings must be done after all shortcuts have been registered m_actionManager->d->initialize(); @@ -398,7 +396,7 @@ void MainWindow::closeEvent(QCloseEvent *event) } const QList<ICoreListener *> listeners = - ExtensionSystem::PluginManager::instance()->getObjects<ICoreListener>(); + ExtensionSystem::PluginManager::getObjects<ICoreListener>(); foreach (ICoreListener *listener, listeners) { if (!listener->coreAboutToClose()) { event->ignore(); @@ -826,7 +824,7 @@ void MainWindow::openFile() static QList<IDocumentFactory*> getNonEditorDocumentFactories() { const QList<IDocumentFactory*> allFileFactories = - ExtensionSystem::PluginManager::instance()->getObjects<IDocumentFactory>(); + ExtensionSystem::PluginManager::getObjects<IDocumentFactory>(); QList<IDocumentFactory*> nonEditorFileFactories; foreach (IDocumentFactory *factory, allFileFactories) { if (!qobject_cast<IEditorFactory *>(factory)) diff --git a/src/plugins/coreplugin/messagemanager.cpp b/src/plugins/coreplugin/messagemanager.cpp index f819615f67..a28e915612 100644 --- a/src/plugins/coreplugin/messagemanager.cpp +++ b/src/plugins/coreplugin/messagemanager.cpp @@ -50,9 +50,8 @@ MessageManager::MessageManager() MessageManager::~MessageManager() { - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - if (pm && m_messageOutputWindow) { - pm->removeObject(m_messageOutputWindow); + if (m_messageOutputWindow) { + ExtensionSystem::PluginManager::removeObject(m_messageOutputWindow); delete m_messageOutputWindow; } @@ -62,7 +61,7 @@ MessageManager::~MessageManager() void MessageManager::init() { m_messageOutputWindow = new Internal::MessageOutputWindow; - ExtensionSystem::PluginManager::instance()->addObject(m_messageOutputWindow); + ExtensionSystem::PluginManager::addObject(m_messageOutputWindow); } void MessageManager::showOutputPane() diff --git a/src/plugins/coreplugin/outputpanemanager.cpp b/src/plugins/coreplugin/outputpanemanager.cpp index 4a8f228302..7e8e7bbc18 100644 --- a/src/plugins/coreplugin/outputpanemanager.cpp +++ b/src/plugins/coreplugin/outputpanemanager.cpp @@ -247,8 +247,7 @@ void OutputPaneManager::init() QFontMetrics titleFm = m_titleLabel->fontMetrics(); int minTitleWidth = 0; - m_panes = ExtensionSystem::PluginManager::instance() - ->getObjects<IOutputPane>(); + m_panes = ExtensionSystem::PluginManager::getObjects<IOutputPane>(); qSort(m_panes.begin(), m_panes.end(), &comparePanes); const int n = m_panes.size(); diff --git a/src/plugins/coreplugin/plugindialog.cpp b/src/plugins/coreplugin/plugindialog.cpp index 6d3ad9eb81..bc6ad0adcb 100644 --- a/src/plugins/coreplugin/plugindialog.cpp +++ b/src/plugins/coreplugin/plugindialog.cpp @@ -52,7 +52,7 @@ bool PluginDialog::m_isRestartRequired = false; PluginDialog::PluginDialog(QWidget *parent) : QDialog(parent), - m_view(new ExtensionSystem::PluginView(ExtensionSystem::PluginManager::instance(), this)) + m_view(new ExtensionSystem::PluginView(this)) { QVBoxLayout *vl = new QVBoxLayout(this); vl->addWidget(m_view); @@ -97,7 +97,7 @@ PluginDialog::PluginDialog(QWidget *parent) void PluginDialog::closeDialog() { - ExtensionSystem::PluginManager::instance()->writeSettings(); + ExtensionSystem::PluginManager::writeSettings(); accept(); } diff --git a/src/plugins/coreplugin/vcsmanager.cpp b/src/plugins/coreplugin/vcsmanager.cpp index 1fc5f325cd..996e1310b6 100644 --- a/src/plugins/coreplugin/vcsmanager.cpp +++ b/src/plugins/coreplugin/vcsmanager.cpp @@ -53,7 +53,7 @@ typedef QList<IVersionControl *> VersionControlList; static inline VersionControlList allVersionControls() { - return ExtensionSystem::PluginManager::instance()->getObjects<IVersionControl>(); + return ExtensionSystem::PluginManager::getObjects<IVersionControl>(); } // ---- VCSManagerPrivate: diff --git a/src/plugins/cppeditor/cppquickfixassistant.cpp b/src/plugins/cppeditor/cppquickfixassistant.cpp index 41e52db9f6..8063201bd7 100644 --- a/src/plugins/cppeditor/cppquickfixassistant.cpp +++ b/src/plugins/cppeditor/cppquickfixassistant.cpp @@ -78,8 +78,7 @@ IAssistProcessor *CppQuickFixAssistProvider::createProcessor() const QList<TextEditor::QuickFixFactory *> CppQuickFixAssistProvider::quickFixFactories() const { QList<TextEditor::QuickFixFactory *> results; - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - foreach (CppQuickFixFactory *f, pm->getObjects<CppEditor::CppQuickFixFactory>()) + foreach (CppQuickFixFactory *f, ExtensionSystem::PluginManager::getObjects<CppEditor::CppQuickFixFactory>()) results.append(f); return results; } diff --git a/src/plugins/cppeditor/cppquickfixes.cpp b/src/plugins/cppeditor/cppquickfixes.cpp index 44292fe075..dc264c5881 100644 --- a/src/plugins/cppeditor/cppquickfixes.cpp +++ b/src/plugins/cppeditor/cppquickfixes.cpp @@ -1811,7 +1811,7 @@ class IncludeAdder : public CppQuickFixFactory public: virtual QList<CppQuickFixOperation::Ptr> match(const QSharedPointer<const CppQuickFixAssistInterface> &interface) { - CppClassesFilter *classesFilter = ExtensionSystem::PluginManager::instance()->getObject<CppClassesFilter>(); + CppClassesFilter *classesFilter = ExtensionSystem::PluginManager::getObject<CppClassesFilter>(); if (!classesFilter) return noResult(); diff --git a/src/plugins/cpptools/cppcodestylepreferencesfactory.cpp b/src/plugins/cpptools/cppcodestylepreferencesfactory.cpp index de1d65cf69..40cab10fa6 100644 --- a/src/plugins/cpptools/cppcodestylepreferencesfactory.cpp +++ b/src/plugins/cpptools/cppcodestylepreferencesfactory.cpp @@ -129,7 +129,7 @@ TextEditor::Indenter *CppCodeStylePreferencesFactory::createIndenter() const TextEditor::ISnippetProvider *CppCodeStylePreferencesFactory::snippetProvider() const { const QList<TextEditor::ISnippetProvider *> &providers = - ExtensionSystem::PluginManager::instance()->getObjects<TextEditor::ISnippetProvider>(); + ExtensionSystem::PluginManager::getObjects<TextEditor::ISnippetProvider>(); foreach (TextEditor::ISnippetProvider *provider, providers) if (provider->groupId() == QLatin1String(CppEditor::Constants::CPP_SNIPPETS_GROUP_ID)) return provider; diff --git a/src/plugins/cpptools/cppcodestylesettingspage.cpp b/src/plugins/cpptools/cppcodestylesettingspage.cpp index d28c4cd53e..094bda22df 100644 --- a/src/plugins/cpptools/cppcodestylesettingspage.cpp +++ b/src/plugins/cpptools/cppcodestylesettingspage.cpp @@ -452,7 +452,7 @@ void CppCodeStylePreferencesWidget::decorateEditors(const TextEditor::FontSettin { const ISnippetProvider *provider = 0; const QList<ISnippetProvider *> &providers = - ExtensionSystem::PluginManager::instance()->getObjects<ISnippetProvider>(); + ExtensionSystem::PluginManager::getObjects<ISnippetProvider>(); foreach (const ISnippetProvider *current, providers) { if (current->groupId() == QLatin1String(CppEditor::Constants::CPP_SNIPPETS_GROUP_ID)) { provider = current; diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp index dbc5db3a4f..31e8ca3e7c 100644 --- a/src/plugins/cpptools/cppmodelmanager.cpp +++ b/src/plugins/cpptools/cppmodelmanager.cpp @@ -678,8 +678,8 @@ void CppModelManager::updateModifiedSourceFiles() CppModelManager *CppModelManager::instance() { - ExtensionSystem::PluginManager *pluginManager = ExtensionSystem::PluginManager::instance(); - return pluginManager->getObject<CppModelManager>(); + // TODO this is pretty stupid. use regular singleton pattern. + return ExtensionSystem::PluginManager::getObject<CppModelManager>(); } @@ -742,14 +742,14 @@ CppModelManager::CppModelManager(QObject *parent) m_completionFallback = new InternalCompletionAssistProvider; m_completionAssistProvider = m_completionFallback; - ExtensionSystem::PluginManager::instance()->addObject(m_completionAssistProvider); + ExtensionSystem::PluginManager::addObject(m_completionAssistProvider); m_highlightingFallback = new CppHighlightingSupportInternalFactory; m_highlightingFactory = m_highlightingFallback; } CppModelManager::~CppModelManager() { - ExtensionSystem::PluginManager::instance()->removeObject(m_completionAssistProvider); + ExtensionSystem::PluginManager::removeObject(m_completionAssistProvider); delete m_completionFallback; delete m_highlightingFallback; } @@ -1383,12 +1383,12 @@ CppCompletionSupport *CppModelManager::completionSupport(Core::IEditor *editor) void CppModelManager::setCppCompletionAssistProvider(CppCompletionAssistProvider *completionAssistProvider) { - ExtensionSystem::PluginManager::instance()->removeObject(m_completionAssistProvider); + ExtensionSystem::PluginManager::removeObject(m_completionAssistProvider); if (completionAssistProvider) m_completionAssistProvider = completionAssistProvider; else m_completionAssistProvider = m_completionFallback; - ExtensionSystem::PluginManager::instance()->addObject(m_completionAssistProvider); + ExtensionSystem::PluginManager::addObject(m_completionAssistProvider); } CppHighlightingSupport *CppModelManager::highlightingSupport(Core::IEditor *editor) const diff --git a/src/plugins/cpptools/cpptoolssettings.cpp b/src/plugins/cpptools/cpptoolssettings.cpp index 2d1b333c19..d7e57e1c91 100644 --- a/src/plugins/cpptools/cpptoolssettings.cpp +++ b/src/plugins/cpptools/cpptoolssettings.cpp @@ -84,7 +84,7 @@ CppToolsSettings::CppToolsSettings(QObject *parent) qRegisterMetaType<CppTools::CppCodeStyleSettings>("CppTools::CppCodeStyleSettings"); d->m_completionSettingsPage = new CompletionSettingsPage(this); - ExtensionSystem::PluginManager::instance()->addObject(d->m_completionSettingsPage); + ExtensionSystem::PluginManager::addObject(d->m_completionSettingsPage); connect(d->m_completionSettingsPage, SIGNAL(commentsSettingsChanged(CppTools::CommentsSettings)), @@ -243,7 +243,7 @@ CppToolsSettings::CppToolsSettings(QObject *parent) CppToolsSettings::~CppToolsSettings() { - ExtensionSystem::PluginManager::instance()->removeObject(d->m_completionSettingsPage); + ExtensionSystem::PluginManager::removeObject(d->m_completionSettingsPage); delete d; diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index d6600b6bff..01846f3bf7 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -1670,9 +1670,7 @@ void DebuggerPluginPrivate::attachToRemoteServer() void DebuggerPluginPrivate::startRemoteServer() { - PluginManager *pm = PluginManager::instance(); - QTC_ASSERT(pm, return); - QObject *rl = pm->getObjectByName(_("RemoteLinuxPlugin")); + QObject *rl = PluginManager::getObjectByName(_("RemoteLinuxPlugin")); QTC_ASSERT(rl, return); QMetaObject::invokeMethod(rl, "startGdbServer", Qt::QueuedConnection); // Will call back gdbServerStarted() below. @@ -1714,9 +1712,7 @@ void DebuggerPluginPrivate::loadRemoteCoreFile() void DebuggerPluginPrivate::attachToRemoteProcess() { - PluginManager *pm = PluginManager::instance(); - QTC_ASSERT(pm, return); - QObject *rl = pm->getObjectByName(_("RemoteLinuxPlugin")); + QObject *rl = PluginManager::getObjectByName(_("RemoteLinuxPlugin")); QTC_ASSERT(rl, return); QMetaObject::invokeMethod(rl, "attachToRemoteProcess", Qt::QueuedConnection); // This will call back attachedToProcess() below. diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index de32f086bf..6e22ed6f66 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -270,7 +270,7 @@ GdbEngine::GdbEngine(const DebuggerStartParameters &startParameters, invalidateSourcesList(); m_debugInfoTaskHandler = new DebugInfoTaskHandler(this); - ExtensionSystem::PluginManager::instance()->addObject(m_debugInfoTaskHandler); + ExtensionSystem::PluginManager::addObject(m_debugInfoTaskHandler); m_commandTimer.setSingleShot(true); connect(&m_commandTimer, SIGNAL(timeout()), SLOT(commandTimeout())); @@ -287,7 +287,7 @@ GdbEngine::GdbEngine(const DebuggerStartParameters &startParameters, GdbEngine::~GdbEngine() { - ExtensionSystem::PluginManager::instance()->removeObject(m_debugInfoTaskHandler); + ExtensionSystem::PluginManager::removeObject(m_debugInfoTaskHandler); delete m_debugInfoTaskHandler; m_debugInfoTaskHandler = 0; diff --git a/src/plugins/debugger/memoryagent.cpp b/src/plugins/debugger/memoryagent.cpp index 279cf02c43..50b4ebed70 100644 --- a/src/plugins/debugger/memoryagent.cpp +++ b/src/plugins/debugger/memoryagent.cpp @@ -172,7 +172,7 @@ bool MemoryAgent::doCreateBinEditor(quint64 addr, unsigned flags, if (flags & DebuggerEngine::MemoryView) { // Ask BIN editor plugin for factory service and have it create a bin editor widget. QWidget *binEditor = 0; - if (QObject *factory = ExtensionSystem::PluginManager::instance()->getObjectByClassName(QLatin1String("BINEditor::BinEditorWidgetFactory"))) + if (QObject *factory = ExtensionSystem::PluginManager::getObjectByClassName(QLatin1String("BINEditor::BinEditorWidgetFactory"))) binEditor = ExtensionSystem::invoke<QWidget *>(factory, "createWidget", (QWidget *)0); if (!binEditor) return false; diff --git a/src/plugins/debugger/qml/qmlengine.cpp b/src/plugins/debugger/qml/qmlengine.cpp index 7114d06b1a..76b8ebc4cd 100644 --- a/src/plugins/debugger/qml/qmlengine.cpp +++ b/src/plugins/debugger/qml/qmlengine.cpp @@ -279,9 +279,7 @@ QmlEngine::QmlEngine(const DebuggerStartParameters &startParameters, { setObjectName(QLatin1String("QmlEngine")); - ExtensionSystem::PluginManager *pluginManager = - ExtensionSystem::PluginManager::instance(); - pluginManager->addObject(this); + ExtensionSystem::PluginManager::addObject(this); connect(&m_adapter, SIGNAL(connectionError(QAbstractSocket::SocketError)), SLOT(connectionError(QAbstractSocket::SocketError))); @@ -353,11 +351,8 @@ QmlEngine::QmlEngine(const DebuggerStartParameters &startParameters, QmlEngine::~QmlEngine() { - ExtensionSystem::PluginManager *pluginManager = - ExtensionSystem::PluginManager::instance(); - - if (pluginManager->allObjects().contains(this)) { - pluginManager->removeObject(this); + if (ExtensionSystem::PluginManager::allObjects().contains(this)) { + ExtensionSystem::PluginManager::removeObject(this); } QList<Core::IEditor *> editorsToClose; diff --git a/src/plugins/find/findplugin.cpp b/src/plugins/find/findplugin.cpp index f3b65e737c..f2cd8db601 100644 --- a/src/plugins/find/findplugin.cpp +++ b/src/plugins/find/findplugin.cpp @@ -223,7 +223,7 @@ void FindPlugin::setupMenu() void FindPlugin::setupFilterMenuItems() { QList<IFindFilter*> findInterfaces = - ExtensionSystem::PluginManager::instance()->getObjects<IFindFilter>(); + ExtensionSystem::PluginManager::getObjects<IFindFilter>(); Core::Command *cmd; Core::Context globalcontext(Core::Constants::C_GLOBAL); diff --git a/src/plugins/find/findtoolbar.cpp b/src/plugins/find/findtoolbar.cpp index ec5bd6de08..1fc9ffc725 100644 --- a/src/plugins/find/findtoolbar.cpp +++ b/src/plugins/find/findtoolbar.cpp @@ -606,8 +606,7 @@ void FindToolBar::hideAndResetFocus() Core::FindToolBarPlaceHolder *FindToolBar::findToolBarPlaceHolder() const { - QList<Core::FindToolBarPlaceHolder*> placeholders = ExtensionSystem::PluginManager::instance() - ->getObjects<Core::FindToolBarPlaceHolder>(); + QList<Core::FindToolBarPlaceHolder*> placeholders = ExtensionSystem::PluginManager::getObjects<Core::FindToolBarPlaceHolder>(); QWidget *candidate = QApplication::focusWidget(); while (candidate) { foreach (Core::FindToolBarPlaceHolder *ph, placeholders) { diff --git a/src/plugins/genericprojectmanager/genericproject.cpp b/src/plugins/genericprojectmanager/genericproject.cpp index b037dfa0c8..c63ab87f00 100644 --- a/src/plugins/genericprojectmanager/genericproject.cpp +++ b/src/plugins/genericprojectmanager/genericproject.cpp @@ -483,7 +483,7 @@ bool GenericProject::fromMap(const QVariantMap &map) // Add default setup: if (targets().isEmpty()) { GenericTargetFactory *factory = - ExtensionSystem::PluginManager::instance()->getObject<GenericTargetFactory>(); + ExtensionSystem::PluginManager::getObject<GenericTargetFactory>(); addTarget(factory->create(this, Core::Id(GENERIC_DESKTOP_TARGET_ID))); } diff --git a/src/plugins/locator/locatormanager.cpp b/src/plugins/locator/locatormanager.cpp index 259346904a..e31bc4b0c5 100644 --- a/src/plugins/locator/locatormanager.cpp +++ b/src/plugins/locator/locatormanager.cpp @@ -50,7 +50,7 @@ LocatorManager::LocatorManager(LocatorWidget *locatorWidget) LocatorManager::~LocatorManager() { - ExtensionSystem::PluginManager::instance()->removeObject(this); + ExtensionSystem::PluginManager::removeObject(this); m_instance = 0; } diff --git a/src/plugins/locator/locatorplugin.cpp b/src/plugins/locator/locatorplugin.cpp index e71353575f..6db1a2697a 100644 --- a/src/plugins/locator/locatorplugin.cpp +++ b/src/plugins/locator/locatorplugin.cpp @@ -162,7 +162,7 @@ void LocatorPlugin::openLocator() void LocatorPlugin::extensionsInitialized() { - m_filters = ExtensionSystem::PluginManager::instance()->getObjects<ILocatorFilter>(); + m_filters = ExtensionSystem::PluginManager::getObjects<ILocatorFilter>(); qSort(m_filters.begin(), m_filters.end(), filterLessThan); setFilters(m_filters); } diff --git a/src/plugins/projectexplorer/appoutputpane.cpp b/src/plugins/projectexplorer/appoutputpane.cpp index 5ac9a7a3f4..e61419fedf 100644 --- a/src/plugins/projectexplorer/appoutputpane.cpp +++ b/src/plugins/projectexplorer/appoutputpane.cpp @@ -68,7 +68,7 @@ using namespace ProjectExplorer::Internal; static QObject *debuggerCore() { - return ExtensionSystem::PluginManager::instance()->getObjectByName(QLatin1String("DebuggerCore")); + return ExtensionSystem::PluginManager::getObjectByName(QLatin1String("DebuggerCore")); } static QString msgAttachDebuggerTooltip(const QString &handleDescription = QString()) diff --git a/src/plugins/projectexplorer/buildmanager.cpp b/src/plugins/projectexplorer/buildmanager.cpp index deeb208f74..16aebe5b3c 100644 --- a/src/plugins/projectexplorer/buildmanager.cpp +++ b/src/plugins/projectexplorer/buildmanager.cpp @@ -119,7 +119,6 @@ BuildManagerPrivate::BuildManagerPrivate() : BuildManager::BuildManager(ProjectExplorerPlugin *parent, QAction *cancelBuildAction) : QObject(parent), d(new BuildManagerPrivate) { - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); d->m_projectExplorerPlugin = parent; connect(&d->m_watcher, SIGNAL(finished()), @@ -136,11 +135,11 @@ BuildManager::BuildManager(ProjectExplorerPlugin *parent, QAction *cancelBuildAc this, SLOT(aboutToRemoveProject(ProjectExplorer::Project*))); d->m_outputWindow = new Internal::CompileOutputWindow(this, cancelBuildAction); - pm->addObject(d->m_outputWindow); + ExtensionSystem::PluginManager::addObject(d->m_outputWindow); d->m_taskHub = ProjectExplorerPlugin::instance()->taskHub(); d->m_taskWindow = new Internal::TaskWindow(d->m_taskHub); - pm->addObject(d->m_taskWindow); + ExtensionSystem::PluginManager::addObject(d->m_taskWindow); qRegisterMetaType<ProjectExplorer::BuildStep::OutputFormat>(); qRegisterMetaType<ProjectExplorer::BuildStep::OutputNewlineSetting>(); @@ -168,12 +167,10 @@ void BuildManager::extensionsInitialized() BuildManager::~BuildManager() { cancel(); - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - - pm->removeObject(d->m_taskWindow); + ExtensionSystem::PluginManager::removeObject(d->m_taskWindow); delete d->m_taskWindow; - pm->removeObject(d->m_outputWindow); + ExtensionSystem::PluginManager::removeObject(d->m_outputWindow); delete d->m_outputWindow; delete d; diff --git a/src/plugins/projectexplorer/buildsteplist.cpp b/src/plugins/projectexplorer/buildsteplist.cpp index 10f096b823..2349035d70 100644 --- a/src/plugins/projectexplorer/buildsteplist.cpp +++ b/src/plugins/projectexplorer/buildsteplist.cpp @@ -47,7 +47,7 @@ namespace { IBuildStepFactory *findCloneFactory(BuildStepList *parent, BuildStep *source) { - QList<IBuildStepFactory *> factories = ExtensionSystem::PluginManager::instance()->getObjects<IBuildStepFactory>(); + QList<IBuildStepFactory *> factories = ExtensionSystem::PluginManager::getObjects<IBuildStepFactory>(); foreach(IBuildStepFactory *factory, factories) if (factory->canClone(parent, source)) return factory; @@ -56,7 +56,7 @@ IBuildStepFactory *findCloneFactory(BuildStepList *parent, BuildStep *source) IBuildStepFactory *findRestoreFactory(BuildStepList *parent, const QVariantMap &map) { - QList<IBuildStepFactory *> factories = ExtensionSystem::PluginManager::instance()->getObjects<IBuildStepFactory>(); + QList<IBuildStepFactory *> factories = ExtensionSystem::PluginManager::getObjects<IBuildStepFactory>(); foreach(IBuildStepFactory *factory, factories) if (factory->canRestore(parent, map)) return factory; diff --git a/src/plugins/projectexplorer/buildstepspage.cpp b/src/plugins/projectexplorer/buildstepspage.cpp index 9e4e197893..5c292429d9 100644 --- a/src/plugins/projectexplorer/buildstepspage.cpp +++ b/src/plugins/projectexplorer/buildstepspage.cpp @@ -341,7 +341,7 @@ void BuildStepListWidget::updateAddBuildStepMenu() { QMap<QString, QPair<Core::Id, IBuildStepFactory *> > map; //Build up a list of possible steps and save map the display names to the (internal) name and factories. - QList<IBuildStepFactory *> factories = ExtensionSystem::PluginManager::instance()->getObjects<IBuildStepFactory>(); + QList<IBuildStepFactory *> factories = ExtensionSystem::PluginManager::getObjects<IBuildStepFactory>(); foreach (IBuildStepFactory *factory, factories) { QList<Core::Id> ids = factory->availableCreationIds(m_buildStepList); foreach (Core::Id id, ids) diff --git a/src/plugins/projectexplorer/compileoutputwindow.cpp b/src/plugins/projectexplorer/compileoutputwindow.cpp index 8c8d58f3a4..df950b298d 100644 --- a/src/plugins/projectexplorer/compileoutputwindow.cpp +++ b/src/plugins/projectexplorer/compileoutputwindow.cpp @@ -97,8 +97,7 @@ protected: { int line = cursorForPosition(ev->pos()).block().blockNumber(); if (unsigned taskid = m_taskids.value(line, 0)) { - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - TaskHub *hub = pm->getObject<TaskHub>(); + TaskHub *hub = ExtensionSystem::PluginManager::getObject<TaskHub>(); hub->showTaskInEditor(taskid); } else { QPlainTextEdit::mouseDoubleClickEvent(ev); @@ -132,7 +131,7 @@ CompileOutputWindow::CompileOutputWindow(BuildManager * /*bm*/, QAction *cancelB qRegisterMetaType<QTextCharFormat>("QTextCharFormat"); m_handler = new ShowOutputTaskHandler(this); - ExtensionSystem::PluginManager::instance()->addObject(m_handler); + ExtensionSystem::PluginManager::addObject(m_handler); connect(ProjectExplorerPlugin::instance(), SIGNAL(settingsChanged()), this, SLOT(updateWordWrapMode())); updateWordWrapMode(); @@ -140,7 +139,7 @@ CompileOutputWindow::CompileOutputWindow(BuildManager * /*bm*/, QAction *cancelB CompileOutputWindow::~CompileOutputWindow() { - ExtensionSystem::PluginManager::instance()->removeObject(m_handler); + ExtensionSystem::PluginManager::removeObject(m_handler); delete m_handler; delete m_cancelBuildButton; } diff --git a/src/plugins/projectexplorer/devicesupport/devicefactoryselectiondialog.cpp b/src/plugins/projectexplorer/devicesupport/devicefactoryselectiondialog.cpp index 26a03d8e31..94a3220c19 100644 --- a/src/plugins/projectexplorer/devicesupport/devicefactoryselectiondialog.cpp +++ b/src/plugins/projectexplorer/devicesupport/devicefactoryselectiondialog.cpp @@ -50,7 +50,7 @@ DeviceFactorySelectionDialog::DeviceFactorySelectionDialog(QWidget *parent) : ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Start Wizard")); const QList<IDeviceFactory *> &factories - = ExtensionSystem::PluginManager::instance()->getObjects<IDeviceFactory>(); + = ExtensionSystem::PluginManager::getObjects<IDeviceFactory>(); foreach (const IDeviceFactory * const factory, factories) { if (!factory->canCreate()) continue; diff --git a/src/plugins/projectexplorer/devicesupport/devicemanager.cpp b/src/plugins/projectexplorer/devicesupport/devicemanager.cpp index 4f0bfac541..6a2086f6ab 100644 --- a/src/plugins/projectexplorer/devicesupport/devicemanager.cpp +++ b/src/plugins/projectexplorer/devicesupport/devicemanager.cpp @@ -222,8 +222,7 @@ QVariantMap DeviceManager::toMap() const QString DeviceManager::settingsFilePath() { - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - return QFileInfo(pm->settings()->fileName()).absolutePath() + QLatin1String("/devices.xml"); + return QFileInfo(ExtensionSystem::PluginManager::settings()->fileName()).absolutePath() + QLatin1String("/devices.xml"); } void DeviceManager::addDevice(const IDevice::Ptr &_device) @@ -320,7 +319,7 @@ void DeviceManager::setDefaultDevice(int idx) const IDeviceFactory *DeviceManager::restoreFactory(const QVariantMap &map) { const QList<IDeviceFactory *> &factories - = ExtensionSystem::PluginManager::instance()->getObjects<IDeviceFactory>(); + = ExtensionSystem::PluginManager::getObjects<IDeviceFactory>(); foreach (const IDeviceFactory * const factory, factories) { if (factory->canRestore(map)) return factory; diff --git a/src/plugins/projectexplorer/devicesupport/devicesettingswidget.cpp b/src/plugins/projectexplorer/devicesupport/devicesettingswidget.cpp index f4c4564d7d..4df175bacc 100644 --- a/src/plugins/projectexplorer/devicesupport/devicesettingswidget.cpp +++ b/src/plugins/projectexplorer/devicesupport/devicesettingswidget.cpp @@ -141,7 +141,7 @@ void DeviceSettingsWidget::initGui() bool hasDeviceFactories = false; const QList<IDeviceFactory *> &factories - = ExtensionSystem::PluginManager::instance()->getObjects<IDeviceFactory>(); + = ExtensionSystem::PluginManager::getObjects<IDeviceFactory>(); foreach (const IDeviceFactory *f, factories) { if (f->canCreate()) { hasDeviceFactories = true; diff --git a/src/plugins/projectexplorer/devicesupport/idevicefactory.cpp b/src/plugins/projectexplorer/devicesupport/idevicefactory.cpp index 6cd07b4dbc..9f837ef76b 100644 --- a/src/plugins/projectexplorer/devicesupport/idevicefactory.cpp +++ b/src/plugins/projectexplorer/devicesupport/idevicefactory.cpp @@ -44,7 +44,7 @@ bool IDeviceFactory::canCreate() const IDeviceFactory *IDeviceFactory::find(Core::Id type) { QList<IDeviceFactory *> factories - = ExtensionSystem::PluginManager::instance()->getObjects<IDeviceFactory>(); + = ExtensionSystem::PluginManager::getObjects<IDeviceFactory>(); foreach (IDeviceFactory *factory, factories) { if (factory->availableCreationIds().contains(type)) return factory; diff --git a/src/plugins/projectexplorer/foldernavigationwidget.cpp b/src/plugins/projectexplorer/foldernavigationwidget.cpp index 6d8dce069e..4bb5d6d48f 100644 --- a/src/plugins/projectexplorer/foldernavigationwidget.cpp +++ b/src/plugins/projectexplorer/foldernavigationwidget.cpp @@ -373,7 +373,7 @@ void FolderNavigationWidget::findOnFileSystem(const QString &pathIn) const QFileInfo fileInfo(pathIn); const QString folder = fileInfo.isDir() ? fileInfo.absoluteFilePath() : fileInfo.absolutePath(); - TextEditor::FindInFiles *fif = ExtensionSystem::PluginManager::instance()->getObject<TextEditor::FindInFiles>(); + TextEditor::FindInFiles *fif = ExtensionSystem::PluginManager::getObject<TextEditor::FindInFiles>(); if (!fif) return; Find::FindPlugin *plugin = Find::FindPlugin::instance(); diff --git a/src/plugins/projectexplorer/pluginfilefactory.cpp b/src/plugins/projectexplorer/pluginfilefactory.cpp index 74ab068811..ed72de44a8 100644 --- a/src/plugins/projectexplorer/pluginfilefactory.cpp +++ b/src/plugins/projectexplorer/pluginfilefactory.cpp @@ -87,7 +87,7 @@ QList<ProjectFileFactory *> ProjectFileFactory::createFactories(QString *filterS // Register factories for all project managers QList<Internal::ProjectFileFactory*> rc; QList<IProjectManager*> projectManagers = - ExtensionSystem::PluginManager::instance()->getObjects<IProjectManager>(); + ExtensionSystem::PluginManager::getObjects<IProjectManager>(); QList<Core::MimeGlobPattern> allGlobPatterns; diff --git a/src/plugins/projectexplorer/project.cpp b/src/plugins/projectexplorer/project.cpp index f393ef1055..2f7641ec83 100644 --- a/src/plugins/projectexplorer/project.cpp +++ b/src/plugins/projectexplorer/project.cpp @@ -315,7 +315,7 @@ bool Project::fromMap(const QVariantMap &map) QVariantMap targetMap = map.value(key).toMap(); QList<ITargetFactory *> factories = - ExtensionSystem::PluginManager::instance()->getObjects<ITargetFactory>(); + ExtensionSystem::PluginManager::getObjects<ITargetFactory>(); Target *t = 0; diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index af6c02ab74..8d9ed394b4 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -1298,8 +1298,7 @@ Project *ProjectExplorerPlugin::openProject(const QString &fileName, QString *er static inline QList<IProjectManager*> allProjectManagers() { - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - return pm->getObjects<IProjectManager>(); + return ExtensionSystem::PluginManager::getObjects<IProjectManager>(); } QList<Project *> ProjectExplorerPlugin::openProjects(const QStringList &fileNames, QString *errorString) @@ -1427,7 +1426,7 @@ void ProjectExplorerPlugin::determineSessionToRestoreAtStartup() // Process command line arguments first: if (pluginSpec()->arguments().contains(QLatin1String("-lastsession"))) d->m_sessionToRestoreAtStartup = d->m_session->lastSession(); - QStringList arguments = ExtensionSystem::PluginManager::instance()->arguments(); + QStringList arguments = ExtensionSystem::PluginManager::arguments(); if (d->m_sessionToRestoreAtStartup.isNull()) { QStringList sessions = d->m_session->sessions(); // We have command line arguments, try to find a session in them @@ -1463,7 +1462,7 @@ void ProjectExplorerPlugin::restoreSession() qDebug() << "ProjectExplorerPlugin::restoreSession"; // We have command line arguments, try to find a session in them - QStringList arguments = ExtensionSystem::PluginManager::instance()->arguments(); + QStringList arguments = ExtensionSystem::PluginManager::arguments(); arguments.removeOne(d->m_sessionToRestoreAtStartup); // Restore latest session or what was passed on the command line @@ -2233,8 +2232,7 @@ void ProjectExplorerPlugin::activeRunConfigurationChanged() // NBS TODO implement more than one runner IRunControlFactory *ProjectExplorerPlugin::findRunControlFactory(RunConfiguration *config, RunMode mode) { - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - const QList<IRunControlFactory *> factories = pm->getObjects<IRunControlFactory>(); + const QList<IRunControlFactory *> factories = ExtensionSystem::PluginManager::getObjects<IRunControlFactory>(); foreach (IRunControlFactory *f, factories) if (f->canRun(config, mode)) return f; diff --git a/src/plugins/projectexplorer/projectfilewizardextension.cpp b/src/plugins/projectexplorer/projectfilewizardextension.cpp index 2907d916ec..7100db0a1a 100644 --- a/src/plugins/projectexplorer/projectfilewizardextension.cpp +++ b/src/plugins/projectexplorer/projectfilewizardextension.cpp @@ -324,7 +324,7 @@ void ProjectFileWizardExtension::firstExtensionPageShown( // Store all version controls for later use: if (m_context->versionControls.isEmpty()) { - foreach (Core::IVersionControl *vc, ExtensionSystem::PluginManager::instance()->getObjects<Core::IVersionControl>()) { + foreach (Core::IVersionControl *vc, ExtensionSystem::PluginManager::getObjects<Core::IVersionControl>()) { m_context->versionControls.append(vc); connect(vc, SIGNAL(configurationChanged()), this, SLOT(initializeVersionControlChoices())); } diff --git a/src/plugins/projectexplorer/projectwindow.cpp b/src/plugins/projectexplorer/projectwindow.cpp index 3c5c4ab167..9707b49e13 100644 --- a/src/plugins/projectexplorer/projectwindow.cpp +++ b/src/plugins/projectexplorer/projectwindow.cpp @@ -262,11 +262,11 @@ ProjectWindow::~ProjectWindow() void ProjectWindow::extensionsInitialized() { - foreach (ITargetFactory *fac, ExtensionSystem::PluginManager::instance()->getObjects<ITargetFactory>()) + foreach (ITargetFactory *fac, ExtensionSystem::PluginManager::getObjects<ITargetFactory>()) connect(fac, SIGNAL(canCreateTargetIdsChanged()), this, SLOT(targetFactoriesChanged())); - QList<IProjectPanelFactory *> list = ExtensionSystem::PluginManager::instance()->getObjects<IProjectPanelFactory>(); + QList<IProjectPanelFactory *> list = ExtensionSystem::PluginManager::getObjects<IProjectPanelFactory>(); qSort(list.begin(), list.end(), &IPanelFactory::prioritySort); } @@ -309,7 +309,7 @@ bool ProjectWindow::useTargetPage(ProjectExplorer::Project *project) if (project->targets().size() > 1) return true; int count = 0; - foreach (ITargetFactory *fac, ExtensionSystem::PluginManager::instance()->getObjects<ITargetFactory>()) { + foreach (ITargetFactory *fac, ExtensionSystem::PluginManager::getObjects<ITargetFactory>()) { foreach (Core::Id targetId, fac->supportedTargetIds()) { if (fac->canCreate(project, targetId)) ++count; @@ -344,7 +344,7 @@ void ProjectWindow::registerProject(ProjectExplorer::Project *project) // Show the target specific pages directly if (project->activeTarget()) { QList<ITargetPanelFactory *> factories = - ExtensionSystem::PluginManager::instance()->getObjects<ITargetPanelFactory>(); + ExtensionSystem::PluginManager::getObjects<ITargetPanelFactory>(); qSort(factories.begin(), factories.end(), &IPanelFactory::prioritySort); @@ -358,7 +358,7 @@ void ProjectWindow::registerProject(ProjectExplorer::Project *project) } // Add the project specific pages - QList<IProjectPanelFactory *> factories = ExtensionSystem::PluginManager::instance()->getObjects<IProjectPanelFactory>(); + QList<IProjectPanelFactory *> factories = ExtensionSystem::PluginManager::getObjects<IProjectPanelFactory>(); qSort(factories.begin(), factories.end(), &IPanelFactory::prioritySort); foreach (IProjectPanelFactory *panelFactory, factories) { if (panelFactory->supports(project)) @@ -418,7 +418,7 @@ void ProjectWindow::showProperties(int index, int subIndex) ++pos; } else if (project->activeTarget()) { // No Targets page, target specific pages are first in the list - QList<ITargetPanelFactory *> factories = ExtensionSystem::PluginManager::instance()->getObjects<ITargetPanelFactory>(); + QList<ITargetPanelFactory *> factories = ExtensionSystem::PluginManager::getObjects<ITargetPanelFactory>(); qSort(factories.begin(), factories.end(), &ITargetPanelFactory::prioritySort); foreach (ITargetPanelFactory *panelFactory, factories) { if (panelFactory->supports(project->activeTarget())) { @@ -432,7 +432,7 @@ void ProjectWindow::showProperties(int index, int subIndex) } if (!fac) { - QList<IProjectPanelFactory *> factories = ExtensionSystem::PluginManager::instance()->getObjects<IProjectPanelFactory>(); + QList<IProjectPanelFactory *> factories = ExtensionSystem::PluginManager::getObjects<IProjectPanelFactory>(); qSort(factories.begin(), factories.end(), &IPanelFactory::prioritySort); foreach (IProjectPanelFactory *panelFactory, factories) { if (panelFactory->supports(project)) { diff --git a/src/plugins/projectexplorer/publishing/publishingwizardselectiondialog.cpp b/src/plugins/projectexplorer/publishing/publishingwizardselectiondialog.cpp index 2e2b4d010b..a26f9cdff6 100644 --- a/src/plugins/projectexplorer/publishing/publishingwizardselectiondialog.cpp +++ b/src/plugins/projectexplorer/publishing/publishingwizardselectiondialog.cpp @@ -52,7 +52,7 @@ PublishingWizardSelectionDialog::PublishingWizardSelectionDialog(const Project * ui->setupUi(this); ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Start Wizard")); const QList<IPublishingWizardFactory *> &factories - = ExtensionSystem::PluginManager::instance()->getObjects<IPublishingWizardFactory>(); + = ExtensionSystem::PluginManager::getObjects<IPublishingWizardFactory>(); foreach (const IPublishingWizardFactory * const factory, factories) { if (factory->canCreateWizard(project)) { m_factories << factory; diff --git a/src/plugins/projectexplorer/runconfiguration.cpp b/src/plugins/projectexplorer/runconfiguration.cpp index 7aa69f2fbb..d445dcb1ec 100644 --- a/src/plugins/projectexplorer/runconfiguration.cpp +++ b/src/plugins/projectexplorer/runconfiguration.cpp @@ -143,8 +143,7 @@ private: IRunConfigurationFactory *findRunConfigurationFactory(RunConfigurationFactoryMatcher &matcher) { QList<IRunConfigurationFactory *> factories - = ExtensionSystem::PluginManager::instance()-> - getObjects<IRunConfigurationFactory>(); + = ExtensionSystem::PluginManager::getObjects<IRunConfigurationFactory>(); foreach (IRunConfigurationFactory *factory, factories) { if (matcher(factory)) return factory; @@ -386,8 +385,7 @@ RunConfiguration::~RunConfiguration() void RunConfiguration::addExtraAspects() { - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - foreach (IRunControlFactory *factory, pm->getObjects<IRunControlFactory>()) + foreach (IRunControlFactory *factory, ExtensionSystem::PluginManager::getObjects<IRunControlFactory>()) if (IRunConfigurationAspect *aspect = factory->createRunConfigurationAspect()) m_aspects.append(aspect); } diff --git a/src/plugins/projectexplorer/runsettingspropertiespage.cpp b/src/plugins/projectexplorer/runsettingspropertiespage.cpp index c771b8fe7b..d0497bfcbf 100644 --- a/src/plugins/projectexplorer/runsettingspropertiespage.cpp +++ b/src/plugins/projectexplorer/runsettingspropertiespage.cpp @@ -266,7 +266,7 @@ void RunSettingsWidget::aboutToShowAddMenu() { m_addRunMenu->clear(); QList<IRunConfigurationFactory *> factories = - ExtensionSystem::PluginManager::instance()->getObjects<IRunConfigurationFactory>(); + ExtensionSystem::PluginManager::getObjects<IRunConfigurationFactory>(); foreach (IRunConfigurationFactory *factory, factories) { QList<Core::Id> ids = factory->availableCreationIds(m_target); foreach (Core::Id id, ids) { @@ -518,8 +518,7 @@ QString RunSettingsWidget::uniqueRCName(const QString &name) void RunSettingsWidget::addRunControlWidgets() { - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - foreach (IRunControlFactory *f, pm->getObjects<IRunControlFactory>()) { + foreach (IRunControlFactory *f, ExtensionSystem::PluginManager::getObjects<IRunControlFactory>()) { ProjectExplorer::RunConfigWidget *rcw = f->createConfigurationWidget(m_target->activeRunConfiguration()); if (rcw) diff --git a/src/plugins/projectexplorer/target.cpp b/src/plugins/projectexplorer/target.cpp index 9daab143ce..a3a86af7a1 100644 --- a/src/plugins/projectexplorer/target.cpp +++ b/src/plugins/projectexplorer/target.cpp @@ -109,7 +109,7 @@ TargetPrivate::TargetPrivate() : QList<DeployConfigurationFactory *> TargetPrivate::deployFactories() const { - return ExtensionSystem::PluginManager::instance()->getObjects<DeployConfigurationFactory>(); + return ExtensionSystem::PluginManager::getObjects<DeployConfigurationFactory>(); } diff --git a/src/plugins/projectexplorer/targetsettingspanel.cpp b/src/plugins/projectexplorer/targetsettingspanel.cpp index 202489e776..a94c34fde4 100644 --- a/src/plugins/projectexplorer/targetsettingspanel.cpp +++ b/src/plugins/projectexplorer/targetsettingspanel.cpp @@ -85,7 +85,7 @@ TargetSettingsPanelWidget::TargetSettingsPanelWidget(Project *project) : this, SLOT(activeTargetChanged(ProjectExplorer::Target*))); QList<ITargetFactory *> factories = - ExtensionSystem::PluginManager::instance()->getObjects<ITargetFactory>(); + ExtensionSystem::PluginManager::getObjects<ITargetFactory>(); foreach (ITargetFactory *fac, factories) { connect(fac, SIGNAL(canCreateTargetIdsChanged()), @@ -185,7 +185,7 @@ void TargetSettingsPanelWidget::currentTargetChanged(int targetIndex, int subInd PanelsWidget *buildPanel = new PanelsWidget(m_centralWidget); PanelsWidget *runPanel = new PanelsWidget(m_centralWidget); - foreach (ITargetPanelFactory *panelFactory, ExtensionSystem::PluginManager::instance()->getObjects<ITargetPanelFactory>()) { + foreach (ITargetPanelFactory *panelFactory, ExtensionSystem::PluginManager::getObjects<ITargetPanelFactory>()) { if (panelFactory->id() == QLatin1String(BUILDSETTINGS_PANEL_ID)) { PropertiesPanel *panel = panelFactory->createPanel(target); buildPanel->addPropertiesPanel(panel); @@ -216,7 +216,7 @@ void TargetSettingsPanelWidget::addTarget(QAction *action) Core::Id id = action->data().value<Core::Id>(); Q_ASSERT(!m_project->target(id)); QList<ITargetFactory *> factories = - ExtensionSystem::PluginManager::instance()->getObjects<ITargetFactory>(); + ExtensionSystem::PluginManager::getObjects<ITargetFactory>(); Target *target = 0; foreach (ITargetFactory *fac, factories) { @@ -313,7 +313,7 @@ void TargetSettingsPanelWidget::updateTargetAddAndRemoveButtons() m_addMenu->clear(); QList<ITargetFactory *> factories = - ExtensionSystem::PluginManager::instance()->getObjects<ITargetFactory>(); + ExtensionSystem::PluginManager::getObjects<ITargetFactory>(); foreach (ITargetFactory *fac, factories) { foreach (Core::Id id, fac->supportedTargetIds()) { diff --git a/src/plugins/projectexplorer/taskwindow.cpp b/src/plugins/projectexplorer/taskwindow.cpp index 1c500b63a0..6312018f4e 100644 --- a/src/plugins/projectexplorer/taskwindow.cpp +++ b/src/plugins/projectexplorer/taskwindow.cpp @@ -425,7 +425,7 @@ void TaskWindow::triggerDefaultHandler(const QModelIndex &index) // Find a default handler to use: if (!d->m_defaultHandler) { - QList<ITaskHandler *> handlers = ExtensionSystem::PluginManager::instance()->getObjects<ITaskHandler>(); + QList<ITaskHandler *> handlers = ExtensionSystem::PluginManager::getObjects<ITaskHandler>(); foreach(ITaskHandler *handler, handlers) { if (handler->isDefaultHandler()) { d->m_defaultHandler = handler; @@ -458,7 +458,7 @@ void TaskWindow::showContextMenu(const QPoint &position) if (task.isNull()) return; - QList<ITaskHandler *> handlers = ExtensionSystem::PluginManager::instance()->getObjects<ITaskHandler>(); + QList<ITaskHandler *> handlers = ExtensionSystem::PluginManager::getObjects<ITaskHandler>(); foreach(ITaskHandler *handler, handlers) { if (handler == d->m_defaultHandler) continue; diff --git a/src/plugins/projectexplorer/toolchainmanager.cpp b/src/plugins/projectexplorer/toolchainmanager.cpp index c89ae570fa..b87a38f8da 100644 --- a/src/plugins/projectexplorer/toolchainmanager.cpp +++ b/src/plugins/projectexplorer/toolchainmanager.cpp @@ -58,8 +58,7 @@ using Utils::PersistentSettingsReader; static QString settingsFileName() { - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - QFileInfo settingsLocation(pm->settings()->fileName()); + QFileInfo settingsLocation(ExtensionSystem::PluginManager::settings()->fileName()); return settingsLocation.absolutePath() + QLatin1String(TOOLCHAIN_FILENAME); } @@ -159,8 +158,7 @@ void ToolChainManager::restoreToolChains() // Then auto detect QList<ToolChain *> detectedTcs; - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - QList<ToolChainFactory *> factories = pm->getObjects<ToolChainFactory>(); + QList<ToolChainFactory *> factories = ExtensionSystem::PluginManager::getObjects<ToolChainFactory>(); foreach (ToolChainFactory *f, factories) detectedTcs.append(f->autoDetect()); @@ -248,8 +246,7 @@ QList<ToolChain *> ToolChainManager::restoreToolChains(const QString &fileName) Utils::FileName::fromString(data.value(pathKey).toString())); } - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - QList<ToolChainFactory *> factories = pm->getObjects<ToolChainFactory>(); + QList<ToolChainFactory *> factories = ExtensionSystem::PluginManager::getObjects<ToolChainFactory>(); count = data.value(QLatin1String(TOOLCHAIN_COUNT_KEY), 0).toInt(); for (int i = 0; i < count; ++i) { diff --git a/src/plugins/projectexplorer/toolchainoptionspage.cpp b/src/plugins/projectexplorer/toolchainoptionspage.cpp index eda1d21c4d..1cdbe5bafa 100644 --- a/src/plugins/projectexplorer/toolchainoptionspage.cpp +++ b/src/plugins/projectexplorer/toolchainoptionspage.cpp @@ -507,7 +507,7 @@ QWidget *ToolChainOptionsPage::createPage(QWidget *parent) this, SLOT(toolChainSelectionChanged())); // Get toolchainfactories: - m_factories = ExtensionSystem::PluginManager::instance()->getObjects<ToolChainFactory>(); + m_factories = ExtensionSystem::PluginManager::getObjects<ToolChainFactory>(); // Set up add menu: QMenu *addMenu = new QMenu(m_ui->addButton); diff --git a/src/plugins/qmldesigner/designmodewidget.cpp b/src/plugins/qmldesigner/designmodewidget.cpp index db756f7941..561b5e89ba 100644 --- a/src/plugins/qmldesigner/designmodewidget.cpp +++ b/src/plugins/qmldesigner/designmodewidget.cpp @@ -661,7 +661,8 @@ void DesignModeWidget::setCurrentDocument(DesignDocumentController *newDesignDoc void DesignModeWidget::setup() { - QList<Core::INavigationWidgetFactory *> factories = ExtensionSystem::PluginManager::instance()->getObjects<Core::INavigationWidgetFactory>(); + QList<Core::INavigationWidgetFactory *> factories = + ExtensionSystem::PluginManager::getObjects<Core::INavigationWidgetFactory>(); QWidget *openDocumentsWidget = 0; QWidget *projectsExplorer = 0; diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp index a3f9bd5542..86a5b9cfcd 100644 --- a/src/plugins/qmljseditor/qmljseditor.cpp +++ b/src/plugins/qmljseditor/qmljseditor.cpp @@ -509,7 +509,7 @@ QmlJSTextEditorWidget::QmlJSTextEditorWidget(QWidget *parent) : baseTextDocument()->setCodec(QTextCodec::codecForName("UTF-8")); // qml files are defined to be utf-8 m_modelManager = QmlJS::ModelManagerInterface::instance(); - m_contextPane = ExtensionSystem::PluginManager::instance()->getObject<QmlJS::IContextPane>(); + m_contextPane = ExtensionSystem::PluginManager::getObject<QmlJS::IContextPane>(); if (m_contextPane) { diff --git a/src/plugins/qmljseditor/qmljsquickfixassist.cpp b/src/plugins/qmljseditor/qmljsquickfixassist.cpp index ae8ac21cc9..bec63430cb 100644 --- a/src/plugins/qmljseditor/qmljsquickfixassist.cpp +++ b/src/plugins/qmljseditor/qmljsquickfixassist.cpp @@ -109,8 +109,7 @@ IAssistProcessor *QmlJSQuickFixAssistProvider::createProcessor() const QList<QuickFixFactory *> QmlJSQuickFixAssistProvider::quickFixFactories() const { QList<TextEditor::QuickFixFactory *> results; - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - foreach (QmlJSQuickFixFactory *f, pm->getObjects<QmlJSEditor::QmlJSQuickFixFactory>()) + foreach (QmlJSQuickFixFactory *f, ExtensionSystem::PluginManager::getObjects<QmlJSEditor::QmlJSQuickFixFactory>()) results.append(f); return results; } diff --git a/src/plugins/qmljstools/qmljscodestylepreferencesfactory.cpp b/src/plugins/qmljstools/qmljscodestylepreferencesfactory.cpp index 5bdd9427ca..2eaa34239e 100644 --- a/src/plugins/qmljstools/qmljscodestylepreferencesfactory.cpp +++ b/src/plugins/qmljstools/qmljscodestylepreferencesfactory.cpp @@ -97,7 +97,7 @@ TextEditor::Indenter *QmlJSCodeStylePreferencesFactory::createIndenter() const TextEditor::ISnippetProvider *QmlJSCodeStylePreferencesFactory::snippetProvider() const { const QList<TextEditor::ISnippetProvider *> &providers = - ExtensionSystem::PluginManager::instance()->getObjects<TextEditor::ISnippetProvider>(); + ExtensionSystem::PluginManager::getObjects<TextEditor::ISnippetProvider>(); foreach (TextEditor::ISnippetProvider *provider, providers) if (provider->groupId() == QLatin1String(QmlJSEditor::Constants::QML_SNIPPETS_GROUP_ID)) return provider; diff --git a/src/plugins/qmljstools/qmljscodestylesettingspage.cpp b/src/plugins/qmljstools/qmljscodestylesettingspage.cpp index e197cc89bf..12779cb023 100644 --- a/src/plugins/qmljstools/qmljscodestylesettingspage.cpp +++ b/src/plugins/qmljstools/qmljscodestylesettingspage.cpp @@ -66,7 +66,7 @@ QmlJSCodeStylePreferencesWidget::QmlJSCodeStylePreferencesWidget(QWidget *parent m_ui->setupUi(this); const QList<ISnippetProvider *> &providers = - ExtensionSystem::PluginManager::instance()->getObjects<ISnippetProvider>(); + ExtensionSystem::PluginManager::getObjects<ISnippetProvider>(); foreach (ISnippetProvider *provider, providers) { if (provider->groupId() == QLatin1String(QmlJSEditor::Constants::QML_SNIPPETS_GROUP_ID)) { provider->decorateEditor(m_ui->previewTextEdit); @@ -115,7 +115,7 @@ void QmlJSCodeStylePreferencesWidget::decorateEditor(const TextEditor::FontSetti { const ISnippetProvider *provider = 0; const QList<ISnippetProvider *> &providers = - ExtensionSystem::PluginManager::instance()->getObjects<ISnippetProvider>(); + ExtensionSystem::PluginManager::getObjects<ISnippetProvider>(); foreach (const ISnippetProvider *current, providers) { if (current->groupId() == QLatin1String(QmlJSEditor::Constants::QML_SNIPPETS_GROUP_ID)) { provider = current; diff --git a/src/plugins/qmlprofiler/remotelinuxqmlprofilerrunner.cpp b/src/plugins/qmlprofiler/remotelinuxqmlprofilerrunner.cpp index 7930cf3333..1a3e4e7bca 100644 --- a/src/plugins/qmlprofiler/remotelinuxqmlprofilerrunner.cpp +++ b/src/plugins/qmlprofiler/remotelinuxqmlprofilerrunner.cpp @@ -51,7 +51,7 @@ RemoteLinuxQmlProfilerRunner::RemoteLinuxQmlProfilerRunner( // find run control factory IRunControlFactory *runControlFactory = 0; QList<IRunControlFactory*> runControlFactories - = PluginManager::instance()->getObjects<IRunControlFactory>(); + = PluginManager::getObjects<IRunControlFactory>(); foreach (IRunControlFactory *factory, runControlFactories) { if (factory->canRun(runConfiguration, NormalRunMode)) { diff --git a/src/plugins/qmlprojectmanager/qmlproject.cpp b/src/plugins/qmlprojectmanager/qmlproject.cpp index 285950a058..1e43c76a04 100644 --- a/src/plugins/qmlprojectmanager/qmlproject.cpp +++ b/src/plugins/qmlprojectmanager/qmlproject.cpp @@ -300,7 +300,7 @@ bool QmlProject::fromMap(const QVariantMap &map) if (targets().isEmpty()) { Internal::QmlProjectTargetFactory *factory - = ExtensionSystem::PluginManager::instance()->getObject<Internal::QmlProjectTargetFactory>(); + = ExtensionSystem::PluginManager::getObject<Internal::QmlProjectTargetFactory>(); Internal::QmlProjectTarget *target = factory->create(this, Core::Id(Constants::QML_VIEWER_TARGET_ID)); addTarget(target); } diff --git a/src/plugins/qt4projectmanager/qt-s60/s60manager.cpp b/src/plugins/qt4projectmanager/qt-s60/s60manager.cpp index 8350960c86..35213a401e 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60manager.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/s60manager.cpp @@ -140,9 +140,8 @@ S60Manager::S60Manager(QObject *parent) : QObject(parent) S60Manager::~S60Manager() { - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); for (int i = m_pluginObjects.size() - 1; i >= 0; i--) { - pm->removeObject(m_pluginObjects.at(i)); + ExtensionSystem::PluginManager::removeObject(m_pluginObjects.at(i)); delete m_pluginObjects.at(i); } } @@ -221,7 +220,7 @@ void S60Manager::handleSymbianDeviceStateChange(const SymbianUtils::SymbianDevic void S60Manager::addAutoReleasedObject(QObject *o) { - ExtensionSystem::PluginManager::instance()->addObject(o); + ExtensionSystem::PluginManager::addObject(o); m_pluginObjects.push_back(o); } diff --git a/src/plugins/qt4projectmanager/qt4project.cpp b/src/plugins/qt4projectmanager/qt4project.cpp index 03ce7eec05..44c12bfc93 100644 --- a/src/plugins/qt4projectmanager/qt4project.cpp +++ b/src/plugins/qt4projectmanager/qt4project.cpp @@ -1334,7 +1334,7 @@ bool Qt4Project::needsConfiguration() const void Qt4Project::configureAsExampleProject(const QStringList &platforms) { - QList<Qt4BaseTargetFactory *> factories = ExtensionSystem::PluginManager::instance()->getObjects<Qt4BaseTargetFactory>(); + QList<Qt4BaseTargetFactory *> factories = ExtensionSystem::PluginManager::getObjects<Qt4BaseTargetFactory>(); foreach (Qt4BaseTargetFactory *factory, factories) { foreach (const Core::Id id, factory->supportedTargetIds()) { QList<BuildConfigurationInfo> infos diff --git a/src/plugins/qt4projectmanager/qt4target.cpp b/src/plugins/qt4projectmanager/qt4target.cpp index 503fdabac8..879c1bbe9c 100644 --- a/src/plugins/qt4projectmanager/qt4target.cpp +++ b/src/plugins/qt4projectmanager/qt4target.cpp @@ -198,7 +198,7 @@ QString Qt4BaseTargetFactory::buildNameForId(Core::Id id) const Qt4BaseTargetFactory *Qt4BaseTargetFactory::qt4BaseTargetFactoryForId(const Core::Id id) { - QList<Qt4BaseTargetFactory *> factories = ExtensionSystem::PluginManager::instance()->getObjects<Qt4BaseTargetFactory>(); + QList<Qt4BaseTargetFactory *> factories = ExtensionSystem::PluginManager::getObjects<Qt4BaseTargetFactory>(); foreach (Qt4BaseTargetFactory *fac, factories) { if (fac->supportsTargetId(id)) return fac; @@ -1425,7 +1425,7 @@ QList<BuildConfigurationInfo> BuildConfigurationInfo::importBuildConfigurations( // Check for builds in build directory QList<Qt4BaseTargetFactory *> factories = - ExtensionSystem::PluginManager::instance()->getObjects<Qt4BaseTargetFactory>(); + ExtensionSystem::PluginManager::getObjects<Qt4BaseTargetFactory>(); foreach (Qt4BaseTargetFactory *factory, factories) { foreach (const Core::Id id, factory->supportedTargetIds()) { QString expectedBuildprefix = factory->shadowBuildDirectory(proFilePath, id, QString()); diff --git a/src/plugins/qt4projectmanager/unconfiguredsettingsoptionpage.cpp b/src/plugins/qt4projectmanager/unconfiguredsettingsoptionpage.cpp index f80057eaff..d094c839fe 100644 --- a/src/plugins/qt4projectmanager/unconfiguredsettingsoptionpage.cpp +++ b/src/plugins/qt4projectmanager/unconfiguredsettingsoptionpage.cpp @@ -71,7 +71,7 @@ UnConfiguredSettingsWidget::UnConfiguredSettingsWidget(QWidget *parent) m_toolchainComboBox = new QComboBox; layout->addRow(tr("Tool Chain:"), m_toolchainComboBox); - Qt4Manager *qt4Manager = ExtensionSystem::PluginManager::instance()->getObject<Qt4Manager>(); + Qt4Manager *qt4Manager = ExtensionSystem::PluginManager::getObject<Qt4Manager>(); Internal::UnConfiguredSettings ucs = qt4Manager->unconfiguredSettings(); QtSupport::QtVersionManager *vm = QtSupport::QtVersionManager::instance(); @@ -98,7 +98,7 @@ UnConfiguredSettingsWidget::UnConfiguredSettingsWidget(QWidget *parent) void UnConfiguredSettingsWidget::apply() { - Qt4Manager *qt4Manager = ExtensionSystem::PluginManager::instance()->getObject<Qt4Manager>(); + Qt4Manager *qt4Manager = ExtensionSystem::PluginManager::getObject<Qt4Manager>(); Internal::UnConfiguredSettings ucs; int index = m_qtVersionComboBox->currentIndex(); diff --git a/src/plugins/qt4projectmanager/wizards/abstractmobileappwizard.cpp b/src/plugins/qt4projectmanager/wizards/abstractmobileappwizard.cpp index 152a8f5ba4..5f6bbed288 100644 --- a/src/plugins/qt4projectmanager/wizards/abstractmobileappwizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/abstractmobileappwizard.cpp @@ -272,7 +272,7 @@ bool AbstractMobileAppWizard::postGenerateFiles(const QWizard *w, Q_UNUSED(l) Q_UNUSED(errorMessage) Qt4Manager * const manager - = ExtensionSystem::PluginManager::instance()->getObject<Qt4Manager>(); + = ExtensionSystem::PluginManager::getObject<Qt4Manager>(); Q_ASSERT(manager); Qt4Project project(manager, app()->path(AbstractMobileApp::AppPro)); bool success = wizardDialog()->m_targetsPage->setupProject(&project); diff --git a/src/plugins/qt4projectmanager/wizards/guiappwizard.cpp b/src/plugins/qt4projectmanager/wizards/guiappwizard.cpp index b508397f5a..5e1ec2421e 100644 --- a/src/plugins/qt4projectmanager/wizards/guiappwizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/guiappwizard.cpp @@ -145,7 +145,7 @@ static inline bool generateFormClass(const GuiAppParameters ¶ms, QString headerContents; QString sourceContents; // Invoke code generation service of Qt Designer plugin. - if (QObject *codeGenerator = ExtensionSystem::PluginManager::instance()->getObjectByClassName(QLatin1String("Designer::QtDesignerFormClassCodeGenerator"))) { + if (QObject *codeGenerator = ExtensionSystem::PluginManager::getObjectByClassName(QLatin1String("Designer::QtDesignerFormClassCodeGenerator"))) { const QVariant code = ExtensionSystem::invoke<QVariant>(codeGenerator, "generateFormClassCode", fp); if (code.type() == QVariant::List) { const QVariantList vl = code.toList(); diff --git a/src/plugins/qt4projectmanager/wizards/qtwizard.cpp b/src/plugins/qt4projectmanager/wizards/qtwizard.cpp index c6393c11bf..511e6e13fd 100644 --- a/src/plugins/qt4projectmanager/wizards/qtwizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/qtwizard.cpp @@ -299,7 +299,7 @@ bool BaseQt4ProjectWizardDialog::writeUserFile(const QString &proFileName) const if (!m_targetSetupPage) return false; - Qt4Manager *manager = ExtensionSystem::PluginManager::instance()->getObject<Qt4Manager>(); + Qt4Manager *manager = ExtensionSystem::PluginManager::getObject<Qt4Manager>(); Q_ASSERT(manager); Qt4Project *pro = new Qt4Project(manager, proFileName); diff --git a/src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp b/src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp index 52e65ac773..1706cd37e3 100644 --- a/src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp +++ b/src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp @@ -153,7 +153,7 @@ void TargetSetupPage::setupWidgets() layout = m_ui->centralWidget->layout(); // Target Page setup - QList<Qt4BaseTargetFactory *> factories = ExtensionSystem::PluginManager::instance()->getObjects<Qt4BaseTargetFactory>(); + QList<Qt4BaseTargetFactory *> factories = ExtensionSystem::PluginManager::getObjects<Qt4BaseTargetFactory>(); bool atLeastOneTargetSelected = false; foreach (Qt4BaseTargetFactory *factory, factories) { QList<Core::Id> ids = factory->supportedTargetIds(); diff --git a/src/plugins/qtsupport/qtversionfactory.cpp b/src/plugins/qtsupport/qtversionfactory.cpp index d1d641c86b..d9bf181bf1 100644 --- a/src/plugins/qtsupport/qtversionfactory.cpp +++ b/src/plugins/qtsupport/qtversionfactory.cpp @@ -88,7 +88,7 @@ BaseQtVersion *QtVersionFactory::createQtVersionFromQMakePath(const Utils::FileN pro->deref(); } - QList<QtVersionFactory *> factories = ExtensionSystem::PluginManager::instance()->getObjects<QtVersionFactory>(); + QList<QtVersionFactory *> factories = ExtensionSystem::PluginManager::getObjects<QtVersionFactory>(); qSort(factories.begin(), factories.end(), &sortByPriority); foreach (QtVersionFactory *factory, factories) { diff --git a/src/plugins/qtsupport/qtversionmanager.cpp b/src/plugins/qtsupport/qtversionmanager.cpp index c5988bc251..79c3a7de93 100644 --- a/src/plugins/qtsupport/qtversionmanager.cpp +++ b/src/plugins/qtsupport/qtversionmanager.cpp @@ -88,7 +88,7 @@ template<class T> static T *createToolChain(const QString &id) { QList<ProjectExplorer::ToolChainFactory *> factories = - ExtensionSystem::PluginManager::instance()->getObjects<ProjectExplorer::ToolChainFactory>(); + ExtensionSystem::PluginManager::getObjects<ProjectExplorer::ToolChainFactory>(); foreach (ProjectExplorer::ToolChainFactory *f, factories) { if (f->id() == id) { Q_ASSERT(f->canCreate()); @@ -100,15 +100,13 @@ static T *createToolChain(const QString &id) static QString globalSettingsFileName() { - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - return QFileInfo(pm->globalSettings()->fileName()).absolutePath() + return QFileInfo(ExtensionSystem::PluginManager::globalSettings()->fileName()).absolutePath() + QLatin1String(QTVERSION_FILENAME); } static QString settingsFileName() { - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - QFileInfo settingsLocation(pm->settings()->fileName()); + QFileInfo settingsLocation(ExtensionSystem::PluginManager::settings()->fileName()); return settingsLocation.absolutePath() + QLatin1String(QTVERSION_FILENAME); } @@ -182,8 +180,7 @@ QtVersionManager *QtVersionManager::instance() bool QtVersionManager::restoreQtVersions() { - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - QList<QtVersionFactory *> factories = pm->getObjects<QtVersionFactory>(); + QList<QtVersionFactory *> factories = ExtensionSystem::PluginManager::getObjects<QtVersionFactory>(); Utils::PersistentSettingsReader reader; if (!reader.load(settingsFileName())) @@ -246,8 +243,7 @@ void QtVersionManager::updateFromInstaller() QList<int> removed; QList<int> changed; - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - QList<QtVersionFactory *> factories = pm->getObjects<QtVersionFactory>(); + QList<QtVersionFactory *> factories = ExtensionSystem::PluginManager::getObjects<QtVersionFactory>(); Utils::PersistentSettingsReader reader; QVariantMap data; if (reader.load(globalSettingsFileName())) diff --git a/src/plugins/remotelinux/startgdbserverdialog.cpp b/src/plugins/remotelinux/startgdbserverdialog.cpp index fb4a5d279e..a487a4b9c7 100644 --- a/src/plugins/remotelinux/startgdbserverdialog.cpp +++ b/src/plugins/remotelinux/startgdbserverdialog.cpp @@ -376,8 +376,7 @@ void StartGdbServerDialog::reportOpenPort(int port) logMessage(tr("Server started on %1").arg(channel)); const char *member = d->startServerOnly ? "gdbServerStarted" : "attachedToProcess"; - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - QObject *ob = pm->getObjectByName("DebuggerCore"); + QObject *ob = ExtensionSystem::PluginManager::getObjectByName("DebuggerCore"); if (ob) { QMetaObject::invokeMethod(ob, member, Qt::QueuedConnection, Q_ARG(QString, channel), diff --git a/src/plugins/tasklist/tasklistplugin.cpp b/src/plugins/tasklist/tasklistplugin.cpp index 6872a5e03e..7be63492c5 100644 --- a/src/plugins/tasklist/tasklistplugin.cpp +++ b/src/plugins/tasklist/tasklistplugin.cpp @@ -194,8 +194,7 @@ bool TaskListPlugin::initialize(const QStringList &arguments, QString *errorMess { Q_UNUSED(arguments) - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - d->hub = pm->getObject<ProjectExplorer::TaskHub>(); + d->hub = ExtensionSystem::PluginManager::getObject<ProjectExplorer::TaskHub>(); //: Category under which tasklist tasks are listed in Issues view d->hub->addCategory(Core::Id(Constants::TASKLISTTASK_ID), tr("My Tasks")); diff --git a/src/plugins/texteditor/codeassist/codeassistant.cpp b/src/plugins/texteditor/codeassist/codeassistant.cpp index 628ee1a02e..4f7a2f0d25 100644 --- a/src/plugins/texteditor/codeassist/codeassistant.cpp +++ b/src/plugins/texteditor/codeassist/codeassistant.cpp @@ -169,10 +169,10 @@ void CodeAssistantPrivate::configure(BaseTextEditor *textEditor) m_textEditor = textEditor; m_completionProviders = - ExtensionSystem::PluginManager::instance()->getObjects<CompletionAssistProvider>(); + ExtensionSystem::PluginManager::getObjects<CompletionAssistProvider>(); filterEditorSpecificProviders(&m_completionProviders, m_textEditor->id()); m_quickFixProviders = - ExtensionSystem::PluginManager::instance()->getObjects<QuickFixAssistProvider>(); + ExtensionSystem::PluginManager::getObjects<QuickFixAssistProvider>(); filterEditorSpecificProviders(&m_quickFixProviders, m_textEditor->id()); m_textEditor->editorWidget()->installEventFilter(this); diff --git a/src/plugins/texteditor/snippets/snippetscollection.cpp b/src/plugins/texteditor/snippets/snippetscollection.cpp index bd31c1ced8..f1b33ae90f 100644 --- a/src/plugins/texteditor/snippets/snippetscollection.cpp +++ b/src/plugins/texteditor/snippets/snippetscollection.cpp @@ -426,7 +426,7 @@ int SnippetsCollection::groupIndex(const QString &groupId) const void SnippetsCollection::identifyGroups() { const QList<ISnippetProvider *> &providers = - ExtensionSystem::PluginManager::instance()->getObjects<ISnippetProvider>(); + ExtensionSystem::PluginManager::getObjects<ISnippetProvider>(); foreach (ISnippetProvider *provider, providers) { const int groupIndex = m_groupIndexById.size(); m_groupIndexById.insert(provider->groupId(), groupIndex); diff --git a/src/plugins/texteditor/snippets/snippetssettingspage.cpp b/src/plugins/texteditor/snippets/snippetssettingspage.cpp index c79ea6c20f..759d913d77 100644 --- a/src/plugins/texteditor/snippets/snippetssettingspage.cpp +++ b/src/plugins/texteditor/snippets/snippetssettingspage.cpp @@ -335,7 +335,7 @@ void SnippetsSettingsPagePrivate::configureUi(QWidget *w) m_ui.setupUi(w); const QList<ISnippetProvider *> &providers = - ExtensionSystem::PluginManager::instance()->getObjects<ISnippetProvider>(); + ExtensionSystem::PluginManager::getObjects<ISnippetProvider>(); foreach (ISnippetProvider *provider, providers) { m_ui.groupCombo->addItem(provider->displayName(), provider->groupId()); SnippetEditorWidget *snippetEditor = new SnippetEditorWidget(w); @@ -548,7 +548,7 @@ void SnippetsSettingsPagePrivate::setSnippetContent() void SnippetsSettingsPagePrivate::decorateEditors(const TextEditor::FontSettings &fontSettings) { const QList<ISnippetProvider *> &providers = - ExtensionSystem::PluginManager::instance()->getObjects<ISnippetProvider>(); + ExtensionSystem::PluginManager::getObjects<ISnippetProvider>(); for (int i = 0; i < m_ui.groupCombo->count(); ++i) { SnippetEditorWidget *snippetEditor = editorAt(i); snippetEditor->setFontSettings(fontSettings); diff --git a/src/plugins/texteditor/texteditorplugin.cpp b/src/plugins/texteditor/texteditorplugin.cpp index 7d8cdc9a63..c34c4569d7 100644 --- a/src/plugins/texteditor/texteditorplugin.cpp +++ b/src/plugins/texteditor/texteditorplugin.cpp @@ -222,11 +222,9 @@ bool TextEditorPlugin::initialize(const QStringList &arguments, QString *errorMe void TextEditorPlugin::extensionsInitialized() { - ExtensionSystem::PluginManager *pluginManager = ExtensionSystem::PluginManager::instance(); - m_searchResultWindow = Find::SearchResultWindow::instance(); - m_outlineFactory->setWidgetFactories(pluginManager->getObjects<TextEditor::IOutlineWidgetFactory>()); + m_outlineFactory->setWidgetFactories(ExtensionSystem::PluginManager::getObjects<TextEditor::IOutlineWidgetFactory>()); connect(m_settings, SIGNAL(fontSettingsChanged(TextEditor::FontSettings)), this, SLOT(updateSearchResultsFont(TextEditor::FontSettings))); diff --git a/src/plugins/texteditor/texteditorsettings.cpp b/src/plugins/texteditor/texteditorsettings.cpp index 118bb80d40..6b962e5324 100644 --- a/src/plugins/texteditor/texteditorsettings.cpp +++ b/src/plugins/texteditor/texteditorsettings.cpp @@ -111,8 +111,6 @@ TextEditorSettings::TextEditorSettings(QObject *parent) QTC_ASSERT(!m_instance, return); m_instance = this; - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - // Note: default background colors are coming from FormatDescription::background() // Add font preference page @@ -196,7 +194,7 @@ TextEditorSettings::TextEditorSettings(QObject *parent) m_d->m_fontSettingsPage = new FontSettingsPage(formatDescriptions, QLatin1String(Constants::TEXT_EDITOR_FONT_SETTINGS), this); - pm->addObject(m_d->m_fontSettingsPage); + ExtensionSystem::PluginManager::addObject(m_d->m_fontSettingsPage); // Add the GUI used to configure the tab, storage and interaction settings TextEditor::BehaviorSettingsPageParameters behaviorSettingsPageParameters; @@ -204,22 +202,22 @@ TextEditorSettings::TextEditorSettings(QObject *parent) behaviorSettingsPageParameters.displayName = tr("Behavior"); behaviorSettingsPageParameters.settingsPrefix = QLatin1String("text"); m_d->m_behaviorSettingsPage = new BehaviorSettingsPage(behaviorSettingsPageParameters, this); - pm->addObject(m_d->m_behaviorSettingsPage); + ExtensionSystem::PluginManager::addObject(m_d->m_behaviorSettingsPage); TextEditor::DisplaySettingsPageParameters displaySettingsPageParameters; displaySettingsPageParameters.id = QLatin1String(Constants::TEXT_EDITOR_DISPLAY_SETTINGS), displaySettingsPageParameters.displayName = tr("Display"); displaySettingsPageParameters.settingsPrefix = QLatin1String("text"); m_d->m_displaySettingsPage = new DisplaySettingsPage(displaySettingsPageParameters, this); - pm->addObject(m_d->m_displaySettingsPage); + ExtensionSystem::PluginManager::addObject(m_d->m_displaySettingsPage); m_d->m_highlighterSettingsPage = new HighlighterSettingsPage(QLatin1String(Constants::TEXT_EDITOR_HIGHLIGHTER_SETTINGS), this); - pm->addObject(m_d->m_highlighterSettingsPage); + ExtensionSystem::PluginManager::addObject(m_d->m_highlighterSettingsPage); m_d->m_snippetsSettingsPage = new SnippetsSettingsPage(QLatin1String(Constants::TEXT_EDITOR_SNIPPETS_SETTINGS), this); - pm->addObject(m_d->m_snippetsSettingsPage); + ExtensionSystem::PluginManager::addObject(m_d->m_snippetsSettingsPage); connect(m_d->m_fontSettingsPage, SIGNAL(changed(TextEditor::FontSettings)), this, SIGNAL(fontSettingsChanged(TextEditor::FontSettings))); @@ -239,12 +237,11 @@ TextEditorSettings::TextEditorSettings(QObject *parent) TextEditorSettings::~TextEditorSettings() { - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - pm->removeObject(m_d->m_fontSettingsPage); - pm->removeObject(m_d->m_behaviorSettingsPage); - pm->removeObject(m_d->m_displaySettingsPage); - pm->removeObject(m_d->m_highlighterSettingsPage); - pm->removeObject(m_d->m_snippetsSettingsPage); + ExtensionSystem::PluginManager::removeObject(m_d->m_fontSettingsPage); + ExtensionSystem::PluginManager::removeObject(m_d->m_behaviorSettingsPage); + ExtensionSystem::PluginManager::removeObject(m_d->m_displaySettingsPage); + ExtensionSystem::PluginManager::removeObject(m_d->m_highlighterSettingsPage); + ExtensionSystem::PluginManager::removeObject(m_d->m_snippetsSettingsPage); delete m_d; diff --git a/src/plugins/valgrind/valgrindengine.cpp b/src/plugins/valgrind/valgrindengine.cpp index d7f35b68ce..6d86967c36 100644 --- a/src/plugins/valgrind/valgrindengine.cpp +++ b/src/plugins/valgrind/valgrindengine.cpp @@ -190,8 +190,7 @@ void ValgrindEngine::receiveProcessError(const QString &error, QProcess::Process return; ///FIXME: get a better API for this into Qt Creator - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - QList<Core::IOutputPane *> panes = pm->getObjects<Core::IOutputPane>(); + QList<Core::IOutputPane *> panes = ExtensionSystem::PluginManager::getObjects<Core::IOutputPane>(); foreach (Core::IOutputPane *pane, panes) { if (pane->displayName() == tr("Application Output")) { pane->popup(false); diff --git a/src/plugins/vcsbase/vcsbaseeditor.cpp b/src/plugins/vcsbase/vcsbaseeditor.cpp index cddaa8423e..311e3ff317 100644 --- a/src/plugins/vcsbase/vcsbaseeditor.cpp +++ b/src/plugins/vcsbase/vcsbaseeditor.cpp @@ -1400,8 +1400,7 @@ void VcsBaseEditorWidget::slotPaste() { // Retrieve service by soft dependency. QObject *pasteService = - ExtensionSystem::PluginManager::instance() - ->getObjectByClassName(QLatin1String("CodePaster::CodePasterService")); + ExtensionSystem::PluginManager::getObjectByClassName(QLatin1String("CodePaster::CodePasterService")); if (pasteService) { QMetaObject::invokeMethod(pasteService, "postCurrentEditor"); } else { diff --git a/src/plugins/welcome/welcomeplugin.cpp b/src/plugins/welcome/welcomeplugin.cpp index 5ee56b15f0..5fd5bcdf04 100644 --- a/src/plugins/welcome/welcomeplugin.cpp +++ b/src/plugins/welcome/welcomeplugin.cpp @@ -206,7 +206,7 @@ void WelcomeMode::initPlugins() QDeclarativeContext *ctx = m_welcomePage->rootContext(); ctx->setContextProperty(QLatin1String("welcomeMode"), this); - QList<Utils::IWelcomePage*> duplicatePlugins = PluginManager::instance()->getObjects<Utils::IWelcomePage>(); + QList<Utils::IWelcomePage*> duplicatePlugins = PluginManager::getObjects<Utils::IWelcomePage>(); qSort(duplicatePlugins.begin(), duplicatePlugins.end(), &sortFunction); QList<Utils::IWelcomePage*> plugins; @@ -294,7 +294,7 @@ void WelcomeMode::welcomePluginAdded(QObject *obj) } int insertPos = 0; - foreach (Utils::IWelcomePage* p, PluginManager::instance()->getObjects<Utils::IWelcomePage>()) { + foreach (Utils::IWelcomePage* p, PluginManager::getObjects<Utils::IWelcomePage>()) { if (plugin->priority() < p->priority()) insertPos++; else |