ClangCodeModel: Use ActionBuilder

Change-Id: I40cd7fc9eb346b0b70ea24f980846d175cfde3d4
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2023-11-16 17:04:44 +01:00
parent 9f1d23df00
commit 43e4c7913f

View File

@@ -84,19 +84,11 @@ void ClangCodeModelPlugin::initialize()
CppEditor::CppModelManager::activateClangCodeModel(std::make_unique<ClangModelManagerSupport>()); CppEditor::CppModelManager::activateClangCodeModel(std::make_unique<ClangModelManagerSupport>());
createCompilationDBAction(); createCompilationDBAction();
QAction *const updateStaleIndexEntries ActionBuilder updateStaleIndexEntries(this, "ClangCodeModel.UpdateStaleIndexEntries");
= new QAction(Tr::tr("Update Potentially Stale Clangd Index Entries"), this); updateStaleIndexEntries.setText(Tr::tr("Update Potentially Stale Clangd Index Entries"));
Command * const cmd = ActionManager::registerAction(updateStaleIndexEntries, updateStaleIndexEntries.setOnTriggered(this, &ClangModelManagerSupport::updateStaleIndexEntries);
"ClangCodeModel.UpdateStaleIndexEntries"); updateStaleIndexEntries.setContainer(CppEditor::Constants::M_TOOLS_CPP);
connect(updateStaleIndexEntries, &QAction::triggered, this, updateStaleIndexEntries.setContainer(CppEditor::Constants::M_CONTEXT);
[] { ClangModelManagerSupport::updateStaleIndexEntries(); });
const QList<ActionContainer *> menus;
namespace CppConstants = CppEditor::Constants;
for (ActionContainer * const menu : {ActionManager::actionContainer(CppConstants::M_TOOLS_CPP),
ActionManager::actionContainer(CppConstants::M_CONTEXT)}) {
QTC_ASSERT(menu, continue);
menu->addAction(cmd, CppEditor::Constants::G_GLOBAL);
}
#ifdef WITH_TESTS #ifdef WITH_TESTS
addTest<Tests::ActivationSequenceProcessorTest>(); addTest<Tests::ActivationSequenceProcessorTest>();