diff --git a/src/plugins/analyzerbase/analyzerstartparameters.h b/src/plugins/analyzerbase/analyzerstartparameters.h
index e03f2e92d2a736eb7cfdf0d21e26ba0d31e87e34..3eab41f734ce48491d382749607cd2a7568981f2 100644
--- a/src/plugins/analyzerbase/analyzerstartparameters.h
+++ b/src/plugins/analyzerbase/analyzerstartparameters.h
@@ -36,10 +36,11 @@
 
 #include <QMetaType>
 
+#include <coreplugin/id.h>
 #include <ssh/sshconnection.h>
 #include <utils/environment.h>
-#include <projectexplorer/projectexplorerconstants.h>
 #include <projectexplorer/applicationlauncher.h>
+#include <projectexplorer/projectexplorerconstants.h>
 
 namespace Analyzer {
 
@@ -49,7 +50,7 @@ namespace Analyzer {
 class ANALYZER_EXPORT AnalyzerStartParameters
 {
 public:
-    ProjectExplorer::RunMode runMode;
+    Core::Id runMode = ProjectExplorer::Constants::NO_RUN_MODE;
     QSsh::SshConnectionParameters connParams;
     ProjectExplorer::ApplicationLauncher::Mode localRunMode
         = ProjectExplorer::ApplicationLauncher::Gui;
diff --git a/src/plugins/analyzerbase/ianalyzertool.h b/src/plugins/analyzerbase/ianalyzertool.h
index b87414bffda3d15347d30a7d4986180226bfd8c4..f7be88476fb9ca93854e7cd7dfb1eee30a9f7b46 100644
--- a/src/plugins/analyzerbase/ianalyzertool.h
+++ b/src/plugins/analyzerbase/ianalyzertool.h
@@ -86,8 +86,8 @@ public:
     void setToolId(Core::Id id) { m_toolId = id; }
     void setToolMode(ToolMode mode) { m_toolMode = mode; }
 
-    ProjectExplorer::RunMode runMode() const { return m_runMode; }
-    void setRunMode(ProjectExplorer::RunMode mode) { m_runMode = mode; }
+    Core::Id runMode() const { return m_runMode; }
+    void setRunMode(Core::Id mode) { m_runMode = mode; }
     bool isRunnable(QString *reason = 0) const;
 
     /// Creates all widgets used by the tool.
@@ -119,7 +119,7 @@ protected:
     Core::Id m_actionId;
     Core::Id m_toolId;
     ToolMode m_toolMode;
-    ProjectExplorer::RunMode m_runMode;
+    Core::Id m_runMode;
     WidgetCreator m_widgetCreator;
     RunControlCreator m_runControlCreator;
     ToolStarter m_customToolStarter;
diff --git a/src/plugins/android/androidanalyzesupport.cpp b/src/plugins/android/androidanalyzesupport.cpp
index 6978424218bbd72fe1b5d0c60ce0f91e329aed2f..ff0dd9af9e6f8c5c831f7e76dca96d5e3259af52 100644
--- a/src/plugins/android/androidanalyzesupport.cpp
+++ b/src/plugins/android/androidanalyzesupport.cpp
@@ -52,7 +52,7 @@ namespace Android {
 namespace Internal {
 
 RunControl *AndroidAnalyzeSupport::createAnalyzeRunControl(AndroidRunConfiguration *runConfig,
-                                                           RunMode runMode)
+                                                           Core::Id runMode)
 {
     Target *target = runConfig->target();
     AnalyzerStartParameters params;
@@ -61,7 +61,7 @@ RunControl *AndroidAnalyzeSupport::createAnalyzeRunControl(AndroidRunConfigurati
     params.sysroot = SysRootKitInformation::sysRoot(target->kit()).toString();
     // TODO: Not sure if these are the right paths.
     params.workingDirectory = target->project()->projectDirectory().toString();
-    if (runMode == QmlProfilerRunMode) {
+    if (runMode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE) {
         QTcpServer server;
         QTC_ASSERT(server.listen(QHostAddress::LocalHost)
                    || server.listen(QHostAddress::LocalHostIPv6), return 0);
diff --git a/src/plugins/android/androidanalyzesupport.h b/src/plugins/android/androidanalyzesupport.h
index 469dc7193d94b1769ae9fcff7d13da045f806e31..610be9a1e46ba27dfd5a230756e60a982853a152 100644
--- a/src/plugins/android/androidanalyzesupport.h
+++ b/src/plugins/android/androidanalyzesupport.h
@@ -51,7 +51,7 @@ public:
         Analyzer::AnalyzerRunControl *runControl);
 
     static ProjectExplorer::RunControl *createAnalyzeRunControl(AndroidRunConfiguration *runConfig,
-                                                                ProjectExplorer::RunMode runMode);
+                                                                Core::Id runMode);
 
 private:
     QmlDebug::QmlOutputParser m_outputParser;
diff --git a/src/plugins/android/androidruncontrol.cpp b/src/plugins/android/androidruncontrol.cpp
index 8a0bf3155a42821e198c65e67f8f99470e55f159..41893846e2d6cfdc67de452557fb9c138a32e8b9 100644
--- a/src/plugins/android/androidruncontrol.cpp
+++ b/src/plugins/android/androidruncontrol.cpp
@@ -42,8 +42,8 @@ namespace Android {
 namespace Internal {
 
 AndroidRunControl::AndroidRunControl(AndroidRunConfiguration *rc)
-    : RunControl(rc, NormalRunMode)
-    , m_runner(new AndroidRunner(this, rc, NormalRunMode))
+    : RunControl(rc, ProjectExplorer::Constants::NORMAL_RUN_MODE)
+    , m_runner(new AndroidRunner(this, rc, ProjectExplorer::Constants::NORMAL_RUN_MODE))
     , m_running(false)
 {
     setIcon(QLatin1String(ProjectExplorer::Constants::ICON_RUN_SMALL));
diff --git a/src/plugins/android/androidrunfactories.cpp b/src/plugins/android/androidrunfactories.cpp
index 7e8673aa6a07747d3d3afad7491e72c055c328fa..a0a5e1cf3f9cf4dac21cfb67777b142a42f285bb 100644
--- a/src/plugins/android/androidrunfactories.cpp
+++ b/src/plugins/android/androidrunfactories.cpp
@@ -56,35 +56,30 @@ AndroidRunControlFactory::AndroidRunControlFactory(QObject *parent)
 {
 }
 
-bool AndroidRunControlFactory::canRun(RunConfiguration *runConfiguration, RunMode mode) const
+bool AndroidRunControlFactory::canRun(RunConfiguration *runConfiguration, Core::Id mode) const
 {
-    if (mode != NormalRunMode && mode != DebugRunMode && mode != QmlProfilerRunMode)
+    if (mode != ProjectExplorer::Constants::NORMAL_RUN_MODE
+            && mode != ProjectExplorer::Constants::DEBUG_RUN_MODE
+            && mode != ProjectExplorer::Constants::DEBUG_RUN_MODE_WITH_BREAK_ON_MAIN
+            && mode != ProjectExplorer::Constants::QML_PROFILER_RUN_MODE) {
         return false;
+    }
     return qobject_cast<AndroidRunConfiguration *>(runConfiguration);
 }
 
 RunControl *AndroidRunControlFactory::create(RunConfiguration *runConfig,
-                                        RunMode mode, QString *errorMessage)
+                                        Core::Id mode, QString *errorMessage)
 {
     Q_ASSERT(canRun(runConfig, mode));
     AndroidRunConfiguration *rc = qobject_cast<AndroidRunConfiguration *>(runConfig);
     Q_ASSERT(rc);
-    switch (mode) {
-    case NormalRunMode:
+    if (mode == ProjectExplorer::Constants::NORMAL_RUN_MODE)
         return new AndroidRunControl(rc);
-    case DebugRunMode:
+    if (mode == ProjectExplorer::Constants::DEBUG_RUN_MODE || mode == ProjectExplorer::Constants::DEBUG_RUN_MODE_WITH_BREAK_ON_MAIN)
         return AndroidDebugSupport::createDebugRunControl(rc, errorMessage);
-    case QmlProfilerRunMode:
+    if (mode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE)
         return AndroidAnalyzeSupport::createAnalyzeRunControl(rc, mode);
-    case NoRunMode:
-    case DebugRunModeWithBreakOnMain:
-    case CallgrindRunMode:
-    case MemcheckRunMode:
-    case MemcheckWithGdbRunMode:
-    case ClangStaticAnalyzerMode:
-    case PerfProfilerRunMode:
-        QTC_CHECK(false); // The other run modes are not supported
-    }
+    QTC_CHECK(false); // The other run modes are not supported
     return 0;
 }
 
diff --git a/src/plugins/android/androidrunfactories.h b/src/plugins/android/androidrunfactories.h
index ec3503c15188e3c53355c91b6d15e30186293013..b2940fd93c00c31f9d8f07bd6334b5bc730c0069 100644
--- a/src/plugins/android/androidrunfactories.h
+++ b/src/plugins/android/androidrunfactories.h
@@ -53,9 +53,9 @@ public:
     explicit AndroidRunControlFactory(QObject *parent = 0);
 
     bool canRun(ProjectExplorer::RunConfiguration *runConfiguration,
-                ProjectExplorer::RunMode mode) const;
+                Core::Id mode) const;
     ProjectExplorer::RunControl *create(ProjectExplorer::RunConfiguration *runConfiguration,
-                       ProjectExplorer::RunMode mode,
+                       Core::Id mode,
                        QString *errorMessage);
 };
 
diff --git a/src/plugins/android/androidrunner.cpp b/src/plugins/android/androidrunner.cpp
index c525440c0f41e59a6be4abb98848ac17bba393ab..c530d008cfbf65dddd772dc4935a68f5d9d8531f 100644
--- a/src/plugins/android/androidrunner.cpp
+++ b/src/plugins/android/androidrunner.cpp
@@ -125,21 +125,21 @@ static int socketHandShakePort = MIN_SOCKET_HANDSHAKE_PORT;
 
 AndroidRunner::AndroidRunner(QObject *parent,
                              AndroidRunConfiguration *runConfig,
-                             ProjectExplorer::RunMode runMode)
+                             Core::Id runMode)
     : QThread(parent), m_handShakeMethod(SocketHandShake), m_socket(0),
       m_customPort(false)
 {
     m_tries = 0;
     Debugger::DebuggerRunConfigurationAspect *aspect
             = runConfig->extraAspect<Debugger::DebuggerRunConfigurationAspect>();
-    const bool debuggingMode = runMode == ProjectExplorer::DebugRunMode;
+    const bool debuggingMode = (runMode == ProjectExplorer::Constants::DEBUG_RUN_MODE || runMode == ProjectExplorer::Constants::DEBUG_RUN_MODE_WITH_BREAK_ON_MAIN);
     m_useCppDebugger = debuggingMode && aspect->useCppDebugger();
     m_useQmlDebugger = debuggingMode && aspect->useQmlDebugger();
     QString channel = runConfig->remoteChannel();
     QTC_CHECK(channel.startsWith(QLatin1Char(':')));
     m_localGdbServerPort = channel.mid(1).toUShort();
     QTC_CHECK(m_localGdbServerPort);
-    m_useQmlProfiler = runMode == ProjectExplorer::QmlProfilerRunMode;
+    m_useQmlProfiler = runMode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE;
     if (m_useQmlDebugger || m_useQmlProfiler) {
         QTcpServer server;
         QTC_ASSERT(server.listen(QHostAddress::LocalHost)
diff --git a/src/plugins/android/androidrunner.h b/src/plugins/android/androidrunner.h
index 8f6c40d5739e9bbc7e6906bba178993f103b3bf3..8bf90f4e8a213b2b042f42fb2a7e090847313e3d 100644
--- a/src/plugins/android/androidrunner.h
+++ b/src/plugins/android/androidrunner.h
@@ -33,7 +33,7 @@
 
 #include "androidconfigurations.h"
 
-#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/runconfiguration.h>
 
 #include <QObject>
 #include <QTimer>
@@ -58,7 +58,7 @@ class AndroidRunner : public QThread
 
 public:
     AndroidRunner(QObject *parent, AndroidRunConfiguration *runConfig,
-                  ProjectExplorer::RunMode runMode);
+                  Core::Id runMode);
     ~AndroidRunner();
 
     QString displayName() const;
diff --git a/src/plugins/baremetal/baremetalruncontrolfactory.cpp b/src/plugins/baremetal/baremetalruncontrolfactory.cpp
index 7dd2fb7edfe8b4e8c146d3605770a168d8f2b3ff..8a4cb36278e8d8f070cb1144acdbf9244110f53b 100644
--- a/src/plugins/baremetal/baremetalruncontrolfactory.cpp
+++ b/src/plugins/baremetal/baremetalruncontrolfactory.cpp
@@ -71,17 +71,20 @@ BareMetalRunControlFactory::~BareMetalRunControlFactory()
 {
 }
 
-bool BareMetalRunControlFactory::canRun(RunConfiguration *runConfiguration, RunMode mode) const
+bool BareMetalRunControlFactory::canRun(RunConfiguration *runConfiguration, Core::Id mode) const
 {
-    if (mode != NormalRunMode && mode != DebugRunMode && mode != DebugRunModeWithBreakOnMain)
+    if (mode != ProjectExplorer::Constants::NORMAL_RUN_MODE
+            && mode != ProjectExplorer::Constants::DEBUG_RUN_MODE
+            && mode != ProjectExplorer::Constants::DEBUG_RUN_MODE_WITH_BREAK_ON_MAIN) {
         return false;
+    }
 
     const QByteArray idStr = runConfiguration->id().name();
     return runConfiguration->isEnabled() && idStr.startsWith(BareMetalRunConfiguration::IdPrefix);
 }
 
 RunControl *BareMetalRunControlFactory::create(
-        RunConfiguration *runConfiguration, RunMode mode, QString *errorMessage)
+        RunConfiguration *runConfiguration, Core::Id mode, QString *errorMessage)
 {
     QTC_ASSERT(canRun(runConfiguration, mode), return 0);
 
diff --git a/src/plugins/baremetal/baremetalruncontrolfactory.h b/src/plugins/baremetal/baremetalruncontrolfactory.h
index 68f5e15645a30107b49a369cec685dbd31cd7234..55d8f4d98eaf36bad232da42cc985203581d3580 100644
--- a/src/plugins/baremetal/baremetalruncontrolfactory.h
+++ b/src/plugins/baremetal/baremetalruncontrolfactory.h
@@ -47,9 +47,9 @@ class BareMetalRunControlFactory : public ProjectExplorer::IRunControlFactory
 public:
     explicit BareMetalRunControlFactory(QObject *parent = 0);
     ~BareMetalRunControlFactory();
-    bool canRun(ProjectExplorer::RunConfiguration *runConfiguration, ProjectExplorer::RunMode mode) const;
+    bool canRun(ProjectExplorer::RunConfiguration *runConfiguration, Core::Id mode) const;
     ProjectExplorer::RunControl *create(ProjectExplorer::RunConfiguration *runConfiguration,
-                                        ProjectExplorer::RunMode mode,
+                                        Core::Id mode,
                                         QString *errorMessage);
 };
 
diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index 261bbfb2a84ca8aefc9253ec763b2e9f597b69c4..a79bef2e8c56b41c424f18e985fb2f3999376959 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -810,7 +810,7 @@ public slots:
     void handleExecStep()
     {
         if (currentEngine()->state() == DebuggerNotReady) {
-            ProjectExplorerPlugin::runStartupProject(DebugRunModeWithBreakOnMain);
+            ProjectExplorerPlugin::runStartupProject(ProjectExplorer::Constants::DEBUG_RUN_MODE_WITH_BREAK_ON_MAIN);
         } else {
             currentEngine()->resetLocation();
             if (boolSetting(OperateByInstruction))
@@ -823,7 +823,7 @@ public slots:
     void handleExecNext()
     {
         if (currentEngine()->state() == DebuggerNotReady) {
-            ProjectExplorerPlugin::runStartupProject(DebugRunModeWithBreakOnMain);
+            ProjectExplorerPlugin::runStartupProject(ProjectExplorer::Constants::DEBUG_RUN_MODE_WITH_BREAK_ON_MAIN);
         } else {
             currentEngine()->resetLocation();
             if (boolSetting(OperateByInstruction))
@@ -1306,7 +1306,7 @@ void DebuggerPluginPrivate::onCurrentProjectChanged(Project *project)
     m_continueAction->setEnabled(false);
     m_exitAction->setEnabled(false);
     QString whyNot;
-    const bool canRun = ProjectExplorerPlugin::canRun(project, DebugRunMode, &whyNot);
+    const bool canRun = ProjectExplorerPlugin::canRun(project, ProjectExplorer::Constants::DEBUG_RUN_MODE, &whyNot);
     m_startAction->setEnabled(canRun);
     m_startAction->setToolTip(whyNot);
     m_debugWithoutDeployAction->setEnabled(canRun);
@@ -1978,7 +1978,7 @@ void DebuggerPluginPrivate::updateState(DebuggerEngine *engine)
         m_localsAndExpressionsWindow->setShowLocals(false);
     } else if (state == DebuggerFinished) {
         Project *project = SessionManager::startupProject();
-        const bool canRun = ProjectExplorerPlugin::canRun(project, DebugRunMode);
+        const bool canRun = ProjectExplorerPlugin::canRun(project, ProjectExplorer::Constants::DEBUG_RUN_MODE);
         // We don't want to do anything anymore.
         m_interruptAction->setEnabled(false);
         m_continueAction->setEnabled(false);
@@ -2080,7 +2080,7 @@ void DebuggerPluginPrivate::updateDebugActions()
 
     Project *project = SessionManager::startupProject();
     QString whyNot;
-    const bool canRun = ProjectExplorerPlugin::canRun(project, DebugRunMode, &whyNot);
+    const bool canRun = ProjectExplorerPlugin::canRun(project, ProjectExplorer::Constants::DEBUG_RUN_MODE, &whyNot);
     m_startAction->setEnabled(canRun);
     m_startAction->setToolTip(whyNot);
     m_debugWithoutDeployAction->setEnabled(canRun);
@@ -2089,7 +2089,7 @@ void DebuggerPluginPrivate::updateDebugActions()
     if (m_snapshotHandler->currentIndex() < 0) {
         QString toolTip;
         const bool canRunAndBreakMain
-                = ProjectExplorerPlugin::canRun(project, DebugRunModeWithBreakOnMain, &toolTip);
+                = ProjectExplorerPlugin::canRun(project, ProjectExplorer::Constants::DEBUG_RUN_MODE_WITH_BREAK_ON_MAIN, &toolTip);
         m_stepAction->setEnabled(canRunAndBreakMain);
         m_nextAction->setEnabled(canRunAndBreakMain);
         if (canRunAndBreakMain) {
@@ -2592,11 +2592,11 @@ void DebuggerPluginPrivate::extensionsInitialized()
     debuggerIcon.addFile(QLatin1String(":/projectexplorer/images/debugger_start.png"));
     act->setIcon(debuggerIcon);
     act->setText(tr("Start Debugging"));
-    connect(act, &QAction::triggered, [] { ProjectExplorerPlugin::runStartupProject(DebugRunMode); });
+    connect(act, &QAction::triggered, [] { ProjectExplorerPlugin::runStartupProject(ProjectExplorer::Constants::DEBUG_RUN_MODE); });
 
     act = m_debugWithoutDeployAction = new QAction(this);
     act->setText(tr("Start Debugging Without Deployment"));
-    connect(act, &QAction::triggered, [] { ProjectExplorerPlugin::runStartupProject(DebugRunMode, true); });
+    connect(act, &QAction::triggered, [] { ProjectExplorerPlugin::runStartupProject(ProjectExplorer::Constants::DEBUG_RUN_MODE, true); });
 
     act = m_startAndDebugApplicationAction = new QAction(this);
     act->setText(tr("Start and Debug External Application..."));
diff --git a/src/plugins/debugger/debuggerruncontrol.cpp b/src/plugins/debugger/debuggerruncontrol.cpp
index b2e41532aa96a53b93b49e7ee10dedb02bc1a77c..b02ddb7291c1b14d8a822524194bbac57e781d7e 100644
--- a/src/plugins/debugger/debuggerruncontrol.cpp
+++ b/src/plugins/debugger/debuggerruncontrol.cpp
@@ -70,6 +70,9 @@ namespace Debugger {
 namespace Internal {
 
 DebuggerEngine *createCdbEngine(const DebuggerRunParameters &rp, QStringList *error);
+const auto *DebugRunMode = ProjectExplorer::Constants::DEBUG_RUN_MODE;
+const auto *DebugRunModeWithBreakOnMain = ProjectExplorer::Constants::DEBUG_RUN_MODE_WITH_BREAK_ON_MAIN;
+
 DebuggerEngine *createGdbEngine(const DebuggerRunParameters &rp);
 DebuggerEngine *createPdbEngine(const DebuggerRunParameters &rp);
 DebuggerEngine *createQmlEngine(const DebuggerRunParameters &rp);
@@ -295,7 +298,7 @@ public:
     // detectable pieces, construct an Engine and a RunControl.
     void initialize(const DebuggerStartParameters &sp);
     void enrich(const RunConfiguration *runConfig, const Kit *kit);
-    void createRunControl(RunMode runMode);
+    void createRunControl(Core::Id runMode = DebugRunMode);
     QString fullError() const { return m_errors.join(QLatin1Char('\n')); }
 
     // Result.
@@ -536,7 +539,7 @@ DebuggerEngine *createEngine(DebuggerEngineType et, const DebuggerRunParameters
     return 0;
 }
 
-void DebuggerRunControlCreator::createRunControl(RunMode runMode)
+void DebuggerRunControlCreator::createRunControl(Core::Id runMode)
 {
     if (runMode == DebugRunModeWithBreakOnMain)
         m_rp.breakOnMain = true;
@@ -569,7 +572,7 @@ public:
     {}
 
     RunControl *create(RunConfiguration *runConfig,
-                       RunMode mode, QString *errorMessage) override
+                       Core::Id mode, QString *errorMessage) override
     {
         QTC_ASSERT(runConfig, return 0);
         QTC_ASSERT(mode == DebugRunMode || mode == DebugRunModeWithBreakOnMain, return 0);
@@ -584,7 +587,7 @@ public:
         return creator.m_runControl;
     }
 
-    bool canRun(RunConfiguration *runConfig, RunMode mode) const override
+    bool canRun(RunConfiguration *runConfig, Core::Id mode) const override
     {
         return (mode == DebugRunMode || mode == DebugRunModeWithBreakOnMain)
                 && qobject_cast<LocalApplicationRunConfiguration *>(runConfig);
@@ -633,7 +636,7 @@ DebuggerRunControl *createAndScheduleRun(const DebuggerRunParameters &rp, const
 DebuggerRunControl *createDebuggerRunControl(const DebuggerStartParameters &sp,
                                              RunConfiguration *runConfig,
                                              QString *errorMessage,
-                                             RunMode runMode)
+                                             Core::Id runMode)
 {
     DebuggerRunControlCreator creator;
     creator.initialize(sp);
diff --git a/src/plugins/debugger/debuggerruncontrol.h b/src/plugins/debugger/debuggerruncontrol.h
index 00b27b6165bcdd6ce659002f2c48be1ae9e0bd35..f7b8e8503828b6c7b780a6efb786d08cb601f89f 100644
--- a/src/plugins/debugger/debuggerruncontrol.h
+++ b/src/plugins/debugger/debuggerruncontrol.h
@@ -50,7 +50,7 @@ class DebuggerRunControlCreator;
 DEBUGGER_EXPORT DebuggerRunControl *createDebuggerRunControl(const DebuggerStartParameters &sp,
                                                              ProjectExplorer::RunConfiguration *runConfig,
                                                              QString *errorMessage,
-                                                             ProjectExplorer::RunMode runMode = ProjectExplorer::DebugRunMode);
+                                                             Core::Id runMode = ProjectExplorer::Constants::DEBUG_RUN_MODE);
 
 class DEBUGGER_EXPORT DebuggerRunControl
     : public ProjectExplorer::RunControl
diff --git a/src/plugins/ios/iosanalyzesupport.cpp b/src/plugins/ios/iosanalyzesupport.cpp
index 9f5bb0000d6b19749f007414c161de02bd571ee1..ce593c9b94d9cbdf21f56159abcf4f29e1b0cdb2 100644
--- a/src/plugins/ios/iosanalyzesupport.cpp
+++ b/src/plugins/ios/iosanalyzesupport.cpp
@@ -84,7 +84,7 @@ RunControl *IosAnalyzeSupport::createAnalyzeRunControl(IosRunConfiguration *runC
     if (device.isNull())
         return 0;
     AnalyzerStartParameters params;
-    params.runMode = QmlProfilerRunMode;
+    params.runMode = ProjectExplorer::Constants::QML_PROFILER_RUN_MODE;
     params.sysroot = SysRootKitInformation::sysRoot(target->kit()).toString();
     params.debuggee = runConfig->localExecutable().toUserOutput();
     params.debuggeeArgs = Utils::QtcProcess::joinArgs(runConfig->commandLineArguments());
diff --git a/src/plugins/ios/iosruncontrol.cpp b/src/plugins/ios/iosruncontrol.cpp
index 3144574e3e46baa2963ea89d76f319d8383cb642..7edeb14661f1e07becac57eac56315b09b0e7ea5 100644
--- a/src/plugins/ios/iosruncontrol.cpp
+++ b/src/plugins/ios/iosruncontrol.cpp
@@ -41,7 +41,7 @@ namespace Ios {
 namespace Internal {
 
 IosRunControl::IosRunControl(IosRunConfiguration *rc)
-    : RunControl(rc, NormalRunMode)
+    : RunControl(rc, ProjectExplorer::Constants::NORMAL_RUN_MODE)
     , m_runner(new IosRunner(this, rc, false, false))
     , m_running(false)
 {
diff --git a/src/plugins/ios/iosrunfactories.cpp b/src/plugins/ios/iosrunfactories.cpp
index f267153905096dd2d18fbfe22b8ac5fcb0b65511..a160e3d53ddd6d48f6686511c50fd97c21de82e8 100644
--- a/src/plugins/ios/iosrunfactories.cpp
+++ b/src/plugins/ios/iosrunfactories.cpp
@@ -159,16 +159,20 @@ IosRunControlFactory::IosRunControlFactory(QObject *parent)
 }
 
 bool IosRunControlFactory::canRun(RunConfiguration *runConfiguration,
-                RunMode mode) const
+                Core::Id mode) const
 {
-    if (mode != NormalRunMode && mode != DebugRunMode && mode != QmlProfilerRunMode
-            && mode != DebugRunModeWithBreakOnMain)
+    if (mode != ProjectExplorer::Constants::NORMAL_RUN_MODE
+            && mode != ProjectExplorer::Constants::DEBUG_RUN_MODE
+            && mode != ProjectExplorer::Constants::DEBUG_RUN_MODE_WITH_BREAK_ON_MAIN
+            && mode != ProjectExplorer::Constants::QML_PROFILER_RUN_MODE) {
         return false;
+    }
+
     return qobject_cast<IosRunConfiguration *>(runConfiguration);
 }
 
 RunControl *IosRunControlFactory::create(RunConfiguration *runConfig,
-                                        RunMode mode, QString *errorMessage)
+                                        Core::Id mode, QString *errorMessage)
 {
     Q_ASSERT(canRun(runConfig, mode));
     IosRunConfiguration *rc = qobject_cast<IosRunConfiguration *>(runConfig);
@@ -181,9 +185,9 @@ RunControl *IosRunControlFactory::create(RunConfiguration *runConfig,
             activeRunControl->stop();
         m_activeRunControls.remove(devId);
     }
-    if (mode == NormalRunMode)
+    if (mode == ProjectExplorer::Constants::NORMAL_RUN_MODE)
         res = new Ios::Internal::IosRunControl(rc);
-    else if (mode == QmlProfilerRunMode)
+    else if (mode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE)
         res = IosAnalyzeSupport::createAnalyzeRunControl(rc, errorMessage);
     else
         res = IosDebugSupport::createDebugRunControl(rc, errorMessage);
diff --git a/src/plugins/ios/iosrunfactories.h b/src/plugins/ios/iosrunfactories.h
index 51b566c294dc3a2f13190de4f51e3f4ab55ff7a6..79238c741c22cde6afc3f579ced074ab473f0857 100644
--- a/src/plugins/ios/iosrunfactories.h
+++ b/src/plugins/ios/iosrunfactories.h
@@ -81,9 +81,9 @@ public:
     explicit IosRunControlFactory(QObject *parent = 0);
 
     bool canRun(ProjectExplorer::RunConfiguration *runConfiguration,
-                ProjectExplorer::RunMode mode) const override;
+                Core::Id mode) const override;
     ProjectExplorer::RunControl *create(ProjectExplorer::RunConfiguration *runConfiguration,
-                       ProjectExplorer::RunMode mode,
+                       Core::Id mode,
                        QString *errorMessage) override;
 private:
     mutable QMap<Core::Id, QPointer<ProjectExplorer::RunControl> > m_activeRunControls;
diff --git a/src/plugins/projectexplorer/localapplicationruncontrol.cpp b/src/plugins/projectexplorer/localapplicationruncontrol.cpp
index a1596b34b99bf3948129fb231b6207f0f3869859..1ce1869c7c756a13d87876b08d4a42a99af93fb8 100644
--- a/src/plugins/projectexplorer/localapplicationruncontrol.cpp
+++ b/src/plugins/projectexplorer/localapplicationruncontrol.cpp
@@ -48,12 +48,12 @@ LocalApplicationRunControlFactory::~LocalApplicationRunControlFactory()
 {
 }
 
-bool LocalApplicationRunControlFactory::canRun(RunConfiguration *runConfiguration, RunMode mode) const
+bool LocalApplicationRunControlFactory::canRun(RunConfiguration *runConfiguration, Core::Id mode) const
 {
-    return mode == NormalRunMode && qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration);
+    return mode == Constants::NORMAL_RUN_MODE && qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration);
 }
 
-RunControl *LocalApplicationRunControlFactory::create(RunConfiguration *runConfiguration, RunMode mode, QString *errorMessage)
+RunControl *LocalApplicationRunControlFactory::create(RunConfiguration *runConfiguration, Core::Id mode, QString *errorMessage)
 {
     Q_UNUSED(errorMessage)
     QTC_ASSERT(canRun(runConfiguration, mode), return 0);
@@ -72,7 +72,7 @@ RunControl *LocalApplicationRunControlFactory::create(RunConfiguration *runConfi
 
 // ApplicationRunControl
 
-LocalApplicationRunControl::LocalApplicationRunControl(RunConfiguration *rc, RunMode mode)
+LocalApplicationRunControl::LocalApplicationRunControl(RunConfiguration *rc, Core::Id mode)
     : RunControl(rc, mode), m_runMode(ApplicationLauncher::Console), m_running(false)
 {
     setIcon(QLatin1String(Constants::ICON_RUN_SMALL));
diff --git a/src/plugins/projectexplorer/localapplicationruncontrol.h b/src/plugins/projectexplorer/localapplicationruncontrol.h
index dca6a02dd36dfc99803f3f4b35b874ef8c19978f..40cd52439faf5273be200e8a50856c245bf7a769 100644
--- a/src/plugins/projectexplorer/localapplicationruncontrol.h
+++ b/src/plugins/projectexplorer/localapplicationruncontrol.h
@@ -43,8 +43,8 @@ class LocalApplicationRunControlFactory : public IRunControlFactory
 public:
     LocalApplicationRunControlFactory ();
     ~LocalApplicationRunControlFactory();
-    bool canRun(RunConfiguration *runConfiguration, RunMode mode) const;
-    RunControl* create(RunConfiguration *runConfiguration, RunMode mode, QString *errorMessage);
+    bool canRun(RunConfiguration *runConfiguration, Core::Id mode) const;
+    RunControl* create(RunConfiguration *runConfiguration, Core::Id mode, QString *errorMessage);
 };
 
 } // namespace Internal
@@ -53,7 +53,7 @@ class PROJECTEXPLORER_EXPORT LocalApplicationRunControl : public RunControl
 {
     Q_OBJECT
 public:
-    LocalApplicationRunControl(RunConfiguration *runConfiguration, RunMode mode);
+    LocalApplicationRunControl(RunConfiguration *runConfiguration, Core::Id mode);
     ~LocalApplicationRunControl();
     void start();
     StopResult stop();
diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index ded797906da2e1ab72ce2e6bd8b3648c0a1cc95b..3bfd73b1e16b28efd8514c40e8590055ace84f85 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -203,12 +203,12 @@ public:
     void deploy(QList<Project *>);
     int queue(QList<Project *>, QList<Id> stepIds);
     void updateContextMenuActions();
-    void executeRunConfiguration(RunConfiguration *, RunMode mode);
+    void executeRunConfiguration(RunConfiguration *, Core::Id mode);
     QPair<bool, QString> buildSettingsEnabledForSession();
     QPair<bool, QString> buildSettingsEnabled(Project *pro);
 
     void addToRecentProjects(const QString &fileName, const QString &displayName);
-    void startRunControl(RunControl *runControl, RunMode runMode);
+    void startRunControl(RunControl *runControl, Core::Id runMode);
 
     void updateActions();
     void updateContext();
@@ -350,9 +350,9 @@ public:
 
     QString m_lastOpenDirectory;
     QPointer<RunConfiguration> m_delayedRunConfiguration;
-    QList<QPair<RunConfiguration *, RunMode>> m_delayedRunConfigurationForRun;
+    QList<QPair<RunConfiguration *, Core::Id>> m_delayedRunConfigurationForRun;
     bool m_shouldHaveRunConfiguration;
-    RunMode m_runMode;
+    Core::Id m_runMode;
     QString m_projectFilterString;
     MiniProjectTargetSelector * m_targetSelector;
     ProjectExplorerSettings m_projectExplorerSettings;
@@ -373,7 +373,7 @@ public:
 
 ProjectExplorerPluginPrivate::ProjectExplorerPluginPrivate() :
     m_shouldHaveRunConfiguration(false),
-    m_runMode(NoRunMode),
+    m_runMode(Constants::NO_RUN_MODE),
     m_projectsMode(0),
     m_kitManager(0),
     m_toolChainManager(0),
@@ -1901,7 +1901,7 @@ void ProjectExplorerPluginPrivate::buildStateChanged(Project * pro)
 }
 
 // NBS TODO implement more than one runner
-static IRunControlFactory *findRunControlFactory(RunConfiguration *config, RunMode mode)
+static IRunControlFactory *findRunControlFactory(RunConfiguration *config, Core::Id mode)
 {
     return ExtensionSystem::PluginManager::getObject<IRunControlFactory>(
         [&config, &mode](IRunControlFactory *factory) {
@@ -1909,7 +1909,7 @@ static IRunControlFactory *findRunControlFactory(RunConfiguration *config, RunMo
         });
 }
 
-void ProjectExplorerPluginPrivate::executeRunConfiguration(RunConfiguration *runConfiguration, RunMode runMode)
+void ProjectExplorerPluginPrivate::executeRunConfiguration(RunConfiguration *runConfiguration, Core::Id runMode)
 {
     if (!runConfiguration->isConfigured()) {
         QString errorMessage;
@@ -1947,18 +1947,18 @@ void ProjectExplorerPlugin::showRunErrorMessage(const QString &errorMessage)
         QMessageBox::critical(ICore::mainWindow(), errorMessage.isNull() ? tr("Unknown error") : tr("Could Not Run"), errorMessage);
 }
 
-void ProjectExplorerPlugin::startRunControl(RunControl *runControl, RunMode runMode)
+void ProjectExplorerPlugin::startRunControl(RunControl *runControl, Core::Id runMode)
 {
     dd->startRunControl(runControl, runMode);
 }
 
-void ProjectExplorerPluginPrivate::startRunControl(RunControl *runControl, RunMode runMode)
+void ProjectExplorerPluginPrivate::startRunControl(RunControl *runControl, Core::Id runMode)
 {
     m_outputPane->createNewOutputWindow(runControl);
     m_outputPane->flash(); // one flash for starting
     m_outputPane->showTabFor(runControl);
-    bool popup = (runMode == NormalRunMode && dd->m_projectExplorerSettings.showRunOutput)
-            || ((runMode == DebugRunMode || runMode == DebugRunModeWithBreakOnMain)
+    bool popup = (runMode == Constants::NORMAL_RUN_MODE && dd->m_projectExplorerSettings.showRunOutput)
+            || ((runMode == Constants::DEBUG_RUN_MODE || runMode == Constants::DEBUG_RUN_MODE_WITH_BREAK_ON_MAIN)
                 && m_projectExplorerSettings.showDebugOutput);
     m_outputPane->setBehaviorOnOutput(runControl, popup ? AppOutputPane::Popup : AppOutputPane::Flash);
     runControl->start();
@@ -2001,13 +2001,13 @@ void ProjectExplorerPluginPrivate::buildQueueFinished(bool success)
     }
     m_delayedRunConfiguration = 0;
     m_shouldHaveRunConfiguration = false;
-    m_runMode = NoRunMode;
+    m_runMode = Constants::NO_RUN_MODE;
 }
 
 void ProjectExplorerPluginPrivate::runConfigurationConfigurationFinished()
 {
     RunConfiguration *rc = qobject_cast<RunConfiguration *>(sender());
-    RunMode runMode = NoRunMode;
+    Core::Id runMode = Constants::NO_RUN_MODE;
     for (int i = 0; i < m_delayedRunConfigurationForRun.size(); ++i) {
         if (m_delayedRunConfigurationForRun.at(i).first == rc) {
             runMode = m_delayedRunConfigurationForRun.at(i).second;
@@ -2015,7 +2015,7 @@ void ProjectExplorerPluginPrivate::runConfigurationConfigurationFinished()
             break;
         }
     }
-    if (runMode != NoRunMode && rc->isConfigured())
+    if (runMode != Constants::NO_RUN_MODE && rc->isConfigured())
         executeRunConfiguration(rc, runMode);
 }
 
@@ -2368,12 +2368,12 @@ void ProjectExplorerPluginPrivate::cleanSession()
 
 void ProjectExplorerPluginPrivate::handleRunProject()
 {
-    m_instance->runStartupProject(NormalRunMode);
+    m_instance->runStartupProject(Constants::NORMAL_RUN_MODE);
 }
 
 void ProjectExplorerPluginPrivate::runProjectWithoutDeploy()
 {
-    m_instance->runStartupProject(NormalRunMode, true);
+    m_instance->runStartupProject(Constants::NORMAL_RUN_MODE, true);
 }
 
 void ProjectExplorerPluginPrivate::runProjectContextMenu()
@@ -2381,7 +2381,7 @@ void ProjectExplorerPluginPrivate::runProjectContextMenu()
     Node *node = ProjectTree::currentNode();
     ProjectNode *projectNode = node ? node->asProjectNode() : 0;
     if (projectNode == ProjectTree::currentProject()->rootProjectNode() || !projectNode) {
-        m_instance->runProject(ProjectTree::currentProject(), NormalRunMode);
+        m_instance->runProject(ProjectTree::currentProject(), Constants::NORMAL_RUN_MODE);
     } else {
         QAction *act = qobject_cast<QAction *>(sender());
         if (!act)
@@ -2389,7 +2389,7 @@ void ProjectExplorerPluginPrivate::runProjectContextMenu()
         RunConfiguration *rc = act->data().value<RunConfiguration *>();
         if (!rc)
             return;
-        m_instance->runRunConfiguration(rc, NormalRunMode);
+        m_instance->runRunConfiguration(rc, Constants::NORMAL_RUN_MODE);
     }
 }
 
@@ -2493,7 +2493,7 @@ static bool hasDeploySettings(Project *pro)
     });
 }
 
-void ProjectExplorerPlugin::runProject(Project *pro, RunMode mode, const bool forceSkipDeploy)
+void ProjectExplorerPlugin::runProject(Project *pro, Core::Id mode, const bool forceSkipDeploy)
 {
     if (!pro)
         return;
@@ -2503,13 +2503,13 @@ void ProjectExplorerPlugin::runProject(Project *pro, RunMode mode, const bool fo
             runRunConfiguration(rc, mode, forceSkipDeploy);
 }
 
-void ProjectExplorerPlugin::runStartupProject(RunMode runMode, bool forceSkipDeploy)
+void ProjectExplorerPlugin::runStartupProject(Core::Id runMode, bool forceSkipDeploy)
 {
     runProject(SessionManager::startupProject(), runMode, forceSkipDeploy);
 }
 
 void ProjectExplorerPlugin::runRunConfiguration(RunConfiguration *rc,
-                                                RunMode runMode,
+                                                Core::Id runMode,
                                                 const bool forceSkipDeploy)
 {
     if (!rc->isEnabled())
@@ -2680,7 +2680,7 @@ void ProjectExplorerPluginPrivate::updateDeployActions()
     emit m_instance->updateRunActions();
 }
 
-bool ProjectExplorerPlugin::canRun(Project *project, RunMode runMode, QString *whyNot)
+bool ProjectExplorerPlugin::canRun(Project *project, Core::Id runMode, QString *whyNot)
 {
     if (!project) {
         if (whyNot)
@@ -2747,7 +2747,7 @@ void ProjectExplorerPluginPrivate::slotUpdateRunActions()
 {
     Project *project = SessionManager::startupProject();
     QString whyNot;
-    const bool state = ProjectExplorerPlugin::canRun(project, NormalRunMode, &whyNot);
+    const bool state = ProjectExplorerPlugin::canRun(project, Constants::NORMAL_RUN_MODE, &whyNot);
     m_runAction->setEnabled(state);
     m_runAction->setToolTip(whyNot);
     m_runWithoutDeployAction->setEnabled(state);
diff --git a/src/plugins/projectexplorer/projectexplorer.h b/src/plugins/projectexplorer/projectexplorer.h
index e548268f7121108a899a54d4daa8444c76324489..61d86e65aaadc820f5e6566d08a74cc25221be49 100644
--- a/src/plugins/projectexplorer/projectexplorer.h
+++ b/src/plugins/projectexplorer/projectexplorer.h
@@ -33,6 +33,7 @@
 
 #include "projectexplorer_export.h"
 #include "projectexplorerconstants.h"
+#include "runconfiguration.h"
 
 #include <extensionsystem/iplugin.h>
 
@@ -88,7 +89,7 @@ public:
     static void setProjectExplorerSettings(const Internal::ProjectExplorerSettings &pes);
     static Internal::ProjectExplorerSettings projectExplorerSettings();
 
-    static void startRunControl(RunControl *runControl, RunMode runMode);
+    static void startRunControl(RunControl *runControl, Core::Id runMode);
     static void showRunErrorMessage(const QString &errorMessage);
 
     // internal public for FlatModel
@@ -97,10 +98,10 @@ public:
     static bool coreAboutToClose();
     static QList<QPair<QString, QString> > recentProjects();
 
-    static bool canRun(Project *pro, RunMode runMode, QString *whyNot = 0);
-    static void runProject(Project *pro, RunMode, const bool forceSkipDeploy = false);
-    static void runStartupProject(RunMode runMode, bool forceSkipDeploy = false);
-    static void runRunConfiguration(RunConfiguration *rc, RunMode runMode,
+    static bool canRun(Project *pro, Core::Id runMode, QString *whyNot = 0);
+    static void runProject(Project *pro, Core::Id, const bool forceSkipDeploy = false);
+    static void runStartupProject(Core::Id runMode, bool forceSkipDeploy = false);
+    static void runRunConfiguration(RunConfiguration *rc, Core::Id runMode,
                              const bool forceSkipDeploy = false);
 
     static void addExistingFiles(FolderNode *projectNode, const QStringList &filePaths);
@@ -128,7 +129,7 @@ signals:
     // or the file list of a specific project has changed.
     void fileListChanged();
 
-    void aboutToExecuteProject(ProjectExplorer::Project *project, RunMode runMode);
+    void aboutToExecuteProject(ProjectExplorer::Project *project, Core::Id runMode);
     void recentProjectsChanged();
 
     void settingsChanged();
diff --git a/src/plugins/projectexplorer/projectexplorerconstants.h b/src/plugins/projectexplorer/projectexplorerconstants.h
index 37a346332cad4c1aba805d07d0b2a8a20d2e3533..c6ec2b89cf81c188f16c41a663a1b31ec4d695b6 100644
--- a/src/plugins/projectexplorer/projectexplorerconstants.h
+++ b/src/plugins/projectexplorer/projectexplorerconstants.h
@@ -267,22 +267,14 @@ const char SHOW_FILE_FILTER_DEFAULT[] = "*.c; *.cc; *.cpp; *.cp; *.cxx; *.c++; *
 const char PAGE_ID_PREFIX[] = "PE.Wizard.Page.";
 const char GENERATOR_ID_PREFIX[] = "PE.Wizard.Generator.";
 
-} // namespace Constants
-
-// Run modes
-enum RunMode {
-    NoRunMode,
-    NormalRunMode,
-    DebugRunMode,
-    DebugRunModeWithBreakOnMain,
-    QmlProfilerRunMode,
-    CallgrindRunMode,
-    MemcheckRunMode,
-    MemcheckWithGdbRunMode,
-    ClangStaticAnalyzerMode,
-    PerfProfilerRunMode
-};
+// RunMode
+const char NO_RUN_MODE[]="RunConfiguration.NoRunMode";
+const char NORMAL_RUN_MODE[]="RunConfiguration.NormalRunMode";
+const char QML_PROFILER_RUN_MODE[]="RunConfiguration.QmlProfilerRunMode";
+const char DEBUG_RUN_MODE[]="RunConfiguration.DebugRunMode";
+const char DEBUG_RUN_MODE_WITH_BREAK_ON_MAIN[]="RunConfiguration.DebugRunModeWithBreakOnMain";
 
+} // namespace Constants
 } // namespace ProjectExplorer
 
 #endif // PROJECTEXPLORERCONSTANTS_H
diff --git a/src/plugins/projectexplorer/runconfiguration.cpp b/src/plugins/projectexplorer/runconfiguration.cpp
index 12f044677e44c686c4a9e03cf08007f9e1c962df..8c3fdf8254c3ff80bbb4f0f29627e09e5b9b2598 100644
--- a/src/plugins/projectexplorer/runconfiguration.cpp
+++ b/src/plugins/projectexplorer/runconfiguration.cpp
@@ -51,7 +51,7 @@
 #include <ApplicationServices/ApplicationServices.h>
 #endif
 
-using namespace ProjectExplorer;
+namespace ProjectExplorer {
 
 /*!
     \class ProjectExplorer::ProcessHandle
@@ -515,7 +515,7 @@ IRunConfigurationAspect *IRunControlFactory::createRunConfigurationAspect(RunCon
     than it needs to be.
 */
 
-RunControl::RunControl(RunConfiguration *runConfiguration, RunMode mode)
+RunControl::RunControl(RunConfiguration *runConfiguration, Core::Id mode)
     : m_runMode(mode), m_runConfiguration(runConfiguration), m_outputFormatter(0)
 {
     if (runConfiguration) {
@@ -537,7 +537,7 @@ Utils::OutputFormatter *RunControl::outputFormatter()
     return m_outputFormatter;
 }
 
-RunMode RunControl::runMode() const
+Core::Id RunControl::runMode() const
 {
     return m_runMode;
 }
@@ -663,3 +663,5 @@ void RunControl::appendMessage(const QString &msg, Utils::OutputFormat format)
 {
     emit appendMessage(this, msg, format);
 }
+
+} // namespace ProjectExplorer
diff --git a/src/plugins/projectexplorer/runconfiguration.h b/src/plugins/projectexplorer/runconfiguration.h
index 43890d3ad9976a459651566ce400b2185d23557e..ff511a84a79af175c3d4164c95a1c0173f28647e 100644
--- a/src/plugins/projectexplorer/runconfiguration.h
+++ b/src/plugins/projectexplorer/runconfiguration.h
@@ -253,8 +253,8 @@ public:
     explicit IRunControlFactory(QObject *parent = 0);
     virtual ~IRunControlFactory();
 
-    virtual bool canRun(RunConfiguration *runConfiguration, RunMode mode) const = 0;
-    virtual RunControl *create(RunConfiguration *runConfiguration, RunMode mode, QString *errorMessage) = 0;
+    virtual bool canRun(RunConfiguration *runConfiguration, Core::Id mode) const = 0;
+    virtual RunControl *create(RunConfiguration *runConfiguration, Core::Id mode, QString *errorMessage) = 0;
 
     virtual IRunConfigurationAspect *createRunConfigurationAspect(RunConfiguration *rc);
 };
@@ -283,7 +283,7 @@ public:
         AsynchronousStop     // Stop sequence has been started
     };
 
-    RunControl(RunConfiguration *runConfiguration, RunMode mode);
+    RunControl(RunConfiguration *runConfiguration, Core::Id mode);
     virtual ~RunControl();
     virtual void start() = 0;
 
@@ -304,7 +304,7 @@ public:
     bool sameRunConfiguration(const RunControl *other) const;
 
     Utils::OutputFormatter *outputFormatter();
-    RunMode runMode() const;
+    Core::Id runMode() const;
 
 public slots:
     void bringApplicationToForeground(qint64 pid);
@@ -328,7 +328,7 @@ protected:
 
 private:
     QString m_displayName;
-    RunMode m_runMode;
+    Core::Id m_runMode;
     QString m_icon;
     const QPointer<RunConfiguration> m_runConfiguration;
     Utils::OutputFormatter *m_outputFormatter;
diff --git a/src/plugins/pythoneditor/pythoneditorplugin.cpp b/src/plugins/pythoneditor/pythoneditorplugin.cpp
index 4484ed14a9c8084a8e5bfa31983b5e951d41b46e..eab59f24f62de815ab149b332a444352e04f8ee6 100644
--- a/src/plugins/pythoneditor/pythoneditorplugin.cpp
+++ b/src/plugins/pythoneditor/pythoneditorplugin.cpp
@@ -406,7 +406,7 @@ private:
 class PythonRunControl : public RunControl
 {
 public:
-    PythonRunControl(PythonRunConfiguration *runConfiguration, RunMode mode);
+    PythonRunControl(PythonRunConfiguration *runConfiguration, Core::Id mode);
 
     void start();
     StopResult stop();
@@ -1098,16 +1098,16 @@ bool PythonProjectNode::renameFile(const QString &filePath, const QString &newFi
 class PythonRunControlFactory : public IRunControlFactory
 {
 public:
-    bool canRun(RunConfiguration *runConfiguration, RunMode mode) const;
-    RunControl *create(RunConfiguration *runConfiguration, RunMode mode, QString *errorMessage);
+    bool canRun(RunConfiguration *runConfiguration, Core::Id mode) const;
+    RunControl *create(RunConfiguration *runConfiguration, Core::Id mode, QString *errorMessage);
 };
 
-bool PythonRunControlFactory::canRun(RunConfiguration *runConfiguration, RunMode mode) const
+bool PythonRunControlFactory::canRun(RunConfiguration *runConfiguration, Core::Id mode) const
 {
-    return mode == NormalRunMode && dynamic_cast<PythonRunConfiguration *>(runConfiguration);
+    return mode == ProjectExplorer::Constants::NORMAL_RUN_MODE && dynamic_cast<PythonRunConfiguration *>(runConfiguration);
 }
 
-RunControl *PythonRunControlFactory::create(RunConfiguration *runConfiguration, RunMode mode, QString *errorMessage)
+RunControl *PythonRunControlFactory::create(RunConfiguration *runConfiguration, Core::Id mode, QString *errorMessage)
 {
     Q_UNUSED(errorMessage)
     QTC_ASSERT(canRun(runConfiguration, mode), return 0);
@@ -1116,7 +1116,7 @@ RunControl *PythonRunControlFactory::create(RunConfiguration *runConfiguration,
 
 // PythonRunControl
 
-PythonRunControl::PythonRunControl(PythonRunConfiguration *rc, RunMode mode)
+PythonRunControl::PythonRunControl(PythonRunConfiguration *rc, Core::Id mode)
     : RunControl(rc, mode), m_running(false)
 {
     setIcon(QLatin1String(ProjectExplorer::Constants::ICON_RUN_SMALL));
diff --git a/src/plugins/qmlprofiler/qmlprofilerplugin.cpp b/src/plugins/qmlprofiler/qmlprofilerplugin.cpp
index 283e1f3b836c85133951506723c16cb3a735546b..adb1db87dc159332d8bfed0333e09a01ddee637d 100644
--- a/src/plugins/qmlprofiler/qmlprofilerplugin.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilerplugin.cpp
@@ -71,7 +71,7 @@ bool QmlProfilerPlugin::initialize(const QStringList &arguments, QString *errorS
     action->setWidgetCreator(widgetCreator);
     action->setRunControlCreator(runControlCreator);
     action->setToolPreparer([tool] { return tool->prepareTool(); });
-    action->setRunMode(ProjectExplorer::QmlProfilerRunMode);
+    action->setRunMode(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
     action->setText(tr("QML Profiler"));
     action->setToolTip(description);
     action->setMenuGroup(Constants::G_ANALYZER_TOOLS);
@@ -84,7 +84,7 @@ bool QmlProfilerPlugin::initialize(const QStringList &arguments, QString *errorS
     action->setRunControlCreator(runControlCreator);
     action->setCustomToolStarter([tool] { tool->startRemoteTool(); });
     action->setToolPreparer([tool] { return tool->prepareTool(); });
-    action->setRunMode(ProjectExplorer::QmlProfilerRunMode);
+    action->setRunMode(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
     action->setText(tr("QML Profiler (External)"));
     action->setToolTip(description);
     action->setMenuGroup(Constants::G_ANALYZER_REMOTE_TOOLS);
diff --git a/src/plugins/qmlprofiler/qmlprofilerruncontrolfactory.cpp b/src/plugins/qmlprofiler/qmlprofilerruncontrolfactory.cpp
index a5ea4fa003206ff82c0f85760a9032004fdcb7a1..6fc364d347f130e9c5d197c5342e70cb2817929b 100644
--- a/src/plugins/qmlprofiler/qmlprofilerruncontrolfactory.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilerruncontrolfactory.cpp
@@ -57,9 +57,9 @@ QmlProfilerRunControlFactory::QmlProfilerRunControlFactory(QObject *parent) :
 {
 }
 
-bool QmlProfilerRunControlFactory::canRun(RunConfiguration *runConfiguration, RunMode mode) const
+bool QmlProfilerRunControlFactory::canRun(RunConfiguration *runConfiguration, Core::Id mode) const
 {
-    return mode == QmlProfilerRunMode
+    return mode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE
             && (qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration));
 }
 
@@ -83,7 +83,7 @@ static AnalyzerStartParameters createQmlProfilerStartParameters(RunConfiguration
     return sp;
 }
 
-RunControl *QmlProfilerRunControlFactory::create(RunConfiguration *runConfiguration, RunMode mode, QString *errorMessage)
+RunControl *QmlProfilerRunControlFactory::create(RunConfiguration *runConfiguration, Core::Id mode, QString *errorMessage)
 {
     QTC_ASSERT(canRun(runConfiguration, mode), return 0);
 
diff --git a/src/plugins/qmlprofiler/qmlprofilerruncontrolfactory.h b/src/plugins/qmlprofiler/qmlprofilerruncontrolfactory.h
index f5513c98caeba5ef6f6bda19cddc840dc25ccdff..269895b36cd794754257bba6e4b07ad0a7589c6f 100644
--- a/src/plugins/qmlprofiler/qmlprofilerruncontrolfactory.h
+++ b/src/plugins/qmlprofiler/qmlprofilerruncontrolfactory.h
@@ -45,10 +45,10 @@ public:
     explicit QmlProfilerRunControlFactory(QObject *parent = 0);
 
     // IRunControlFactory implementation
-    bool canRun(RunConfiguration *runConfiguration, ProjectExplorer::RunMode mode) const;
+    bool canRun(RunConfiguration *runConfiguration, Core::Id mode) const;
 
     ProjectExplorer::RunControl *create(RunConfiguration *runConfiguration,
-                                        ProjectExplorer::RunMode mode,
+                                        Core::Id mode,
                                         QString *errorMessage);
 };
 
diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp
index f565557200ab441f8fa696d0502c722122023ab3..c0518cc613e33eeac1267e250f775965abff0806 100644
--- a/src/plugins/qmlprofiler/qmlprofilertool.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp
@@ -486,7 +486,7 @@ void QmlProfilerTool::startRemoteTool()
     sp.analyzerPort = port;
 
     AnalyzerRunControl *rc = createRunControl(sp, 0);
-    ProjectExplorerPlugin::startRunControl(rc, QmlProfilerRunMode);
+    ProjectExplorerPlugin::startRunControl(rc, ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
 }
 
 void QmlProfilerTool::logState(const QString &msg)
diff --git a/src/plugins/qnx/qnxattachdebugsupport.cpp b/src/plugins/qnx/qnxattachdebugsupport.cpp
index dac8912da412880b8418283a85c743f62b691693..3bb3f271a985f6083bd3f997ba982695b77443a3 100644
--- a/src/plugins/qnx/qnxattachdebugsupport.cpp
+++ b/src/plugins/qnx/qnxattachdebugsupport.cpp
@@ -135,7 +135,7 @@ void QnxAttachDebugSupport::attachToProcess()
     }
     connect(runControl, &Debugger::DebuggerRunControl::stateChanged,
             this, &QnxAttachDebugSupport::handleDebuggerStateChanged);
-    ProjectExplorer::ProjectExplorerPlugin::startRunControl(runControl, ProjectExplorer::DebugRunMode);
+    ProjectExplorer::ProjectExplorerPlugin::startRunControl(runControl, ProjectExplorer::Constants::DEBUG_RUN_MODE);
 }
 
 void QnxAttachDebugSupport::handleDebuggerStateChanged(Debugger::DebuggerState state)
diff --git a/src/plugins/qnx/qnxruncontrolfactory.cpp b/src/plugins/qnx/qnxruncontrolfactory.cpp
index 2e943e0a1ba80a8e4729463a2a37652e487b0f07..ee5c37044c1e63ea55a2080dfb849e14402ba80c 100644
--- a/src/plugins/qnx/qnxruncontrolfactory.cpp
+++ b/src/plugins/qnx/qnxruncontrolfactory.cpp
@@ -95,7 +95,7 @@ static DebuggerStartParameters createDebuggerStartParameters(QnxRunConfiguration
     return params;
 }
 
-static AnalyzerStartParameters createAnalyzerStartParameters(const QnxRunConfiguration *runConfig, RunMode mode)
+static AnalyzerStartParameters createAnalyzerStartParameters(const QnxRunConfiguration *runConfig, Core::Id mode)
 {
     AnalyzerStartParameters params;
     Target *target = runConfig->target();
@@ -125,10 +125,13 @@ QnxRunControlFactory::QnxRunControlFactory(QObject *parent)
 {
 }
 
-bool QnxRunControlFactory::canRun(RunConfiguration *runConfiguration, RunMode mode) const
+bool QnxRunControlFactory::canRun(RunConfiguration *runConfiguration, Core::Id mode) const
 {
-    if (mode != NormalRunMode && mode != DebugRunMode && mode != QmlProfilerRunMode)
+    if (mode != ProjectExplorer::Constants::NORMAL_RUN_MODE
+            && mode != ProjectExplorer::Constants::DEBUG_RUN_MODE
+            && mode != ProjectExplorer::Constants::QML_PROFILER_RUN_MODE) {
         return false;
+    }
 
     if (!runConfiguration->isEnabled()
             || !runConfiguration->id().name().startsWith(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX)) {
@@ -141,22 +144,22 @@ bool QnxRunControlFactory::canRun(RunConfiguration *runConfiguration, RunMode mo
     if (dev.isNull())
         return false;
 
-    if (mode == DebugRunMode || mode == QmlProfilerRunMode)
+    if (mode == ProjectExplorer::Constants::DEBUG_RUN_MODE || mode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE)
         return rc->portsUsedByDebuggers() <= dev->freePorts().count();
 
     return true;
 }
 
-RunControl *QnxRunControlFactory::create(RunConfiguration *runConfig, RunMode mode, QString *errorMessage)
+RunControl *QnxRunControlFactory::create(RunConfiguration *runConfig, Core::Id mode, QString *errorMessage)
 {
     Q_ASSERT(canRun(runConfig, mode));
 
     QnxRunConfiguration *rc = qobject_cast<QnxRunConfiguration *>(runConfig);
     Q_ASSERT(rc);
-    switch (mode) {
-    case NormalRunMode:
+    if (mode == ProjectExplorer::Constants::NORMAL_RUN_MODE)
         return new QnxRunControl(rc);
-    case DebugRunMode: {
+
+    if (mode == ProjectExplorer::Constants::DEBUG_RUN_MODE) {
         const DebuggerStartParameters params = createDebuggerStartParameters(rc);
         DebuggerRunControl *runControl = createDebuggerRunControl(params, runConfig, errorMessage);
         if (!runControl)
@@ -167,21 +170,15 @@ RunControl *QnxRunControlFactory::create(RunConfiguration *runConfig, RunMode mo
 
         return runControl;
     }
-    case QmlProfilerRunMode: {
+
+    if (mode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE) {
         const AnalyzerStartParameters params = createAnalyzerStartParameters(rc, mode);
         AnalyzerRunControl *runControl = AnalyzerManager::createRunControl(params, runConfig);
         QnxAnalyzeSupport * const analyzeSupport = new QnxAnalyzeSupport(rc, runControl);
         connect(runControl, SIGNAL(finished()), analyzeSupport, SLOT(handleProfilingFinished()));
         return runControl;
     }
-    case PerfProfilerRunMode:
-    case NoRunMode:
-    case CallgrindRunMode:
-    case MemcheckRunMode:
-    case MemcheckWithGdbRunMode:
-    case ClangStaticAnalyzerMode:
-    case DebugRunModeWithBreakOnMain:
-        QTC_ASSERT(false, return 0);
-    }
+
+    QTC_CHECK(false);
     return 0;
 }
diff --git a/src/plugins/qnx/qnxruncontrolfactory.h b/src/plugins/qnx/qnxruncontrolfactory.h
index afd6e6a585ea868701136faf32299ef202ffdeb9..f3753f49b8504476e1083c90ffbea566bffa8633 100644
--- a/src/plugins/qnx/qnxruncontrolfactory.h
+++ b/src/plugins/qnx/qnxruncontrolfactory.h
@@ -46,9 +46,9 @@ public:
     explicit QnxRunControlFactory(QObject *parent = 0);
 
     bool canRun(ProjectExplorer::RunConfiguration *runConfiguration,
-                ProjectExplorer::RunMode mode) const;
+                Core::Id mode) const;
     ProjectExplorer::RunControl *create(ProjectExplorer::RunConfiguration *runConfiguration,
-                                        ProjectExplorer::RunMode mode, QString *errorMessage);
+                                        Core::Id mode, QString *errorMessage);
 };
 
 } // namespace Internal
diff --git a/src/plugins/remotelinux/remotelinuxanalyzesupport.cpp b/src/plugins/remotelinux/remotelinuxanalyzesupport.cpp
index ea2020e15e64dd30f6c28ac6a460c076f337ab01..a7316280e94749ee71923ca53ea5a0132ab63b33 100644
--- a/src/plugins/remotelinux/remotelinuxanalyzesupport.cpp
+++ b/src/plugins/remotelinux/remotelinuxanalyzesupport.cpp
@@ -56,9 +56,9 @@ namespace Internal {
 class RemoteLinuxAnalyzeSupportPrivate
 {
 public:
-    RemoteLinuxAnalyzeSupportPrivate(AnalyzerRunControl *rc, RunMode runMode)
+    RemoteLinuxAnalyzeSupportPrivate(AnalyzerRunControl *rc, Core::Id runMode)
         : runControl(rc),
-          qmlProfiling(runMode == QmlProfilerRunMode),
+          qmlProfiling(runMode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE),
           qmlPort(-1)
     {
     }
@@ -75,7 +75,7 @@ public:
 using namespace Internal;
 
 AnalyzerStartParameters RemoteLinuxAnalyzeSupport::startParameters(const RunConfiguration *runConfig,
-                                                                   RunMode runMode)
+                                                                   Core::Id runMode)
 {
     AnalyzerStartParameters params;
     params.runMode = runMode;
@@ -88,7 +88,7 @@ AnalyzerStartParameters RemoteLinuxAnalyzeSupport::startParameters(const RunConf
 }
 
 RemoteLinuxAnalyzeSupport::RemoteLinuxAnalyzeSupport(AbstractRemoteLinuxRunConfiguration *runConfig,
-                                                     AnalyzerRunControl *engine, RunMode runMode)
+                                                     AnalyzerRunControl *engine, Core::Id runMode)
     : AbstractRemoteLinuxRunSupport(runConfig, engine),
       d(new RemoteLinuxAnalyzeSupportPrivate(engine, runMode))
 {
diff --git a/src/plugins/remotelinux/remotelinuxanalyzesupport.h b/src/plugins/remotelinux/remotelinuxanalyzesupport.h
index 20ff11d802dbf585fb3b27e9f97e68073ef8103c..b5e3694af48b4dba16af7da93ac4ebb6997bd429 100644
--- a/src/plugins/remotelinux/remotelinuxanalyzesupport.h
+++ b/src/plugins/remotelinux/remotelinuxanalyzesupport.h
@@ -53,10 +53,10 @@ class REMOTELINUX_EXPORT RemoteLinuxAnalyzeSupport : public AbstractRemoteLinuxR
     Q_OBJECT
 public:
     static Analyzer::AnalyzerStartParameters startParameters(const ProjectExplorer::RunConfiguration *runConfig,
-                                                             ProjectExplorer::RunMode runMode);
+                                                             Core::Id runMode);
 
     RemoteLinuxAnalyzeSupport(AbstractRemoteLinuxRunConfiguration *runConfig,
-            Analyzer::AnalyzerRunControl *engine, ProjectExplorer::RunMode runMode);
+            Analyzer::AnalyzerRunControl *engine, Core::Id runMode);
     ~RemoteLinuxAnalyzeSupport();
 
 protected:
diff --git a/src/plugins/remotelinux/remotelinuxruncontrol.cpp b/src/plugins/remotelinux/remotelinuxruncontrol.cpp
index 4d359f8267387a52874ab3aa6364d34b64fe372e..7525ba93b2327a38753759d341bc381c509926c7 100644
--- a/src/plugins/remotelinux/remotelinuxruncontrol.cpp
+++ b/src/plugins/remotelinux/remotelinuxruncontrol.cpp
@@ -57,7 +57,7 @@ public:
 };
 
 RemoteLinuxRunControl::RemoteLinuxRunControl(RunConfiguration *rc)
-        : RunControl(rc, NormalRunMode), d(new RemoteLinuxRunControlPrivate)
+        : RunControl(rc, ProjectExplorer::Constants::NORMAL_RUN_MODE), d(new RemoteLinuxRunControlPrivate)
 {
     setIcon(QLatin1String(ProjectExplorer::Constants::ICON_RUN_SMALL));
 
diff --git a/src/plugins/remotelinux/remotelinuxruncontrolfactory.cpp b/src/plugins/remotelinux/remotelinuxruncontrolfactory.cpp
index e933918b7d7abe786fc6b88c6f94ad594485e79f..3053e39027fe3592ce272100e6f71f3dcc270096 100644
--- a/src/plugins/remotelinux/remotelinuxruncontrolfactory.cpp
+++ b/src/plugins/remotelinux/remotelinuxruncontrolfactory.cpp
@@ -63,10 +63,12 @@ RemoteLinuxRunControlFactory::~RemoteLinuxRunControlFactory()
 {
 }
 
-bool RemoteLinuxRunControlFactory::canRun(RunConfiguration *runConfiguration, RunMode mode) const
+bool RemoteLinuxRunControlFactory::canRun(RunConfiguration *runConfiguration, Core::Id mode) const
 {
-    if (mode != NormalRunMode && mode != DebugRunMode && mode != DebugRunModeWithBreakOnMain
-            && mode != QmlProfilerRunMode) {
+    if (mode != ProjectExplorer::Constants::NORMAL_RUN_MODE
+            && mode != ProjectExplorer::Constants::DEBUG_RUN_MODE
+            && mode != ProjectExplorer::Constants::DEBUG_RUN_MODE_WITH_BREAK_ON_MAIN
+            && mode != ProjectExplorer::Constants::QML_PROFILER_RUN_MODE) {
         return false;
     }
 
@@ -76,16 +78,16 @@ bool RemoteLinuxRunControlFactory::canRun(RunConfiguration *runConfiguration, Ru
                 || id.name().startsWith(RemoteLinuxRunConfiguration::IdPrefix));
 }
 
-RunControl *RemoteLinuxRunControlFactory::create(RunConfiguration *runConfig, RunMode mode,
+RunControl *RemoteLinuxRunControlFactory::create(RunConfiguration *runConfig, Core::Id mode,
                                                  QString *errorMessage)
 {
     QTC_ASSERT(canRun(runConfig, mode), return 0);
 
-    switch (mode) {
-    case NormalRunMode:
+    if (mode == ProjectExplorer::Constants::NORMAL_RUN_MODE)
         return new RemoteLinuxRunControl(runConfig);
-    case DebugRunMode:
-    case DebugRunModeWithBreakOnMain: {
+
+    if (mode == ProjectExplorer::Constants::DEBUG_RUN_MODE
+            || mode == ProjectExplorer::Constants::DEBUG_RUN_MODE_WITH_BREAK_ON_MAIN) {
         IDevice::ConstPtr dev = DeviceKitInformation::device(runConfig->target()->kit());
         if (!dev) {
             *errorMessage = tr("Cannot debug: Kit has no device.");
@@ -112,7 +114,8 @@ RunControl *RemoteLinuxRunControlFactory::create(RunConfiguration *runConfig, Ru
         connect(runControl, SIGNAL(finished()), debugSupport, SLOT(handleDebuggingFinished()));
         return runControl;
     }
-    case QmlProfilerRunMode: {
+
+    if (mode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE) {
         AnalyzerStartParameters params = RemoteLinuxAnalyzeSupport::startParameters(runConfig, mode);
         auto * const rc = qobject_cast<AbstractRemoteLinuxRunConfiguration *>(runConfig);
         QTC_ASSERT(rc, return 0);
@@ -120,16 +123,8 @@ RunControl *RemoteLinuxRunControlFactory::create(RunConfiguration *runConfig, Ru
         (void) new RemoteLinuxAnalyzeSupport(rc, runControl, mode);
         return runControl;
     }
-    case PerfProfilerRunMode:
-    case NoRunMode:
-    case CallgrindRunMode:
-    case MemcheckRunMode:
-    case MemcheckWithGdbRunMode:
-    case ClangStaticAnalyzerMode:
-        QTC_ASSERT(false, return 0);
-    }
 
-    QTC_ASSERT(false, return 0);
+    QTC_CHECK(false);
     return 0;
 }
 
diff --git a/src/plugins/remotelinux/remotelinuxruncontrolfactory.h b/src/plugins/remotelinux/remotelinuxruncontrolfactory.h
index b8a8aa34504bf859af157dbe8bd8cbe8285e9a0d..fb8828248e97c4fadd277d449fef200d169cd29b 100644
--- a/src/plugins/remotelinux/remotelinuxruncontrolfactory.h
+++ b/src/plugins/remotelinux/remotelinuxruncontrolfactory.h
@@ -43,9 +43,9 @@ public:
     ~RemoteLinuxRunControlFactory();
 
     bool canRun(ProjectExplorer::RunConfiguration *runConfiguration,
-                ProjectExplorer::RunMode mode) const;
+                Core::Id mode) const;
     ProjectExplorer::RunControl *create(ProjectExplorer::RunConfiguration *runConfiguration,
-                                        ProjectExplorer::RunMode mode, QString *errorMessage);
+                                        Core::Id mode, QString *errorMessage);
 };
 
 } // namespace Internal
diff --git a/src/plugins/valgrind/callgrindtool.h b/src/plugins/valgrind/callgrindtool.h
index 0018ecab2aa4baff317f5ee9f9602ce2ba16b84d..0ef8905c6ba0d337c40536d123c45470a06a55b0 100644
--- a/src/plugins/valgrind/callgrindtool.h
+++ b/src/plugins/valgrind/callgrindtool.h
@@ -41,6 +41,8 @@ const char CallgrindLocalActionId[] = "Callgrind.Local";
 const char CallgrindRemoteActionId[] = "Callgrind.Remote";
 
 class ValgrindRunControl;
+const char CALLGRIND_RUN_MODE[] = "CallgrindTool.CallgrindRunMode";
+
 class CallgrindToolPrivate;
 
 class CallgrindTool : public QObject
diff --git a/src/plugins/valgrind/memchecktool.h b/src/plugins/valgrind/memchecktool.h
index 6e9cdaae1c838db95d66aa07d0de82dd0cf86417..2f0f593e7d9c71c36c509884d6290b9697858a3c 100644
--- a/src/plugins/valgrind/memchecktool.h
+++ b/src/plugins/valgrind/memchecktool.h
@@ -50,6 +50,10 @@ class Error;
 }
 
 namespace Valgrind {
+
+const char MEMCHECK_RUN_MODE[] = "MemcheckTool.MemcheckRunMode";
+const char MEMCHECK_WITH_GDB_RUN_MODE[] = "MemcheckTool.MemcheckWithGdbRunMode";
+
 namespace Internal {
 
 class FrameFinder;
@@ -57,6 +61,7 @@ class MemcheckErrorView;
 class MemcheckRunControl;
 class ValgrindBaseSettings;
 
+
 class MemcheckErrorFilterProxyModel : public QSortFilterProxyModel
 {
     Q_OBJECT
diff --git a/src/plugins/valgrind/valgrindplugin.cpp b/src/plugins/valgrind/valgrindplugin.cpp
index f8efdf33527c28d9e9cbdcc584fa052ef172336c..f92b648230e1a41a0683a3abccb72d947583ab00 100644
--- a/src/plugins/valgrind/valgrindplugin.cpp
+++ b/src/plugins/valgrind/valgrindplugin.cpp
@@ -54,7 +54,6 @@
 #include <cppeditor/cppeditorconstants.h>
 
 #include <projectexplorer/projectexplorer.h>
-#include <projectexplorer/projectexplorerconstants.h>
 
 #include <utils/hostosinfo.h>
 
@@ -166,7 +165,7 @@ void ValgrindPlugin::extensionsInitialized()
         action->setWidgetCreator(mcWidgetCreator);
         action->setRunControlCreator(mcRunControlCreator);
         action->setToolMode(DebugMode);
-        action->setRunMode(ProjectExplorer::MemcheckRunMode);
+        action->setRunMode(MEMCHECK_RUN_MODE);
         action->setText(tr("Valgrind Memory Analyzer"));
         action->setToolTip(memcheckToolTip);
         action->setMenuGroup(Analyzer::Constants::G_ANALYZER_TOOLS);
@@ -182,7 +181,7 @@ void ValgrindPlugin::extensionsInitialized()
         action->setRunControlCreator(std::bind(&MemcheckWithGdbTool::createRunControl,
                                                mcgTool, _1, _2));
         action->setToolMode(DebugMode);
-        action->setRunMode(ProjectExplorer::MemcheckWithGdbRunMode);
+        action->setRunMode(MEMCHECK_WITH_GDB_RUN_MODE);
         action->setText(tr("Valgrind Memory Analyzer with GDB"));
         action->setToolTip(tr("Valgrind Analyze Memory with GDB uses the "
             "Memcheck tool to find memory leaks.\nWhen a problem is detected, "
@@ -197,7 +196,7 @@ void ValgrindPlugin::extensionsInitialized()
         action->setWidgetCreator(cgWidgetCreator);
         action->setRunControlCreator(cgRunControlCreator);
         action->setToolMode(ReleaseMode);
-        action->setRunMode(CallgrindRunMode);
+        action->setRunMode(CALLGRIND_RUN_MODE);
         action->setText(tr("Valgrind Function Profiler"));
         action->setToolTip(callgrindToolTip);
         action->setMenuGroup(Analyzer::Constants::G_ANALYZER_TOOLS);
@@ -216,7 +215,7 @@ void ValgrindPlugin::extensionsInitialized()
         ValgrindRunControl *rc = mcTool->createRunControl(sp, 0);
         QTC_ASSERT(rc, return);
         rc->setCustomStart();
-        ProjectExplorerPlugin::startRunControl(rc, MemcheckRunMode);
+        ProjectExplorerPlugin::startRunControl(rc, MEMCHECK_RUN_MODE);
     });
     action->setText(tr("Valgrind Memory Analyzer (External Remote Application)"));
     action->setToolTip(memcheckToolTip);
@@ -234,7 +233,7 @@ void ValgrindPlugin::extensionsInitialized()
         ValgrindRunControl *rc = cgTool->createRunControl(sp, 0);
         QTC_ASSERT(rc, return);
         rc->setCustomStart();
-        ProjectExplorerPlugin::startRunControl(rc, CallgrindRunMode);
+        ProjectExplorerPlugin::startRunControl(rc, CALLGRIND_RUN_MODE);
     });
 
     action->setText(tr("Valgrind Function Profiler (External Remote Application)"));
diff --git a/src/plugins/valgrind/valgrindplugin.h b/src/plugins/valgrind/valgrindplugin.h
index 912c3ce50235032b0e65779407c388df034a7cb7..a53152903fffcf0a3c1e5d233f288a24e686e68b 100644
--- a/src/plugins/valgrind/valgrindplugin.h
+++ b/src/plugins/valgrind/valgrindplugin.h
@@ -34,6 +34,7 @@
 
 #include <extensionsystem/iplugin.h>
 #include <analyzerbase/ianalyzertool.h>
+#include <projectexplorer/projectexplorer.h>
 
 namespace Valgrind {
 namespace Internal {
diff --git a/src/plugins/valgrind/valgrindruncontrolfactory.cpp b/src/plugins/valgrind/valgrindruncontrolfactory.cpp
index 23b393d2bb80fdde5f9d41224e799c7387fd6040..32f214b2ecee07f19a47b592b6092a4da1113133 100644
--- a/src/plugins/valgrind/valgrindruncontrolfactory.cpp
+++ b/src/plugins/valgrind/valgrindruncontrolfactory.cpp
@@ -31,6 +31,8 @@
 #include "valgrindruncontrolfactory.h"
 #include "valgrindsettings.h"
 #include "valgrindplugin.h"
+#include "callgrindtool.h"
+#include "memchecktool.h"
 
 #include <analyzerbase/ianalyzertool.h>
 #include <analyzerbase/analyzermanager.h>
@@ -62,13 +64,13 @@ ValgrindRunControlFactory::ValgrindRunControlFactory(QObject *parent) :
 {
 }
 
-bool ValgrindRunControlFactory::canRun(RunConfiguration *runConfiguration, RunMode mode) const
+bool ValgrindRunControlFactory::canRun(RunConfiguration *runConfiguration, Core::Id mode) const
 {
     Q_UNUSED(runConfiguration);
-    return mode == CallgrindRunMode || mode == MemcheckRunMode || mode == MemcheckWithGdbRunMode;
+    return mode == CALLGRIND_RUN_MODE || mode == MEMCHECK_RUN_MODE || mode == MEMCHECK_WITH_GDB_RUN_MODE;
 }
 
-RunControl *ValgrindRunControlFactory::create(RunConfiguration *runConfiguration, RunMode mode, QString *errorMessage)
+RunControl *ValgrindRunControlFactory::create(RunConfiguration *runConfiguration, Core::Id mode, QString *errorMessage)
 {
     Q_UNUSED(errorMessage);
 
diff --git a/src/plugins/valgrind/valgrindruncontrolfactory.h b/src/plugins/valgrind/valgrindruncontrolfactory.h
index 2b04b33b46f64ab466dc407d12f0c9cf1bfa3802..6c306325396170b5a5a04e3f7e6c9f2bd4bbc80e 100644
--- a/src/plugins/valgrind/valgrindruncontrolfactory.h
+++ b/src/plugins/valgrind/valgrindruncontrolfactory.h
@@ -45,10 +45,10 @@ public:
     explicit ValgrindRunControlFactory(QObject *parent = 0);
 
     // IRunControlFactory implementation
-    bool canRun(RunConfiguration *runConfiguration, ProjectExplorer::RunMode mode) const;
+    bool canRun(RunConfiguration *runConfiguration, Core::Id mode) const;
 
     ProjectExplorer::RunControl *create(RunConfiguration *runConfiguration,
-                                        ProjectExplorer::RunMode mode,
+                                        Core::Id mode,
                                         QString *errorMessage);
     ProjectExplorer::IRunConfigurationAspect *createRunConfigurationAspect(ProjectExplorer::RunConfiguration *rc);
 };
diff --git a/src/plugins/winrt/winrtdebugsupport.cpp b/src/plugins/winrt/winrtdebugsupport.cpp
index 85b56b91c444f2325a3233d809b8bae7954626e9..0f25380fc829a2a76d870a16a3f25b36a1de208f 100644
--- a/src/plugins/winrt/winrtdebugsupport.cpp
+++ b/src/plugins/winrt/winrtdebugsupport.cpp
@@ -68,7 +68,7 @@ void WinRtDebugSupport::finish()
 }
 
 RunControl *WinRtDebugSupport::createDebugRunControl(WinRtRunConfiguration *runConfig,
-                                                     RunMode mode,
+                                                     Core::Id mode,
                                                      QString *errorMessage)
 {
     // FIXME: This is just working for local debugging;
diff --git a/src/plugins/winrt/winrtdebugsupport.h b/src/plugins/winrt/winrtdebugsupport.h
index 4b5d8d5cf3e0370fe596e4139ab4b03ea47c1d1e..f92281beb273f7c3abcff1d088242af0cb14e463 100644
--- a/src/plugins/winrt/winrtdebugsupport.h
+++ b/src/plugins/winrt/winrtdebugsupport.h
@@ -47,7 +47,7 @@ class WinRtDebugSupport : public QObject
     Q_OBJECT
 public:
     static ProjectExplorer::RunControl *createDebugRunControl(WinRtRunConfiguration *runConfig,
-                                                              ProjectExplorer::RunMode mode,
+                                                              Core::Id mode,
                                                               QString *errorMessage);
     ~WinRtDebugSupport();
 
diff --git a/src/plugins/winrt/winrtruncontrol.cpp b/src/plugins/winrt/winrtruncontrol.cpp
index 6e0b41d0f4e80de9050245f57d97b4d498d8df58..fed9db96350f6a4418a092b6d74b029c02000e6b 100644
--- a/src/plugins/winrt/winrtruncontrol.cpp
+++ b/src/plugins/winrt/winrtruncontrol.cpp
@@ -48,13 +48,13 @@
 using ProjectExplorer::DeviceKitInformation;
 using ProjectExplorer::IDevice;
 using ProjectExplorer::RunControl;
-using ProjectExplorer::RunMode;
+using Core::Id;
 using ProjectExplorer::Target;
 
 namespace WinRt {
 namespace Internal {
 
-WinRtRunControl::WinRtRunControl(WinRtRunConfiguration *runConfiguration, RunMode mode)
+WinRtRunControl::WinRtRunControl(WinRtRunConfiguration *runConfiguration, Core::Id mode)
     : RunControl(runConfiguration, mode)
     , m_runConfiguration(runConfiguration)
     , m_state(StoppedState)
diff --git a/src/plugins/winrt/winrtruncontrol.h b/src/plugins/winrt/winrtruncontrol.h
index 9b63fe89c32d2fe13362293d802db2e03cfc9e59..ed25928687b0b6991cba44250d492ac18f93aaa0 100644
--- a/src/plugins/winrt/winrtruncontrol.h
+++ b/src/plugins/winrt/winrtruncontrol.h
@@ -54,7 +54,7 @@ class WinRtRunControl : public ProjectExplorer::RunControl
 {
     Q_OBJECT
 public:
-    explicit WinRtRunControl(WinRtRunConfiguration *runConfiguration, ProjectExplorer::RunMode mode);
+    explicit WinRtRunControl(WinRtRunConfiguration *runConfiguration, Core::Id mode);
 
     void start();
     StopResult stop();
diff --git a/src/plugins/winrt/winrtrunfactories.cpp b/src/plugins/winrt/winrtrunfactories.cpp
index 14336fb530694133748dc2263b9e555b2f15adf2..859ca9c1b441d1bf5fc451385eb741bf8fc05f62 100644
--- a/src/plugins/winrt/winrtrunfactories.cpp
+++ b/src/plugins/winrt/winrtrunfactories.cpp
@@ -137,7 +137,7 @@ WinRtRunControlFactory::WinRtRunControlFactory()
 }
 
 bool WinRtRunControlFactory::canRun(RunConfiguration *runConfiguration,
-        RunMode mode) const
+        Core::Id mode) const
 {
     if (!runConfiguration)
         return false;
@@ -145,35 +145,32 @@ bool WinRtRunControlFactory::canRun(RunConfiguration *runConfiguration,
     if (!device)
         return false;
 
-    switch (mode) {
-    case DebugRunMode:
-    case DebugRunModeWithBreakOnMain:
+    if (mode == ProjectExplorer::Constants::DEBUG_RUN_MODE
+            || mode == ProjectExplorer::Constants::DEBUG_RUN_MODE_WITH_BREAK_ON_MAIN) {
         if (device->type() != Constants::WINRT_DEVICE_TYPE_LOCAL)
             return false;
-        // fall through
-    case NormalRunMode:
         return qobject_cast<WinRtRunConfiguration *>(runConfiguration);
-    default:
-        return false;
     }
+
+    if (mode == ProjectExplorer::Constants::NORMAL_RUN_MODE)
+        return qobject_cast<WinRtRunConfiguration *>(runConfiguration);
+
+    return false;
 }
 
 RunControl *WinRtRunControlFactory::create(
-        RunConfiguration *runConfiguration, RunMode mode, QString *errorMessage)
+        RunConfiguration *runConfiguration, Core::Id mode, QString *errorMessage)
 {
     WinRtRunConfiguration *rc = qobject_cast<WinRtRunConfiguration *>(runConfiguration);
     QTC_ASSERT(rc, return 0);
 
-    switch (mode) {
-    case NormalRunMode:
+    if (mode == ProjectExplorer::Constants::NORMAL_RUN_MODE)
         return new WinRtRunControl(rc, mode);
-    case DebugRunMode:
-    case DebugRunModeWithBreakOnMain:
+
+    if (mode == ProjectExplorer::Constants::DEBUG_RUN_MODE || mode == ProjectExplorer::Constants::DEBUG_RUN_MODE_WITH_BREAK_ON_MAIN)
         return WinRtDebugSupport::createDebugRunControl(rc, mode, errorMessage);
-    default:
-        break;
-    }
-    *errorMessage = tr("Unsupported run mode %1.").arg(mode);
+
+    *errorMessage = tr("Unsupported run mode %1.").arg(mode.toString());
     return 0;
 }
 
diff --git a/src/plugins/winrt/winrtrunfactories.h b/src/plugins/winrt/winrtrunfactories.h
index 0e310e88d78e47c75b5355b02836ed4b71a26c7a..b77868bab341665c88feb2627ebc7239686da778 100644
--- a/src/plugins/winrt/winrtrunfactories.h
+++ b/src/plugins/winrt/winrtrunfactories.h
@@ -64,9 +64,9 @@ class WinRtRunControlFactory : public ProjectExplorer::IRunControlFactory
 public:
     WinRtRunControlFactory();
     bool canRun(ProjectExplorer::RunConfiguration *runConfiguration,
-                ProjectExplorer::RunMode mode) const;
+                Core::Id mode) const;
     ProjectExplorer::RunControl *create(ProjectExplorer::RunConfiguration *runConfiguration,
-                       ProjectExplorer::RunMode mode, QString *errorMessage);
+                       Core::Id mode, QString *errorMessage);
     QString displayName() const;
 };