Commit 1ba91e30 authored by hjk's avatar hjk

ProjectExplorer: Apply static pattern to ProjectExplorerPlugin

Adjust caller sites and surroundings.

Change-Id: I6c3c80e42f35eabedc1f89c8c42cca1025aca12f
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
parent d066e3ca
......@@ -85,7 +85,7 @@ void CMakeEditor::finalizeInitialization()
foreach (Project *p, SessionManager::projects()) {
if (CMakeProject *cmakeProject = qobject_cast<CMakeProject *>(p)) {
if (cmakeProject->isProjectFile(document->filePath())) {
ProjectExplorerPlugin::instance()->buildProject(cmakeProject);
ProjectExplorerPlugin::buildProject(cmakeProject);
break;
}
}
......
......@@ -118,7 +118,7 @@ void CMakeLocatorFilter::accept(Core::LocatorFilterEntry selection) const
makeStep->setBuildTarget(selection.displayName, true);
// Build
ProjectExplorer::ProjectExplorerPlugin::instance()->buildProject(cmakeProject);
ProjectExplorerPlugin::buildProject(cmakeProject);
makeStep->setBuildTargets(oldTargets);
}
......
......@@ -852,7 +852,7 @@ void CMakeBuildSettingsWidget::openChangeBuildDirectoryDialog()
void CMakeBuildSettingsWidget::runCMake()
{
if (!ProjectExplorer::ProjectExplorerPlugin::instance()->saveModifiedFiles())
if (!ProjectExplorer::ProjectExplorerPlugin::saveModifiedFiles())
return;
CMakeProject *project = static_cast<CMakeProject *>(m_buildConfiguration->target()->project());
CMakeBuildInfo info(m_buildConfiguration);
......
......@@ -94,7 +94,7 @@ void CMakeManager::runCMake(ProjectExplorer::Project *project)
if (!cmakeProject || !cmakeProject->activeTarget() || !cmakeProject->activeTarget()->activeBuildConfiguration())
return;
if (!ProjectExplorer::ProjectExplorerPlugin::instance()->saveModifiedFiles())
if (!ProjectExplorer::ProjectExplorerPlugin::saveModifiedFiles())
return;
CMakeBuildConfiguration *bc
......
......@@ -117,15 +117,14 @@ public:
class ExampleProjectConfigurator
{
public:
ExampleProjectConfigurator(const QString &projectFile,
ProjectExplorerPlugin *projectExplorer)
ExampleProjectConfigurator(const QString &projectFile)
{
const QString projectUserFile = projectFile + _(".user");
QVERIFY(!QFileInfo(projectUserFile).exists());
// Open project
QString errorOpeningProject;
m_project = projectExplorer->openProject(projectFile, &errorOpeningProject);
m_project = ProjectExplorerPlugin::openProject(projectFile, &errorOpeningProject);
QVERIFY(m_project);
QVERIFY(errorOpeningProject.isEmpty());
......@@ -671,8 +670,7 @@ void CppToolsPlugin::test_modelmanager_extraeditorsupport_uiFiles()
const QString projectFile = testDataDirectory.file(_("testdata_guiproject1.pro"));
// Open project with *.ui file
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
ExampleProjectConfigurator exampleProjectConfigurator(projectFile, pe);
ExampleProjectConfigurator exampleProjectConfigurator(projectFile);
Project *project = exampleProjectConfigurator.project();
// Check working copy.
......
......@@ -1540,20 +1540,17 @@ void DebuggerPluginPrivate::languagesChanged()
void DebuggerPluginPrivate::debugProject()
{
if (Project *pro = SessionManager::startupProject())
ProjectExplorerPlugin::instance()->runProject(pro, DebugRunMode);
ProjectExplorerPlugin::runProject(SessionManager::startupProject(), DebugRunMode);
}
void DebuggerPluginPrivate::debugProjectWithoutDeploy()
{
if (Project *pro = SessionManager::startupProject())
ProjectExplorerPlugin::instance()->runProject(pro, DebugRunMode, true);
ProjectExplorerPlugin::runProject(SessionManager::startupProject(), DebugRunMode, true);
}
void DebuggerPluginPrivate::debugProjectBreakMain()
{
if (Project *pro = SessionManager::startupProject())
ProjectExplorerPlugin::instance()->runProject(pro, DebugRunModeWithBreakOnMain);
ProjectExplorerPlugin::runProject(SessionManager::startupProject(), DebugRunModeWithBreakOnMain);
}
void DebuggerPluginPrivate::startAndDebugApplication()
......@@ -3527,13 +3524,12 @@ void DebuggerPlugin::extensionsInitialized()
void DebuggerPluginPrivate::testLoadProject(const QString &proFile, const TestCallBack &cb)
{
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
connect(pe, SIGNAL(currentProjectChanged(ProjectExplorer::Project*)),
this, SLOT(testProjectLoaded(ProjectExplorer::Project*)));
connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::currentProjectChanged,
this, &DebuggerPluginPrivate::testProjectLoaded);
m_testCallbacks.append(cb);
QString error;
if (pe->openProject(proFile, &error)) {
if (ProjectExplorerPlugin::openProject(proFile, &error)) {
// Will end up in callback below due to the connections to
// signal currentProjectChanged().
return;
......@@ -3563,7 +3559,7 @@ void DebuggerPluginPrivate::testProjectEvaluated()
qWarning("Project %s loaded", qPrintable(fileName));
connect(BuildManager::instance(), SIGNAL(buildQueueFinished(bool)),
SLOT(testProjectBuilt(bool)));
ProjectExplorerPlugin::instance()->buildProject(m_testProject);
ProjectExplorerPlugin::buildProject(m_testProject);
}
void DebuggerPluginPrivate::testProjectBuilt(bool success)
......
......@@ -457,11 +457,11 @@ DebuggerRunControl *DebuggerRunControlFactory::createAndScheduleRun(const Debugg
QString errorMessage;
DebuggerRunControl *rc = doCreate(sp, 0, &errorMessage);
if (!rc) {
ProjectExplorer::ProjectExplorerPlugin::showRunErrorMessage(errorMessage);
ProjectExplorerPlugin::showRunErrorMessage(errorMessage);
return 0;
}
debuggerCore()->showMessage(sp.startMessage, 0);
ProjectExplorerPlugin::instance()->startRunControl(rc, DebugRunMode);
ProjectExplorerPlugin::startRunControl(rc, DebugRunMode);
return rc;
}
......
......@@ -54,9 +54,6 @@ namespace {
class ProjectExplorerHelper
{
public:
static ProjectExplorerPlugin *getInstance()
{ return ProjectExplorerPlugin::instance(); }
ProjectExplorerHelper()
{
QVERIFY(!SessionManager::hasProjects());
......@@ -65,13 +62,13 @@ public:
~ProjectExplorerHelper()
{
foreach (Project *project, m_openProjects)
getInstance()->unloadProject(project);
ProjectExplorerPlugin::unloadProject(project);
}
Project *openProject(const QString &projectFile)
{
QString error;
Project *project = getInstance()->openProject(projectFile, &error);
Project *project = ProjectExplorerPlugin::openProject(projectFile, &error);
if (!error.isEmpty())
qWarning() << error;
if (!project)
......
......@@ -39,7 +39,7 @@ CoreListener::CoreListener()
bool CoreListener::coreAboutToClose()
{
return ProjectExplorerPlugin::instance()->coreAboutToClose();
return ProjectExplorerPlugin::coreAboutToClose();
}
}
......
......@@ -524,7 +524,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 (!ProjectExplorerPlugin::instance()->openProject(file.path(), errorMessage))
if (!ProjectExplorerPlugin::openProject(file.path(), errorMessage))
return false;
}
}
......
......@@ -162,6 +162,7 @@ const char EXTERNAL_FILE_WARNING[] = "ExternalFile";
}
using namespace Core;
using namespace ProjectExplorer::Internal;
namespace ProjectExplorer {
......@@ -177,9 +178,27 @@ static BuildConfiguration *activeBuildConfiguration()
return target ? target->activeBuildConfiguration() : 0;
}
struct ProjectExplorerPluginPrivate {
class ProjectExplorerPluginPrivate : public QObject
{
public:
ProjectExplorerPluginPrivate();
void deploy(QList<Project *>);
int queue(QList<Project *>, QList<Core::Id> stepIds);
void updateContextMenuActions();
void executeRunConfiguration(RunConfiguration *, RunMode mode);
QPair<bool, QString> buildSettingsEnabledForSession();
QPair<bool, QString> buildSettingsEnabled(Project *pro);
void setCurrent(Project *project, QString filePath, Node *node);
void addToRecentProjects(const QString &fileName, const QString &displayName);
void startRunControl(RunControl *runControl, RunMode runMode);
void updateActions();
void updateContext();
void updateDeployActions();
void updateRunWithoutDeployMenu();
QMenu *m_sessionContextMenu;
QMenu *m_sessionMenu;
QMenu *m_projectMenu;
......@@ -234,7 +253,7 @@ struct ProjectExplorerPluginPrivate {
QAction *m_projectSelectorActionQuick;
QAction *m_runSubProject;
Internal::ProjectWindow *m_proWindow;
ProjectWindow *m_proWindow;
QString m_sessionToRestoreAtStartup;
Project *m_currentProject;
......@@ -242,7 +261,7 @@ struct ProjectExplorerPluginPrivate {
Node *m_currentNode;
QStringList m_profileMimeTypes;
Internal::AppOutputPane *m_outputPane;
AppOutputPane *m_outputPane;
QList<QPair<QString, QString> > m_recentProjects; // pair of filename, displayname
static const int m_maxRecentProjects = 25;
......@@ -253,11 +272,9 @@ struct ProjectExplorerPluginPrivate {
bool m_shouldHaveRunConfiguration;
RunMode m_runMode;
QString m_projectFilterString;
Internal::MiniProjectTargetSelector * m_targetSelector;
Internal::ProjectExplorerSettings m_projectExplorerSettings;
Internal::ProjectWelcomePage *m_welcomePage;
MiniProjectTargetSelector * m_targetSelector;
ProjectExplorerSettings m_projectExplorerSettings;
ProjectWelcomePage *m_welcomePage;
IMode *m_projectsMode;
TaskHub *m_taskHub;
......@@ -297,33 +314,28 @@ public:
}
};
} // namespace ProjectExplorer
using namespace ProjectExplorer;
using namespace ProjectExplorer::Internal;
ProjectExplorerPlugin *ProjectExplorerPlugin::m_instance = 0;
static ProjectExplorerPlugin *m_instance = 0;
static ProjectExplorerPluginPrivate *dd = 0;
ProjectExplorerPlugin::ProjectExplorerPlugin()
: d(new ProjectExplorerPluginPrivate)
{
m_instance = this;
dd = new ProjectExplorerPluginPrivate;
}
ProjectExplorerPlugin::~ProjectExplorerPlugin()
{
removeObject(d->m_welcomePage);
delete d->m_welcomePage;
JsonWizardFactory::destroyAllFactories();
removeObject(dd->m_welcomePage);
delete dd->m_welcomePage;
removeObject(this);
// Force sequence of deletion:
delete d->m_kitManager; // remove all the profile informations
delete d->m_toolChainManager;
delete dd->m_kitManager; // remove all the profile information
delete dd->m_toolChainManager;
ProjectPanelFactory::destroyFactories();
delete d;
delete dd;
}
ProjectExplorerPlugin *ProjectExplorerPlugin::instance()
......@@ -331,13 +343,6 @@ ProjectExplorerPlugin *ProjectExplorerPlugin::instance()
return m_instance;
}
bool ProjectExplorerPlugin::parseArguments(const QStringList &arguments, QString * /* error */)
{
CustomWizard::setVerbose(arguments.count(QLatin1String("-customwizard-verbose")));
JsonWizardFactory::setVerbose(arguments.count(QLatin1String("-customwizard-verbose")));
return true;
}
static QString variableValue(const char *variable)
{
QString projectName;
......@@ -359,11 +364,14 @@ static QString variableValue(const char *variable)
bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *error)
{
Q_UNUSED(error);
qRegisterMetaType<ProjectExplorer::RunControl *>();
qRegisterMetaType<ProjectExplorer::DeployableFile>("ProjectExplorer::DeployableFile");
if (!parseArguments(arguments, error))
return false;
CustomWizard::setVerbose(arguments.count(QLatin1String("-customwizard-verbose")));
JsonWizardFactory::setVerbose(arguments.count(QLatin1String("-customwizard-verbose")));
addObject(this);
addAutoReleasedObject(new DeviceManager);
......@@ -372,24 +380,24 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
#ifdef Q_OS_WIN
addAutoReleasedObject(new WinDebugInterface);
addAutoReleasedObject(new Internal::MsvcToolChainFactory);
addAutoReleasedObject(new Internal::WinCEToolChainFactory);
addAutoReleasedObject(new MsvcToolChainFactory);
addAutoReleasedObject(new WinCEToolChainFactory);
#else
addAutoReleasedObject(new Internal::LinuxIccToolChainFactory);
addAutoReleasedObject(new LinuxIccToolChainFactory);
#endif
#ifndef Q_OS_MAC
addAutoReleasedObject(new Internal::MingwToolChainFactory); // Mingw offers cross-compiling to windows
addAutoReleasedObject(new MingwToolChainFactory); // Mingw offers cross-compiling to windows
#endif
addAutoReleasedObject(new Internal::GccToolChainFactory);
addAutoReleasedObject(new Internal::ClangToolChainFactory);
addAutoReleasedObject(new Internal::CustomToolChainFactory);
addAutoReleasedObject(new GccToolChainFactory);
addAutoReleasedObject(new ClangToolChainFactory);
addAutoReleasedObject(new CustomToolChainFactory);
addAutoReleasedObject(new Internal::DesktopDeviceFactory);
addAutoReleasedObject(new DesktopDeviceFactory);
d->m_kitManager = new KitManager; // register before ToolChainManager
d->m_toolChainManager = new ToolChainManager;
dd->m_kitManager = new KitManager; // register before ToolChainManager
dd->m_toolChainManager = new ToolChainManager;
Core::IWizardFactory::registerFeatureProvider(new Internal::KitFeatureProvider);
Core::IWizardFactory::registerFeatureProvider(new KitFeatureProvider);
// Register KitInformation:
KitManager::registerKitInformation(new DeviceTypeKitInformation);
......@@ -398,16 +406,16 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
KitManager::registerKitInformation(new SysRootKitInformation);
KitManager::registerKitInformation(new EnvironmentKitInformation);
addAutoReleasedObject(new Internal::ToolChainOptionsPage);
addAutoReleasedObject(new ToolChainOptionsPage);
addAutoReleasedObject(new KitOptionsPage);
addAutoReleasedObject(new TaskHub);
connect(ICore::instance(), SIGNAL(newItemsDialogRequested()), this, SLOT(loadCustomWizards()));
d->m_welcomePage = new ProjectWelcomePage;
connect(d->m_welcomePage, SIGNAL(manageSessions()), this, SLOT(showSessionManager()));
addObject(d->m_welcomePage);
dd->m_welcomePage = new ProjectWelcomePage;
connect(dd->m_welcomePage, SIGNAL(manageSessions()), this, SLOT(showSessionManager()));
addObject(dd->m_welcomePage);
connect(DocumentManager::instance(), SIGNAL(currentFileChanged(QString)),
this, SLOT(setCurrentFile(QString)));
......@@ -442,16 +450,16 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
// For JsonWizard:
JsonWizardFactory::registerGeneratorFactory(new FileGeneratorFactory);
d->m_proWindow = new ProjectWindow;
addAutoReleasedObject(d->m_proWindow);
dd->m_proWindow = new ProjectWindow;
addAutoReleasedObject(dd->m_proWindow);
Context globalcontext(Core::Constants::C_GLOBAL);
Context projecTreeContext(Constants::C_PROJECT_TREE);
d->m_projectsMode = new ProjectsMode(d->m_proWindow);
d->m_projectsMode->setEnabled(false);
addAutoReleasedObject(d->m_projectsMode);
d->m_proWindow->layout()->addWidget(new FindToolBarPlaceHolder(d->m_proWindow));
dd->m_projectsMode = new ProjectsMode(dd->m_proWindow);
dd->m_projectsMode->setEnabled(false);
addAutoReleasedObject(dd->m_projectsMode);
dd->m_proWindow->layout()->addWidget(new FindToolBarPlaceHolder(dd->m_proWindow));
addAutoReleasedObject(new CopyTaskHandler);
addAutoReleasedObject(new ShowInEditorTaskHandler);
......@@ -462,14 +470,14 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
Constants::KITS_SETTINGS_PAGE_ID));
addAutoReleasedObject(new CoreListener);
d->m_outputPane = new AppOutputPane;
addAutoReleasedObject(d->m_outputPane);
dd->m_outputPane = new AppOutputPane;
addAutoReleasedObject(dd->m_outputPane);
connect(SessionManager::instance(), SIGNAL(projectRemoved(ProjectExplorer::Project*)),
d->m_outputPane, SLOT(projectRemoved()));
dd->m_outputPane, SLOT(projectRemoved()));
connect(d->m_outputPane, SIGNAL(runControlStarted(ProjectExplorer::RunControl*)),
connect(dd->m_outputPane, SIGNAL(runControlStarted(ProjectExplorer::RunControl*)),
this, SIGNAL(runControlStarted(ProjectExplorer::RunControl*)));
connect(d->m_outputPane, SIGNAL(runControlFinished(ProjectExplorer::RunControl*)),
connect(dd->m_outputPane, SIGNAL(runControlFinished(ProjectExplorer::RunControl*)),
this, SIGNAL(runControlFinished(ProjectExplorer::RunControl*)));
addAutoReleasedObject(new AllProjectsFilter);
......@@ -548,11 +556,11 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
ActionContainer *mfileContextMenu =
ActionManager::createMenu(Constants::M_FILECONTEXT);
d->m_sessionContextMenu = msessionContextMenu->menu();
d->m_projectMenu = mprojectContextMenu->menu();
d->m_subProjectMenu = msubProjectContextMenu->menu();
d->m_folderMenu = mfolderContextMenu->menu();
d->m_fileMenu = mfileContextMenu->menu();
dd->m_sessionContextMenu = msessionContextMenu->menu();
dd->m_projectMenu = mprojectContextMenu->menu();
dd->m_subProjectMenu = msubProjectContextMenu->menu();
dd->m_folderMenu = mfolderContextMenu->menu();
dd->m_fileMenu = mfileContextMenu->menu();
ActionContainer *mfile =
ActionManager::actionContainer(Core::Constants::M_FILE);
......@@ -629,10 +637,10 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
ActionContainer * const openWith =
ActionManager::createMenu(ProjectExplorer::Constants::M_OPENFILEWITHCONTEXT);
openWith->setOnAllDisabledBehavior(ActionContainer::Show);
d->m_openWithMenu = openWith->menu();
d->m_openWithMenu->setTitle(tr("Open With"));
dd->m_openWithMenu = openWith->menu();
dd->m_openWithMenu->setTitle(tr("Open With"));
connect(d->m_openWithMenu, SIGNAL(triggered(QAction*)),
connect(dd->m_openWithMenu, SIGNAL(triggered(QAction*)),
DocumentManager::instance(), SLOT(executeOpenWithMenuAction(QAction*)));
//
......@@ -658,41 +666,41 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
//
// new action
d->m_newAction = new QAction(tr("New Project..."), this);
cmd = ActionManager::registerAction(d->m_newAction, Constants::NEWPROJECT, globalcontext);
dd->m_newAction = new QAction(tr("New Project..."), this);
cmd = ActionManager::registerAction(dd->m_newAction, Constants::NEWPROJECT, globalcontext);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+N")));
msessionContextMenu->addAction(cmd, Constants::G_SESSION_FILES);
// open action
d->m_loadAction = new QAction(tr("Load Project..."), this);
cmd = ActionManager::registerAction(d->m_loadAction, Constants::LOAD, globalcontext);
dd->m_loadAction = new QAction(tr("Load Project..."), this);
cmd = ActionManager::registerAction(dd->m_loadAction, Constants::LOAD, globalcontext);
#ifndef Q_OS_MAC
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+O")));
#endif
msessionContextMenu->addAction(cmd, Constants::G_SESSION_FILES);
// Default open action
d->m_openFileAction = new QAction(tr("Open File"), this);
cmd = ActionManager::registerAction(d->m_openFileAction, ProjectExplorer::Constants::OPENFILE,
dd->m_openFileAction = new QAction(tr("Open File"), this);
cmd = ActionManager::registerAction(dd->m_openFileAction, ProjectExplorer::Constants::OPENFILE,
projecTreeContext);
mfileContextMenu->addAction(cmd, Constants::G_FILE_OPEN);
d->m_searchOnFileSystem = new QAction(FileUtils::msgFindInDirectory(), this);
cmd = ActionManager::registerAction(d->m_searchOnFileSystem, ProjectExplorer::Constants::SEARCHONFILESYSTEM, projecTreeContext);
dd->m_searchOnFileSystem = new QAction(FileUtils::msgFindInDirectory(), this);
cmd = ActionManager::registerAction(dd->m_searchOnFileSystem, ProjectExplorer::Constants::SEARCHONFILESYSTEM, projecTreeContext);
mfileContextMenu->addAction(cmd, Constants::G_FILE_OTHER);
mfolderContextMenu->addAction(cmd, Constants::G_FOLDER_CONFIG);
msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_LAST);
mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_LAST);
d->m_showInGraphicalShell = new QAction(FileUtils::msgGraphicalShellAction(), this);
cmd = ActionManager::registerAction(d->m_showInGraphicalShell, ProjectExplorer::Constants::SHOWINGRAPHICALSHELL,
dd->m_showInGraphicalShell = new QAction(FileUtils::msgGraphicalShellAction(), this);
cmd = ActionManager::registerAction(dd->m_showInGraphicalShell, ProjectExplorer::Constants::SHOWINGRAPHICALSHELL,
projecTreeContext);
mfileContextMenu->addAction(cmd, Constants::G_FILE_OPEN);
mfolderContextMenu->addAction(cmd, Constants::G_FOLDER_FILES);
d->m_openTerminalHere = new QAction(FileUtils::msgTerminalAction(), this);
cmd = ActionManager::registerAction(d->m_openTerminalHere, ProjectExplorer::Constants::OPENTERMIANLHERE,
dd->m_openTerminalHere = new QAction(FileUtils::msgTerminalAction(), this);
cmd = ActionManager::registerAction(dd->m_openTerminalHere, ProjectExplorer::Constants::OPENTERMIANLHERE,
projecTreeContext);
mfileContextMenu->addAction(cmd, Constants::G_FILE_OPEN);
mfolderContextMenu->addAction(cmd, Constants::G_FOLDER_FILES);
......@@ -714,23 +722,23 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
msession->menu()->setTitle(tr("Sessions"));
msession->setOnAllDisabledBehavior(ActionContainer::Show);
mfile->addMenu(msession, Core::Constants::G_FILE_OPEN);
d->m_sessionMenu = msession->menu();
dd->m_sessionMenu = msession->menu();
connect(mfile->menu(), SIGNAL(aboutToShow()),
this, SLOT(updateSessionMenu()));
// session manager action
d->m_sessionManagerAction = new QAction(tr("Session Manager..."), this);
cmd = ActionManager::registerAction(d->m_sessionManagerAction, Constants::NEWSESSION, globalcontext);
dd->m_sessionManagerAction = new QAction(tr("Session Manager..."), this);
cmd = ActionManager::registerAction(dd->m_sessionManagerAction, Constants::NEWSESSION, globalcontext);
mfile->addAction(cmd, Core::Constants::G_FILE_OPEN);
cmd->setDefaultKeySequence(QKeySequence());
// unload action
d->m_unloadAction = new Utils::ParameterAction(tr("Close Project"), tr("Close Project \"%1\""),
dd->m_unloadAction = new Utils::ParameterAction(tr("Close Project"), tr("Close Project \"%1\""),
Utils::ParameterAction::EnabledWithParameter, this);
cmd = ActionManager::registerAction(d->m_unloadAction, Constants::UNLOAD, globalcontext);
cmd = ActionManager::registerAction(dd->m_unloadAction, Constants::UNLOAD, globalcontext);
cmd->setAttribute(Command::CA_UpdateText);
cmd->setDescription(d->m_unloadAction->text());
cmd->setDescription(dd->m_unloadAction->text());
mfile->addAction(cmd, Core::Constants::G_FILE_PROJECT);
ActionContainer *munload =
......@@ -742,49 +750,49 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
this, SLOT(updateUnloadProjectMenu()));
// unload session action
d->m_closeAllProjects = new QAction(tr("Close All Projects and Editors"), this);
cmd = ActionManager::registerAction(d->m_closeAllProjects, Constants::CLEARSESSION, globalcontext);
dd->m_closeAllProjects = new QAction(tr("Close All Projects and Editors"), this);
cmd = ActionManager::registerAction(dd->m_closeAllProjects, Constants::CLEARSESSION, globalcontext);
mfile->addAction(cmd, Core::Constants::G_FILE_PROJECT);
msessionContextMenu->addAction(cmd, Constants::G_SESSION_FILES);
// build session action
QIcon buildIcon = QIcon(QLatin1String(Constants::ICON_BUILD));
buildIcon.addFile(QLatin1String(Constants::ICON_BUILD_SMALL));
d->m_buildSessionAction = new QAction(buildIcon, tr("Build All"), this);
cmd = ActionManager::registerAction(d->m_buildSessionAction, Constants::BUILDSESSION, globalcontext);
dd->m_buildSessionAction = new QAction(buildIcon, tr("Build All"), this);
cmd = ActionManager::registerAction(dd->m_buildSessionAction, Constants::BUILDSESSION, globalcontext);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+B")));
mbuild->addAction(cmd, Constants::G_BUILD_BUILD);
msessionContextMenu->addAction(cmd, Constants::G_SESSION_BUILD);
// deploy session
d->m_deploySessionAction = new QAction(tr("Deploy All"), this);
cmd = ActionManager::registerAction(d->m_deploySessionAction, Constants::DEPLOYSESSION, globalcontext);
dd->m_deploySessionAction = new QAction(tr("Deploy All"), this);
cmd = ActionManager::registerAction(dd->m_deploySessionAction, Constants::DEPLOYSESSION, globalcontext);
mbuild->addAction(cmd, Constants::G_BUILD_DEPLOY);
msessionContextMenu->addAction(cmd, Constants::G_SESSION_BUILD);
// rebuild session action
QIcon rebuildIcon = QIcon(QLatin1String(Constants::ICON_REBUILD));
rebuildIcon.addFile(QLatin1String(Constants::ICON_REBUILD_SMALL));
d->m_rebuildSessionAction = new QAction(rebuildIcon, tr("Rebuild All"), this);
cmd = ActionManager::registerAction(d->m_rebuildSessionAction, Constants::REBUILDSESSION, globalcontext);
dd->m_rebuildSessionAction = new QAction(rebuildIcon, tr("Rebuild All"), this);
cmd = ActionManager::registerAction(dd->m_rebuildSessionAction, Constants::REBUILDSESSION, globalcontext);
mbuild->addAction(cmd, Constants::G_BUILD_REBUILD);
msessionContextMenu->addAction(cmd, Constants::G_SESSION_REBUILD);
// clean session
QIcon cleanIcon = QIcon(QLatin1String(Constants::ICON_CLEAN));
cleanIcon.addFile(QLatin1String(Constants::ICON_CLEAN_SMALL));
d->m_cleanSessionAction = new QAction(cleanIcon, tr("Clean All"), this);
cmd = ActionManager::registerAction(d->m_cleanSessionAction, Constants::CLEANSESSION, globalcontext);