Remove some needless ProjectExplorer::

... and use ProjectExplorerPlugin::instance() directly in some places
where a variable was defined for it and used exactly once.

No code change.

Change-Id: I095fc80ac29f717eaabf13afa90c3bf6d9daf90a
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
Tobias Hunger
2014-05-02 17:02:28 +02:00
parent 8d5e4b32a8
commit 0814cc112a
7 changed files with 8 additions and 11 deletions

View File

@@ -570,7 +570,7 @@ bool CustomProjectWizard::postGenerateOpen(const Core::GeneratedFiles &l, QStrin
// Post-Generate: Open the project and the editors as desired
foreach (const Core::GeneratedFile &file, l) {
if (file.attributes() & Core::GeneratedFile::OpenProjectAttribute) {
if (!ProjectExplorer::ProjectExplorerPlugin::instance()->openProject(file.path(), errorMessage))
if (!ProjectExplorerPlugin::instance()->openProject(file.path(), errorMessage))
return false;
}
}

View File

@@ -58,9 +58,8 @@ ProjectFileFactory::ProjectFileFactory(IProjectManager *manager)
Core::IDocument *ProjectFileFactory::open(const QString &fileName)
{
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
QString errorMessage;
pe->openProject(fileName, &errorMessage);
ProjectExplorerPlugin::instance()->openProject(fileName, &errorMessage);
if (!errorMessage.isEmpty())
QMessageBox::critical(Core::ICore::mainWindow(), tr("Failed to open project"), errorMessage);
return 0;

View File

@@ -1402,7 +1402,7 @@ void QmakeProject::configureAsExampleProject(const QStringList &platforms)
}
setup(infoList);
qDeleteAll(infoList);
ProjectExplorer::ProjectExplorerPlugin::instance()->requestProjectModeUpdate(this);
ProjectExplorerPlugin::instance()->requestProjectModeUpdate(this);
}
bool QmakeProject::supportsNoTargetPanel() const

View File

@@ -140,7 +140,7 @@ void QmakeManager::addLibrary()
void QmakeManager::addLibraryContextMenu()
{
ProjectExplorer::Node *node = ProjectExplorer::ProjectExplorerPlugin::instance()->currentNode();
ProjectExplorer::Node *node = ProjectExplorerPlugin::instance()->currentNode();
if (qobject_cast<QmakeProFileNode *>(node))
addLibrary(node->path());
}
@@ -183,7 +183,7 @@ void QmakeManager::runQMakeContextMenu()
void QmakeManager::runQMake(ProjectExplorer::Project *p, ProjectExplorer::Node *node)
{
if (!ProjectExplorer::ProjectExplorerPlugin::instance()->saveModifiedFiles())
if (!ProjectExplorerPlugin::instance()->saveModifiedFiles())
return;
QmakeProject *qmakeProject = qobject_cast<QmakeProject *>(p);
QTC_ASSERT(qmakeProject, return);

View File

@@ -105,7 +105,7 @@ bool QmakeProjectManagerPlugin::initialize(const QStringList &arguments, QString
if (!Core::MimeDatabase::addMimeTypes(QLatin1String(":qmakeprojectmanager/QmakeProjectManager.mimetypes.xml"), errorMessage))
return false;
m_projectExplorer = ProjectExplorer::ProjectExplorerPlugin::instance();
m_projectExplorer = ProjectExplorerPlugin::instance();
//create and register objects
m_qmakeProjectManager = new QmakeManager(this);

View File

@@ -140,9 +140,8 @@ bool AbstractMobileAppWizard::postGenerateFiles(const QWizard *w,
const QString fileToOpen = fileToOpenPostGeneration();
if (!fileToOpen.isEmpty()) {
Core::EditorManager::openEditor(fileToOpen);
ProjectExplorer::ProjectExplorerPlugin *pe = ProjectExplorer::ProjectExplorerPlugin::instance();
ProjectExplorer::Project *project = ProjectExplorer::SessionManager::projectForFile(fileToOpen);
pe->setCurrentFile(project, fileToOpen);
ProjectExplorerPlugin::instance()->setCurrentFile(project, fileToOpen);
}
}
return success;

View File

@@ -404,10 +404,9 @@ void ExamplesWelcomePage::openProject(const QString &projectFile, const QStringL
// don't try to load help and files if loading the help request is being cancelled
QString errorMessage;
ProjectExplorer::ProjectExplorerPlugin *peplugin = ProjectExplorer::ProjectExplorerPlugin::instance();
if (proFile.isEmpty())
return;
if (peplugin->openProject(proFile, &errorMessage)) {
if (ProjectExplorer::ProjectExplorerPlugin::instance()->openProject(proFile, &errorMessage)) {
Core::ICore::openFiles(filesToOpen);
Core::ModeManager::activateMode(Core::Constants::MODE_EDIT);
if (help.isValid())