MCPcopy Create free account
hub / github.com/KDE/kdevelop / contextMenuExtension

Method contextMenuExtension

plugins/clangtidy/tests/data/nihon_plugin.cpp:383–399  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

381}
382
383KDevelop::ContextMenuExtension Plugin::contextMenuExtension(KDevelop::Context* context)
384{
385 KDevelop::IDocument* doc = core()->documentController()->activeDocument();
386 KDevelop::ContextMenuExtension extension = KDevelop::IPlugin::contextMenuExtension(context);
387
388 if (context->type() == KDevelop::Context::EditorContext) {
389
390 auto mime = doc->mimeType().name();
391 if (mime == QLatin1String("text/x-c++src") || mime == QLatin1String("text/x-csrc")) {
392 QAction* action
393 = new QAction(QIcon::fromTheme("document-new"), i18n("Check current unit with clang-tidy"), this);
394 connect(action, SIGNAL(triggered(bool)), this, SLOT(runClangTidyFile()));
395 extension.addAction(KDevelop::ContextMenuExtension::AnalyzeGroup, action);
396 }
397 }
398 return extension;
399}
400
401KDevelop::ConfigPage* Plugin::perProjectConfigPage(int number, const ProjectConfigOptions& options, QWidget* parent)
402{

Callers

nothing calls this directly

Calls 6

activeDocumentMethod · 0.80
documentControllerMethod · 0.80
typeMethod · 0.45
nameMethod · 0.45
mimeTypeMethod · 0.45
addActionMethod · 0.45

Tested by

no test coverage detected