Fixes: simplify ProjectExplorerPlugin::instance() access

This commit is contained in:
hjk
2009-03-04 09:38:01 +01:00
parent 4deb36687a
commit 12018c89d6
16 changed files with 32 additions and 59 deletions
+4 -10
View File
@@ -36,7 +36,6 @@
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/icore.h>
#include <coreplugin/uniqueidmanager.h>
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/projectexplorer.h>
#include <texteditor/basetexteditor.h>
#include <utils/qtcassert.h>
@@ -306,18 +305,15 @@ QWidget *BookmarkContext::widget()
// BookmarkManager
////
BookmarkManager::BookmarkManager() :
m_bookmarkIcon(QIcon(QLatin1String(":/bookmarks/images/bookmark.png")))
BookmarkManager::BookmarkManager()
: m_bookmarkIcon(QIcon(QLatin1String(":/bookmarks/images/bookmark.png")))
{
m_selectionModel = new QItemSelectionModel(this, this);
connect(Core::ICore::instance(), SIGNAL(contextChanged(Core::IContext*)),
this, SLOT(updateActionStatus()));
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
ProjectExplorerPlugin *projectExplorer = pm->getObject<ProjectExplorerPlugin>();
connect(projectExplorer->session(), SIGNAL(sessionLoaded()),
connect(ProjectExplorerPlugin::instance()->session(), SIGNAL(sessionLoaded()),
this, SLOT(loadBookmarks()));
updateActionStatus();
@@ -559,9 +555,7 @@ TextEditor::ITextEditor *BookmarkManager::currentTextEditor() const
/* Returns the current session. */
SessionManager *BookmarkManager::sessionManager() const
{
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
ProjectExplorerPlugin *pe = pm->getObject<ProjectExplorerPlugin>();
return pe->session();
return ProjectExplorerPlugin::instance()->session();
}
BookmarkManager::State BookmarkManager::state() const
-3
View File
@@ -42,7 +42,6 @@
#include <coreplugin/messagemanager.h>
#include <coreplugin/messageoutputwindow.h>
#include <coreplugin/uniqueidmanager.h>
#include <extensionsystem/pluginmanager.h>
#include <texteditor/itexteditor.h>
#include <QtCore/QtPlugin>
@@ -116,8 +115,6 @@ bool CodepasterPlugin::initialize(const QStringList &arguments, QString *error_m
void CodepasterPlugin::extensionsInitialized()
{
m_projectExplorer = ExtensionSystem::PluginManager::instance()
->getObject<ProjectExplorer::ProjectExplorerPlugin>();
}
QString CodepasterPlugin::serverUrl() const
-2
View File
@@ -37,7 +37,6 @@
#include <coreplugin/editormanager/ieditorfactory.h>
#include <coreplugin/icorelistener.h>
#include <extensionsystem/iplugin.h>
#include <projectexplorer/projectexplorer.h>
#include <QtCore/QObject>
@@ -70,7 +69,6 @@ private:
QAction *m_postAction;
QAction *m_fetchAction;
ProjectExplorer::ProjectExplorerPlugin *m_projectExplorer;
SettingsPage *m_settingsPage;
CustomFetcher *m_fetcher;
CustomPoster *m_poster;
+7 -6
View File
@@ -48,7 +48,6 @@
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/progressmanager/progressmanager.h>
#include <extensionsystem/pluginmanager.h>
#include <utils/qtcassert.h>
#include <TranslationUnit.h>
@@ -545,12 +544,12 @@ CppModelManager::CppModelManager(QObject *parent)
m_core = Core::ICore::instance(); // FIXME
m_dirty = true;
m_projectExplorer = ExtensionSystem::PluginManager::instance()
->getObject<ProjectExplorer::ProjectExplorerPlugin>();
ProjectExplorer::ProjectExplorerPlugin *pe =
ProjectExplorer::ProjectExplorerPlugin::instance();
QTC_ASSERT(m_projectExplorer, return);
QTC_ASSERT(pe, return);
ProjectExplorer::SessionManager *session = m_projectExplorer->session();
ProjectExplorer::SessionManager *session = pe->session();
QTC_ASSERT(session, return);
m_updateEditorSelectionsTimer = new QTimer(this);
@@ -586,7 +585,9 @@ CppModelManager::~CppModelManager()
{ }
Snapshot CppModelManager::snapshot() const
{ return m_snapshot; }
{
return m_snapshot;
}
void CppModelManager::ensureUpdated()
{
-1
View File
@@ -148,7 +148,6 @@ private:
private:
Core::ICore *m_core;
ProjectExplorer::ProjectExplorerPlugin *m_projectExplorer;
CPlusPlus::Snapshot m_snapshot;
// cache
+1 -2
View File
@@ -44,7 +44,6 @@
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/editormanager/editormanager.h>
#include <cppeditor/cppeditorconstants.h>
#include <extensionsystem/pluginmanager.h>
#include <QtCore/QtPlugin>
#include <QtCore/QFileInfo>
@@ -219,7 +218,7 @@ QString CppToolsPlugin::correspondingHeaderOrSourceI(const QString &fileName) co
const Core::ICore *core = Core::ICore::instance();
const Core::MimeDatabase *mimeDatase = core->mimeDatabase();
ProjectExplorer::ProjectExplorerPlugin *explorer =
ExtensionSystem::PluginManager::instance()->getObject<ProjectExplorer::ProjectExplorerPlugin>();
ProjectExplorer::ProjectExplorerPlugin::instance();
ProjectExplorer::Project *project = (explorer ? explorer->currentProject() : 0);
const QFileInfo fi(fileName);
+1
View File
@@ -66,6 +66,7 @@ StackWindow::StackWindow(QWidget *parent)
void StackWindow::resizeEvent(QResizeEvent *event)
{
QHeaderView *hv = header();
int totalSize = event->size().width() - 120;
if (totalSize > 10) {
hv->resizeSection(0, 45);
+1 -2
View File
@@ -45,7 +45,6 @@
#include <coreplugin/uniqueidmanager.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/editormanager/editormanager.h>
#include <extensionsystem/pluginmanager.h>
#include <utils/qtcassert.h>
@@ -439,7 +438,7 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *error_message)
void GitPlugin::extensionsInitialized()
{
m_projectExplorer = ExtensionSystem::PluginManager::instance()->getObject<ProjectExplorer::ProjectExplorerPlugin>();
m_projectExplorer = ProjectExplorer::ProjectExplorerPlugin::instance();
}
void GitPlugin::submitEditorDiff(const QStringList &unstaged, const QStringList &staged)
+1 -2
View File
@@ -47,7 +47,6 @@
#include <coreplugin/messagemanager.h>
#include <coreplugin/mimedatabase.h>
#include <coreplugin/uniqueidmanager.h>
#include <extensionsystem/pluginmanager.h>
#include <utils/qtcassert.h>
#include <utils/synchronousprocess.h>
#include <vcsbase/basevcseditorfactory.h>
@@ -386,7 +385,7 @@ bool PerforcePlugin::initialize(const QStringList &arguments, QString *errorMess
void PerforcePlugin::extensionsInitialized()
{
m_projectExplorer = ExtensionSystem::PluginManager::instance()->getObject<ProjectExplorer::ProjectExplorerPlugin>();
m_projectExplorer = ProjectExplorer::ProjectExplorerPlugin::instance();
if (m_projectExplorer) {
connect(m_projectExplorer,
SIGNAL(currentProjectChanged(ProjectExplorer::Project*)),
@@ -62,9 +62,8 @@ ProjectWindow::ProjectWindow(QWidget *parent) : QWidget(parent)
setWindowTitle(tr("Project Explorer"));
setWindowIcon(QIcon(":/projectexplorer/images/projectexplorer.png"));
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
ProjectExplorerPlugin *projectExplorer = m_projectExplorer = pm->getObject<ProjectExplorerPlugin>();
m_session = projectExplorer->session();
m_projectExplorer = ProjectExplorerPlugin::instance();
m_session = m_projectExplorer->session();
connect(m_session, SIGNAL(sessionLoaded()), this, SLOT(restoreStatus()));
connect(m_session, SIGNAL(aboutToSaveSession()), this, SLOT(saveStatus()));
@@ -37,7 +37,6 @@
#include "qtversionmanager.h"
#include "qmakestep.h"
#include <extensionsystem/pluginmanager.h>
#include <coreplugin/icore.h>
#include <coreplugin/basefilewizard.h>
#include <coreplugin/messagemanager.h>
@@ -111,8 +110,7 @@ void Qt4Manager::notifyChanged(const QString &name)
void Qt4Manager::init()
{
m_projectExplorer = ExtensionSystem::PluginManager::instance()
->getObject<ProjectExplorer::ProjectExplorerPlugin>();
m_projectExplorer = ProjectExplorer::ProjectExplorerPlugin::instance();
}
int Qt4Manager::projectContext() const
@@ -100,8 +100,7 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString *
if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":qt4projectmanager/Qt4ProjectManager.mimetypes.xml"), errorMessage))
return false;
m_projectExplorer = ExtensionSystem::PluginManager::instance()
->getObject<ProjectExplorer::ProjectExplorerPlugin>();
m_projectExplorer = ProjectExplorer::ProjectExplorerPlugin::instance();
Core::ActionManager *am = core->actionManager();
@@ -32,7 +32,6 @@
#include "qt4projectmanagerconstants.h"
#include <coreplugin/icore.h>
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/projectexplorer.h>
#include <QtCore/QByteArray>
@@ -60,8 +59,7 @@ static inline Core::BaseFileWizardParameters
// -------------------- QtWizard
QtWizard::QtWizard(const QString &name, const QString &description, const QIcon &icon) :
Core::BaseFileWizard(wizardParameters(name, description, icon)),
m_projectExplorer(ExtensionSystem::PluginManager::instance()->getObject<ProjectExplorer::ProjectExplorerPlugin>())
Core::BaseFileWizard(wizardParameters(name, description, icon))
{
}
@@ -89,7 +87,7 @@ bool QtWizard::postGenerateFiles(const Core::GeneratedFiles &l, QString *errorMe
{
// Post-Generate: Open the project
const QString proFileName = l.back().path();
if (!m_projectExplorer->openProject(proFileName)) {
if (!ProjectExplorer::ProjectExplorerPlugin::instance()->openProject(proFileName)) {
*errorMessage = tr("The project %1 could not be opened.").arg(proFileName);
return false;
}
@@ -34,9 +34,6 @@
#include <coreplugin/basefilewizard.h>
namespace ProjectExplorer {
class ProjectExplorerPlugin;
}
namespace Qt4ProjectManager {
namespace Internal {
@@ -66,8 +63,6 @@ protected:
private:
bool postGenerateFiles(const Core::GeneratedFiles &l, QString *errorMessage);
ProjectExplorer::ProjectExplorerPlugin *m_projectExplorer;
};
} // namespace Internal
+1 -5
View File
@@ -50,7 +50,6 @@
#include <coreplugin/uniqueidmanager.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/editormanager/editormanager.h>
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/projectexplorer.h>
#include <utils/qtcassert.h>
@@ -432,10 +431,7 @@ bool SubversionPlugin::initialize(const QStringList &arguments, QString *errorMe
void SubversionPlugin::extensionsInitialized()
{
using namespace ExtensionSystem;
using namespace ProjectExplorer;
m_projectExplorer = PluginManager::instance()->getObject<ProjectExplorerPlugin>();
m_projectExplorer = ProjectExplorer::ProjectExplorerPlugin::instance();
if (m_projectExplorer) {
connect(m_projectExplorer,
SIGNAL(currentProjectChanged(ProjectExplorer::Project*)),
+10 -9
View File
@@ -30,10 +30,10 @@
#include "vcsbasesubmiteditor.h"
#include "submiteditorfile.h"
#include <aggregation/aggregate.h>
#include <coreplugin/ifile.h>
#include <coreplugin/uniqueidmanager.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <extensionsystem/pluginmanager.h>
#include <utils/submiteditorwidget.h>
#include <find/basetextfind.h>
@@ -316,23 +316,24 @@ QIcon VCSBaseSubmitEditor::submitIcon()
QStringList VCSBaseSubmitEditor::currentProjectFiles(bool nativeSeparators, QString *name)
{
using namespace ProjectExplorer;
if (name)
name->clear();
ProjectExplorer::ProjectExplorerPlugin *projectExplorer = ExtensionSystem::PluginManager::instance()->getObject<ProjectExplorer::ProjectExplorerPlugin>();
if (!projectExplorer)
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
if (!pe)
return QStringList();
QStringList files;
if (const ProjectExplorer::Project *currentProject = projectExplorer->currentProject()) {
files << currentProject->files(ProjectExplorer::Project::ExcludeGeneratedFiles);
if (const Project *currentProject = pe->currentProject()) {
files << currentProject->files(Project::ExcludeGeneratedFiles);
if (name)
*name = currentProject->name();
} else {
if (const ProjectExplorer::SessionManager *session = projectExplorer->session()) {
if (const SessionManager *session = pe->session()) {
if (name)
*name = session->file()->fileName();
const QList<ProjectExplorer::Project *> projects = session->projects();
foreach (ProjectExplorer::Project *project, projects)
files << project->files(ProjectExplorer::Project::ExcludeGeneratedFiles);
const QList<Project *> projects = session->projects();
foreach (Project *project, projects)
files << project->files(Project::ExcludeGeneratedFiles);
}
}
if (nativeSeparators && !files.empty()) {