aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/autotest/autotestplugin.cpp
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2018-04-13 10:54:42 +0200
committerEike Ziller <eike.ziller@qt.io>2018-04-13 10:54:42 +0200
commit428fcb476ba2c5bbe1d16dfe437e510dafce1777 (patch)
tree10b130ef79d87dd1339004857c8f1e31e29c3f95 /src/plugins/autotest/autotestplugin.cpp
parent9e29a32e1ab3af42a4d70984449ba33b3092a50b (diff)
parentf4594c922fe3ffcfaf715cf09622ba48c3d1d620 (diff)
Merge remote-tracking branch 'origin/4.6'
Conflicts: src/libs/utils/settingsaccessor.cpp src/plugins/autotest/autotestplugin.cpp src/plugins/git/gitclient.cpp src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp src/plugins/qbsprojectmanager/qbsrunconfiguration.h Change-Id: I65f143cad18af509a2621d6c5925abbd038ea70f
Diffstat (limited to 'src/plugins/autotest/autotestplugin.cpp')
-rw-r--r--src/plugins/autotest/autotestplugin.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/plugins/autotest/autotestplugin.cpp b/src/plugins/autotest/autotestplugin.cpp
index 6d6957c83c..d7bb68cdec 100644
--- a/src/plugins/autotest/autotestplugin.cpp
+++ b/src/plugins/autotest/autotestplugin.cpp
@@ -53,6 +53,8 @@
#include <projectexplorer/buildmanager.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectexplorericons.h>
+#include <projectexplorer/session.h>
+#include <projectexplorer/target.h>
#include <texteditor/texteditor.h>
#include <utils/textutils.h>
#include <utils/utilsicons.h>
@@ -248,12 +250,16 @@ void AutotestPlugin::onRunUnderCursorTriggered(TestRunMode mode)
void AutotestPlugin::updateMenuItemsEnabledState()
{
+ const ProjectExplorer::Project *project = ProjectExplorer::SessionManager::startupProject();
+ const ProjectExplorer::Target *target = project ? project->activeTarget() : nullptr;
const bool canScan = !TestRunner::instance()->isTestRunning()
&& TestTreeModel::instance()->parser()->state() == TestCodeParser::Idle;
const bool hasTests = TestTreeModel::instance()->hasTests();
+ // avoid expensive call to PE::canRunStartupProject() - limit to minimum necessary checks
const bool canRun = hasTests && canScan
- && ProjectExplorer::ProjectExplorerPlugin::canRunStartupProject(
- ProjectExplorer::Constants::NORMAL_RUN_MODE);
+ && project && !project->needsConfiguration()
+ && target && target->activeRunConfiguration()
+ && !ProjectExplorer::BuildManager::isBuilding();
ActionManager::command(Constants::ACTION_RUN_ALL_ID)->action()->setEnabled(canRun);
ActionManager::command(Constants::ACTION_RUN_SELECTED_ID)->action()->setEnabled(canRun);