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/plugins/coreplugin | |
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/plugins/coreplugin')
-rw-r--r-- | src/plugins/coreplugin/basefilewizard.cpp | 2 | ||||
-rw-r--r-- | src/plugins/coreplugin/designmode.cpp | 4 | ||||
-rw-r--r-- | src/plugins/coreplugin/dialogs/iwizard.cpp | 8 | ||||
-rw-r--r-- | src/plugins/coreplugin/dialogs/settingsdialog.cpp | 4 | ||||
-rw-r--r-- | src/plugins/coreplugin/editormanager/editormanager.cpp | 28 | ||||
-rw-r--r-- | src/plugins/coreplugin/findplaceholder.cpp | 4 | ||||
-rw-r--r-- | src/plugins/coreplugin/mainwindow.cpp | 40 | ||||
-rw-r--r-- | src/plugins/coreplugin/messagemanager.cpp | 7 | ||||
-rw-r--r-- | src/plugins/coreplugin/outputpanemanager.cpp | 3 | ||||
-rw-r--r-- | src/plugins/coreplugin/plugindialog.cpp | 4 | ||||
-rw-r--r-- | src/plugins/coreplugin/vcsmanager.cpp | 2 |
11 files changed, 48 insertions, 58 deletions
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: |