From 74cf4efb8a3cf4c99e11d8a0d77b9188e83ca7e7 Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 17 Jan 2024 15:55:58 +0100 Subject: [PATCH] ClangCodeModel: Use ActionBuilder for Generating Compilation DB action Change-Id: I89d8345351cb6da26b7ae899066a7ddfdb17fe9c Reviewed-by: Eike Ziller --- .../clangcodemodel/clangcodemodelplugin.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/plugins/clangcodemodel/clangcodemodelplugin.cpp b/src/plugins/clangcodemodel/clangcodemodelplugin.cpp index cecdcf67c37..73c2f5d8caf 100644 --- a/src/plugins/clangcodemodel/clangcodemodelplugin.cpp +++ b/src/plugins/clangcodemodel/clangcodemodelplugin.cpp @@ -127,17 +127,16 @@ void ClangCodeModelPlugin::generateCompilationDB() void ClangCodeModelPlugin::createCompilationDBAction() { // generate compile_commands.json - m_generateCompilationDBAction = new ParameterAction( - Tr::tr("Generate Compilation Database"), - Tr::tr("Generate Compilation Database for \"%1\""), - ParameterAction::AlwaysEnabled, this); - Project *startupProject = ProjectManager::startupProject(); - if (startupProject) + ActionBuilder(this, Constants::GENERATE_COMPILATION_DB) + .setParameterText(Tr::tr("Generate Compilation Database for \"%1\""), + Tr::tr("Generate Compilation Database"), + ActionBuilder::AlwaysEnabled) + .bindContextAction(&m_generateCompilationDBAction) + .setCommandAttribute(Command::CA_UpdateText) + .setCommandDescription(m_generateCompilationDBAction->text()); + + if (Project *startupProject = ProjectManager::startupProject()) m_generateCompilationDBAction->setParameter(startupProject->displayName()); - Command *command = ActionManager::registerAction(m_generateCompilationDBAction, - Constants::GENERATE_COMPILATION_DB); - command->setAttribute(Command::CA_UpdateText); - command->setDescription(m_generateCompilationDBAction->text()); connect(&m_generatorWatcher, &QFutureWatcher::finished, this, [this] {