diff options
-rw-r--r-- | plugins/autotest/autotestplugin.cpp | 9 | ||||
-rw-r--r-- | plugins/autotest/testcodeparser.cpp | 14 |
2 files changed, 15 insertions, 8 deletions
diff --git a/plugins/autotest/autotestplugin.cpp b/plugins/autotest/autotestplugin.cpp index 724841f025..a2ab783418 100644 --- a/plugins/autotest/autotestplugin.cpp +++ b/plugins/autotest/autotestplugin.cpp @@ -126,8 +126,10 @@ void AutotestPlugin::initializeMenuEntries() TestTreeModel::instance()->parser(), &TestCodeParser::updateTestTree); menu->addAction(command); - ActionManager::actionContainer(Core::Constants::M_TOOLS)->addMenu(menu); - connect(menu->menu(), &QMenu::aboutToShow, this, &AutotestPlugin::updateMenuItemsEnabledState); + ActionContainer *toolsMenu = ActionManager::actionContainer(Core::Constants::M_TOOLS); + toolsMenu->addMenu(menu); + connect(toolsMenu->menu(), &QMenu::aboutToShow, + this, &AutotestPlugin::updateMenuItemsEnabledState); } bool AutotestPlugin::initialize(const QStringList &arguments, QString *errorString) @@ -175,7 +177,8 @@ void AutotestPlugin::onRunSelectedTriggered() void AutotestPlugin::updateMenuItemsEnabledState() { - const bool enabled = !TestRunner::instance()->isTestRunning(); + const bool enabled = !TestRunner::instance()->isTestRunning() + && TestTreeModel::instance()->parser()->state() == TestCodeParser::Idle; const bool hasTests = TestTreeModel::instance()->hasTests(); ActionManager::command(Constants::ACTION_RUN_ALL_ID)->action()->setEnabled(enabled && hasTests); diff --git a/plugins/autotest/testcodeparser.cpp b/plugins/autotest/testcodeparser.cpp index c3ae634b59..8c0b7b43d7 100644 --- a/plugins/autotest/testcodeparser.cpp +++ b/plugins/autotest/testcodeparser.cpp @@ -86,10 +86,15 @@ ProjectExplorer::Project *currentProject() void TestCodeParser::setState(State state) { - m_parserState = state; // avoid triggering parse before code model parsing has finished if (!m_parserEnabled) return; + + if ((state == Disabled || state == Idle) + && (m_parserState == PartialParse || m_parserState == FullParse)) + return; + m_parserState = state; + if (m_parserState == Disabled) { m_fullUpdatePostponed = m_partialUpdatePostponed = false; m_postponedFiles.clear(); @@ -738,8 +743,8 @@ void TestCodeParser::onAllTasksFinished(Core::Id type) return; m_parserEnabled = true; // avoid illegal parser state if respective widgets became hidden while parsing - if (m_parserState == Disabled) - m_parserState = Idle; + setState(Idle); + if (m_fullUpdatePostponed) updateTestTree(); else if (m_partialUpdatePostponed) { @@ -902,8 +907,7 @@ void TestCodeParser::onProFileEvaluated() foreach (auto projectFile, p->files) files.append(projectFile.path); // avoid illegal parser state when respective widgets became hidden while evaluating - if (m_parserState == Disabled) - m_parserState = Idle; + setState(Idle); scanForTests(files); } } |