From b35ca65801507fc1977e61a4544fea7989fe7d42 Mon Sep 17 00:00:00 2001
From: Aurindam Jana <aurindam.jana@digia.com>
Date: Tue, 12 Mar 2013 16:52:29 +0100
Subject: [PATCH] Debugger: Enable/disable debug button

The debug button should be enabled or disabled after
checking if the project can be run in DebugMode.

Change-Id: I2700c1de290f89bae9456319c2e93857374838ed
Reviewed-by: hjk <hjk121@nokiamail.com>
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
---
 src/plugins/debugger/debuggerplugin.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index a1476292194..0bee5f811b8 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -1575,8 +1575,11 @@ void DebuggerPluginPrivate::onCurrentProjectChanged(Project *project)
     m_interruptAction->setEnabled(false);
     m_continueAction->setEnabled(false);
     m_exitAction->setEnabled(false);
-    m_startAction->setEnabled(true);
-    m_debugWithoutDeployAction->setEnabled(true);
+    ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
+    const bool canRun = pe->canRun(project, DebugRunMode);
+    m_startAction->setEnabled(canRun);
+    m_startAction->setToolTip(canRun ? QString() : pe->cannotRunReason(project, DebugRunMode));
+    m_debugWithoutDeployAction->setEnabled(canRun);
     setProxyAction(m_visibleStartAction, Core::Id(Constants::DEBUG));
 }
 
-- 
GitLab