SessionManager: Apply 'static' pattern

Change-Id: I370f72fcf7a24216ee189979ce6b5c8bfc5f4140
Reviewed-by: David Schulz <david.schulz@digia.com>
This commit is contained in:
hjk
2013-09-05 11:46:07 +02:00
parent dab9886ebf
commit aadb6f16af
58 changed files with 545 additions and 680 deletions

View File

@@ -44,6 +44,7 @@
#include <coreplugin/editormanager/editormanager.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/session.h>
#include <utils/qtcassert.h>
#include <QDir>
@@ -185,8 +186,7 @@ static QString makeFrameName(const Frame &frame, const QString &relativeTo,
static QString relativeToPath()
{
// The project for which we insert the snippet.
const ProjectExplorer::Project *project =
ProjectExplorer::ProjectExplorerPlugin::instance()->startupProject();
const ProjectExplorer::Project *project = ProjectExplorer::SessionManager::startupProject();
QString relativeTo(project ? project->projectDirectory() : QDir::homePath());
if (!relativeTo.endsWith(QDir::separator()))

View File

@@ -139,9 +139,8 @@ bool MemcheckErrorFilterProxyModel::filterAcceptsRow(int sourceRow, const QModel
if (m_filterExternalIssues && !error.stacks().isEmpty()) {
// ALGORITHM: look at last five stack frames, if none of these is inside any open projects,
// assume this error was created by an external library
SessionManager *session = ProjectExplorerPlugin::instance()->session();
QSet<QString> validFolders;
foreach (Project *project, session->projects()) {
foreach (Project *project, SessionManager::projects()) {
validFolders << project->projectDirectory();
foreach (Target *target, project->targets()) {
foreach (BuildConfiguration *config, target->buildConfigurations())
@@ -227,8 +226,7 @@ void MemcheckTool::settingsDestroyed(QObject *settings)
void MemcheckTool::maybeActiveRunConfigurationChanged()
{
ValgrindBaseSettings *settings = 0;
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
if (Project *project = pe->startupProject())
if (Project *project = SessionManager::startupProject())
if (Target *target = project->activeTarget())
if (RunConfiguration *rc = target->activeRunConfiguration())
if (IRunConfigurationAspect *aspect = rc->extraAspect(ANALYZER_VALGRIND_SETTINGS))

View File

@@ -211,9 +211,8 @@ void SuppressionDialog::accept()
return;
// Add file to project if there is a project containing this file on the file system.
ProjectExplorer::SessionManager *session = ProjectExplorer::ProjectExplorerPlugin::instance()->session();
if (!session->projectForFile(path)) {
foreach (ProjectExplorer::Project *p, session->projects()) {
if (!ProjectExplorer::SessionManager::projectForFile(path)) {
foreach (ProjectExplorer::Project *p, ProjectExplorer::SessionManager::projects()) {
if (path.startsWith(p->projectDirectory())) {
p->rootProjectNode()->addFiles(QStringList() << path);
break;

View File

@@ -41,6 +41,7 @@
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/project.h>
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/session.h>
#include <projectexplorer/target.h>
#include <utils/qtcassert.h>
@@ -83,10 +84,8 @@ static void startLocalTool(IAnalyzerTool *tool)
// Make sure mode is shown.
AnalyzerManager::showMode();
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
// ### not sure if we're supposed to check if the RunConFiguration isEnabled
Project *pro = pe->startupProject();
Project *pro = SessionManager::startupProject();
BuildConfiguration::BuildType buildType = BuildConfiguration::Unknown;
if (pro) {
if (const Target *target = pro->activeTarget()) {
@@ -147,7 +146,7 @@ static void startLocalTool(IAnalyzerTool *tool)
return;
}
pe->runProject(pro, tool->runMode());
ProjectExplorerPlugin::instance()->runProject(pro, tool->runMode());
}
static void startRemoteTool(IAnalyzerTool *tool)