diff --git a/src/plugins/valgrind/callgrindtool.cpp b/src/plugins/valgrind/callgrindtool.cpp index ec67a51b8be..d13659146e2 100644 --- a/src/plugins/valgrind/callgrindtool.cpp +++ b/src/plugins/valgrind/callgrindtool.cpp @@ -782,16 +782,11 @@ void CallgrindTool::updateRunActions() m_startAction->setToolTip(tr("A Valgrind Callgrind analysis is still in progress.")); m_stopAction->setEnabled(true); } else { - const bool projectUsable = SessionManager::startupProject() != 0; - if (projectUsable) { - m_startAction->setEnabled(true); - m_startAction->setToolTip(tr("Start a Valgrind Callgrind analysis.")); - m_stopAction->setEnabled(false); - } else { - m_startAction->setEnabled(false); - m_startAction->setToolTip(tr("Start a Valgrind Callgrind analysis.")); - m_stopAction->setEnabled(false); - } + QString whyNot = tr("Start a Valgrind Callgrind analysis."); + bool canRun = ProjectExplorerPlugin::canRunStartupProject(CALLGRIND_RUN_MODE, &whyNot); + m_startAction->setToolTip(whyNot); + m_startAction->setEnabled(canRun); + m_stopAction->setEnabled(false); } } void CallgrindTool::clearTextMarks() diff --git a/src/plugins/valgrind/memchecktool.cpp b/src/plugins/valgrind/memchecktool.cpp index 4e45c58fde6..a0e4b539d1d 100644 --- a/src/plugins/valgrind/memchecktool.cpp +++ b/src/plugins/valgrind/memchecktool.cpp @@ -480,18 +480,15 @@ void MemcheckTool::updateRunActions() m_startWithGdbAction->setToolTip(tr("A Valgrind Memcheck analysis is still in progress.")); m_stopAction->setEnabled(true); } else { - const bool projectUsable = SessionManager::startupProject() != 0; - m_startAction->setToolTip(tr("Start a Valgrind Memcheck analysis.")); - m_startWithGdbAction->setToolTip(tr("Start a Valgrind Memcheck with GDB analysis.")); - if (projectUsable) { - m_startAction->setEnabled(true); - m_startWithGdbAction->setEnabled(true); - m_stopAction->setEnabled(false); - } else { - m_startAction->setEnabled(false); - m_startWithGdbAction->setEnabled(false); - m_stopAction->setEnabled(false); - } + QString whyNot = tr("Start a Valgrind Memcheck analysis."); + bool canRun = ProjectExplorerPlugin::canRunStartupProject(MEMCHECK_RUN_MODE, &whyNot); + m_startAction->setToolTip(whyNot); + m_startAction->setEnabled(canRun); + whyNot = tr("Start a Valgrind Memcheck with GDB analysis."); + canRun = ProjectExplorerPlugin::canRunStartupProject(MEMCHECK_WITH_GDB_RUN_MODE, &whyNot); + m_startWithGdbAction->setToolTip(whyNot); + m_startWithGdbAction->setEnabled(canRun); + m_stopAction->setEnabled(false); } }