Q_UNUSED(newFilePath)
return false;
}
+
+QList<ProjectExplorer::RunConfiguration *> CMakeProjectNode::runConfigurationsFor(Node *node)
+{
+ Q_UNUSED(node)
+ return QList<ProjectExplorer::RunConfiguration *>();
+}
virtual bool renameFile(const ProjectExplorer::FileType fileType,
const QString &filePath,
const QString &newFilePath);
+ virtual QList<ProjectExplorer::RunConfiguration *> runConfigurationsFor(Node *node);
};
} // namespace Internal
Q_UNUSED(newFilePath)
return false;
}
+
+QList<ProjectExplorer::RunConfiguration *> GenericProjectNode::runConfigurationsFor(Node *node)
+{
+ Q_UNUSED(node)
+ return QList<ProjectExplorer::RunConfiguration *>();
+}
const QString &filePath,
const QString &newFilePath);
+ virtual QList<ProjectExplorer::RunConfiguration *> runConfigurationsFor(Node *node);
void refresh();
QAction *m_setStartupProjectAction;
QAction *m_projectSelectorAction;
QAction *m_projectSelectorActionMenu;
+ QAction *m_runSubProject;
Internal::ProjectWindow *m_proWindow;
SessionManager *m_session;
msubProjectContextMenu->appendGroup(Constants::G_PROJECT_FIRST);
msubProjectContextMenu->appendGroup(Constants::G_PROJECT_BUILD);
+ msubProjectContextMenu->appendGroup(Constants::G_PROJECT_RUN);
msubProjectContextMenu->appendGroup(Constants::G_PROJECT_FILES);
msubProjectContextMenu->appendGroup(Constants::G_PROJECT_OTHER);
msubProjectContextMenu->appendGroup(Constants::G_PROJECT_CONFIG);
+ Core::ActionContainer *runMenu = Core::ICore::instance()->actionManager()->createMenu(Constants::RUNMENUCONTEXTMENU);
+ runMenu->setOnAllDisabledBehavior(Core::ActionContainer::Hide);
+ QIcon runIcon(Constants::ICON_RUN);
+ runIcon.addFile(Constants::ICON_RUN_SMALL);
+ runMenu->menu()->setIcon(runIcon);
+ runMenu->menu()->setTitle("Run");
+ msubProjectContextMenu->addMenu(runMenu, ProjectExplorer::Constants::G_PROJECT_RUN);
+
mfolderContextMenu->appendGroup(Constants::G_FOLDER_FILES);
mfolderContextMenu->appendGroup(Constants::G_FOLDER_OTHER);
mfolderContextMenu->appendGroup(Constants::G_FOLDER_CONFIG);
cmd = am->registerAction(d->m_cleanProjectOnlyAction, Constants::CLEANPROJECTONLY, globalcontext);
// run action
- QIcon runIcon(Constants::ICON_RUN);
- runIcon.addFile(Constants::ICON_RUN_SMALL);
d->m_runAction = new QAction(runIcon, tr("Run"), this);
cmd = am->registerAction(d->m_runAction, Constants::RUN, globalcontext);
cmd->setAttribute(Core::Command::CA_UpdateText);
d->m_runActionContextMenu = new QAction(runIcon, tr("Run"), this);
cmd = am->registerAction(d->m_runActionContextMenu, Constants::RUNCONTEXTMENU, projecTreeContext);
mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_RUN);
+ msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_RUN);
// cancel build action
d->m_cancelBuildAction = new QAction(tr("Cancel Build"), this);
void ProjectExplorerPlugin::runProjectContextMenu()
{
- runProject(d->m_currentProject, ProjectExplorer::Constants::RUNMODE);
+ ProjectNode *projectNode = qobject_cast<ProjectNode*>(d->m_currentNode);
+ if (projectNode == d->m_currentProject->rootProjectNode() || !projectNode) {
+ runProject(d->m_currentProject, ProjectExplorer::Constants::RUNMODE);
+ } else {
+ QAction *act = qobject_cast<QAction *>(sender());
+ if (!act)
+ return;
+ RunConfiguration *rc = act->data().value<RunConfiguration *>();
+ if (!rc)
+ return;
+ runRunConfiguration(rc, ProjectExplorer::Constants::RUNMODE);
+ }
}
bool ProjectExplorerPlugin::hasBuildSettings(Project *pro)
return false;
}
-void ProjectExplorerPlugin::runProject(Project *pro, QString mode)
+void ProjectExplorerPlugin::runProject(Project *pro, const QString &mode)
{
if (!pro)
return;
- if (!pro->activeTarget()->activeRunConfiguration()->isEnabled())
+ runRunConfiguration(pro->activeTarget()->activeRunConfiguration(), mode);
+}
+
+void ProjectExplorerPlugin::runRunConfiguration(ProjectExplorer::RunConfiguration *rc, const QString &mode)
+{
+ if (!rc->isEnabled())
return;
QStringList stepIds;
stepIds << Constants::BUILDSTEPS_BUILD;
stepIds << Constants::BUILDSTEPS_DEPLOY;
}
+
+ Project *pro = rc->target()->project();
const QList<Project *> &projects = d->m_session->projectOrder(pro);
int queueCount = queue(projects, stepIds);
if (queueCount > 0) {
// delay running till after our queued steps were processed
d->m_runMode = mode;
- d->m_delayedRunConfiguration = pro->activeTarget()->activeRunConfiguration();
+ d->m_delayedRunConfiguration = rc;
} else {
- executeRunConfiguration(pro->activeTarget()->activeRunConfiguration(), mode);
+ executeRunConfiguration(rc, mode);
}
emit updateRunActions();
}
d->m_addExistingFilesAction->setVisible(true);
d->m_removeFileAction->setVisible(true);
d->m_deleteFileAction->setVisible(true);
+ d->m_runActionContextMenu->setVisible(false);
+
+ Core::ActionContainer *runMenu = Core::ICore::instance()->actionManager()->actionContainer(Constants::RUNMENUCONTEXTMENU);
+ runMenu->menu()->clear();
if (d->m_currentNode && d->m_currentNode->projectNode()) {
QList<ProjectNode::ProjectAction> actions =
d->m_currentNode->projectNode()->supportedActions(d->m_currentNode);
+ if (ProjectNode *pn = qobject_cast<ProjectNode *>(d->m_currentNode)) {
+ if (pn == d->m_currentProject->rootProjectNode()) {
+ d->m_runActionContextMenu->setVisible(true);
+ } else {
+ QList<RunConfiguration *> runConfigs = pn->runConfigurationsFor(pn);
+ if (runConfigs.count() == 1) {
+ d->m_runActionContextMenu->setVisible(true);
+ d->m_runActionContextMenu->setData(QVariant::fromValue(runConfigs.first()));
+ } else if (runConfigs.count() > 1) {
+ foreach (RunConfiguration *rc, runConfigs) {
+ QAction *act = new QAction(runMenu->menu());
+ act->setData(QVariant::fromValue(rc));
+ act->setText(QString("Run %1").arg(rc->displayName()));
+ runMenu->menu()->addAction(act);
+ connect(act, SIGNAL(triggered()),
+ this, SLOT(runProjectContextMenu()));
+ }
+ }
+ }
+ }
if (qobject_cast<FolderNode*>(d->m_currentNode)) {
+ // Also handles ProjectNode
d->m_addNewFileAction->setEnabled(actions.contains(ProjectNode::AddNewFile));
d->m_addNewSubprojectAction->setEnabled(d->m_currentNode->nodeType() == ProjectNodeType
&& actions.contains(ProjectNode::AddSubProject));
bool coreAboutToClose();
bool canRun(Project *pro, const QString &runMode);
- void runProject(Project *pro, QString mode);
+ void runProject(Project *pro, const QString &mode);
+ void runRunConfiguration(ProjectExplorer::RunConfiguration *rc, const QString &mode);
signals:
void aboutToShowContextMenu(ProjectExplorer::Project *project,
const char * const G_FILE_OTHER = "ProjectFile.Group.Other";
const char * const G_FILE_CONFIG = "ProjectFile.Group.Config";
+const char * const RUNMENUCONTEXTMENU = "Project.RunMenu";
+
// file id
const char * const FILE_FACTORY_ID = "ProjectExplorer.FileFactoryId";
#include <QtCore/QStringList>
#include <QtGui/QIcon>
+#include "runconfiguration.h"
#include "projectexplorer_export.h"
+
QT_BEGIN_NAMESPACE
class QFileInfo;
QT_END_NAMESPACE
// that a file was deleted
// DeleteFile is a define on windows...
EraseFile,
- Rename
+ Rename,
+ HasSubProjectRunConfigurations
};
// all subFolders that are projects
// by default returns false
virtual bool deploysFolder(const QString &folder) const;
+ // TODO node parameter not really needed
+ virtual QList<ProjectExplorer::RunConfiguration *> runConfigurationsFor(Node *node) = 0;
+
QList<NodesWatcher*> watchers() const;
void registerWatcher(NodesWatcher *watcher);
return true;
}
+QList<ProjectExplorer::RunConfiguration *> QmlProjectNode::runConfigurationsFor(Node *node)
+{
+ Q_UNUSED(node)
+ return QList<ProjectExplorer::RunConfiguration *>();
+}
+
} // namespace Internal
} // namespace QmlProjectManager
virtual bool renameFile(const ProjectExplorer::FileType fileType,
const QString &filePath,
const QString &newFilePath);
+ virtual QList<ProjectExplorer::RunConfiguration *> runConfigurationsFor(Node *node);
void refresh();
addRunConfiguration(new ProjectExplorer::CustomExecutableRunConfiguration(this));
}
}
+
+QList<ProjectExplorer::RunConfiguration *> Qt4DesktopTarget::runConfigurationsForNode(ProjectExplorer::Node *n)
+{
+ QList<ProjectExplorer::RunConfiguration *> result;
+ foreach (ProjectExplorer::RunConfiguration *rc, runConfigurations())
+ if (Qt4RunConfiguration *qt4c = qobject_cast<Qt4RunConfiguration *>(rc))
+ if (qt4c->proFilePath() == n->path())
+ result << rc;
+ return result;
+}
ProjectExplorer::DeployConfigurationFactory *deployConfigurationFactory() const;
void createApplicationProFiles();
+ QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Node *n);
static QString defaultDisplayName();
#include <QtCore/QStringList>
#include <QtGui/QWidget>
+#include <QtCore/QMetaType>
QT_BEGIN_NAMESPACE
class QCheckBox;
addRunConfiguration(new ProjectExplorer::CustomExecutableRunConfiguration(this));
}
}
+
+QList<ProjectExplorer::RunConfiguration *> Qt4SimulatorTarget::runConfigurationsForNode(ProjectExplorer::Node *n)
+{
+ QList<ProjectExplorer::RunConfiguration *> result;
+ foreach (ProjectExplorer::RunConfiguration *rc, runConfigurations())
+ if (Qt4RunConfiguration *qt4c = qobject_cast<Qt4RunConfiguration *>(rc))
+ if (qt4c->proFilePath() == n->path())
+ result << rc;
+ return result;
+}
ProjectExplorer::DeployConfigurationFactory *deployConfigurationFactory() const;
void createApplicationProFiles();
+ QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Node *n);
static QString defaultDisplayName();
}
}
+QList<ProjectExplorer::RunConfiguration *> AbstractQt4MaemoTarget::runConfigurationsForNode(ProjectExplorer::Node *n)
+{
+ QList<ProjectExplorer::RunConfiguration *> result;
+ foreach (ProjectExplorer::RunConfiguration *rc, runConfigurations())
+ if (MaemoRunConfiguration *mrc = qobject_cast<MaemoRunConfiguration *>(rc))
+ if (mrc->proFilePath() == n->path())
+ result << rc;
+ return result;
+}
+
QString AbstractQt4MaemoTarget::projectVersion(QString *error) const
{
QSharedPointer<QFile> changeLog = openFile(changeLogFilePath(),
ProjectExplorer::DeployConfigurationFactory *deployConfigurationFactory() const;
QString defaultBuildDirectory() const;
void createApplicationProFiles();
+ QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Node *n);
QString debianDirPath() const;
QStringList debianFiles() const;
}
}
+QList<ProjectExplorer::RunConfiguration *> Qt4SymbianTarget::runConfigurationsForNode(ProjectExplorer::Node *n)
+{
+ QList<ProjectExplorer::RunConfiguration *> result;
+ foreach (ProjectExplorer::RunConfiguration *rc, runConfigurations()) {
+ if (id() == QLatin1String(Constants::S60_EMULATOR_TARGET_ID)) {
+ if (S60EmulatorRunConfiguration * s60rc = qobject_cast<S60EmulatorRunConfiguration *>(rc))
+ if (s60rc->proFilePath() == n->path())
+ result << rc;
+ } else if (id() == QLatin1String(Constants::S60_DEVICE_TARGET_ID)) {
+ if (S60DeviceRunConfiguration *s60rc = qobject_cast<S60DeviceRunConfiguration *>(rc))
+ if (s60rc->proFilePath() == n->path())
+ result << rc;
+ }
+ }
+ return result;
+}
+
bool Qt4SymbianTarget::isSymbianConnectionAvailable(QString &tooltipText)
{
const S60DeployConfiguration *s60DeployConf = qobject_cast<S60DeployConfiguration *>(activeDeployConfiguration());
QString defaultBuildDirectory() const;
void createApplicationProFiles();
+ virtual QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Node *n);
static QString defaultDisplayName(const QString &id);
static QIcon iconForId(const QString &id);
return false;
}
+QList<ProjectExplorer::RunConfiguration *> Qt4PriFileNode::runConfigurationsFor(Node *node)
+{
+ return m_project->activeTarget()->runConfigurationsForNode(node);
+}
+
QList<ProjectNode::ProjectAction> Qt4PriFileNode::supportedActions(Node *node) const
{
QList<ProjectAction> actions;
if (fileNode && fileNode->fileType() != ProjectExplorer::ProjectFileType)
actions << Rename;
+ if (!m_project->activeTarget()->runConfigurationsForNode(node).isEmpty())
+ actions << HasSubProjectRunConfigurations;
+
return actions;
}
#include <coreplugin/ifile.h>
#include <projectexplorer/projectnodes.h>
#include <projectexplorer/project.h>
+#include <projectexplorer/runconfiguration.h>
#include <QtCore/QHash>
#include <QtCore/QStringList>
void folderChanged(const QString &changedFolder);
bool deploysFolder(const QString &folder) const;
+ QList<ProjectExplorer::RunConfiguration *> runConfigurationsFor(Node *node);
protected:
void clear();
bool validParse() const;
bool hasBuildTargets(Qt4ProjectType projectType) const;
+
public slots:
void asyncUpdate();
const char * const BUILDSUBDIR = "Qt4Builder.BuildSubDir";
const char * const REBUILDSUBDIR = "Qt4Builder.RebuildSubDir";
const char * const CLEANSUBDIR = "Qt4Builder.CleanSubDir";
+const char * const RUNSUBDIR = "Qt4Builder.RunSubDir";
+const char * const RUNMENUSUBDIR = "Qt4Builder.RunMenuSubDir";
const char * const ADDLIBRARY = "Qt4.AddLibrary";
const char * const JUMP_TO_FILE = "Qt4.JumpToFile";
const char * const SEPARATOR = "Qt4.Separator";
#endif
#include <QtCore/QtPlugin>
+#include <QtGui/QMenu>
using namespace Qt4ProjectManager::Internal;
using namespace Qt4ProjectManager;
#include "qt4buildconfiguration.h"
#include "qtversionmanager.h"
+
#include <projectexplorer/target.h>
+#include <projectexplorer/projectnodes.h>
namespace Qt4ProjectManager {
virtual QList<ProjectExplorer::ToolChainType> filterToolChainTypes(const QList<ProjectExplorer::ToolChainType> &candidates) const;
virtual ProjectExplorer::ToolChainType preferredToolChainType(const QList<ProjectExplorer::ToolChainType> &candidates) const;
virtual QString defaultBuildDirectory() const;
+
+ virtual QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Node *n) = 0;
signals:
void buildDirectoryInitialized();
/// emitted if the build configuration changed in a way that