MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / showMarginMenu

Method showMarginMenu

src/plugins/codeeditor/gui/private/texteditor_p.cpp:413–442  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

411}
412
413void TextEditorPrivate::showMarginMenu()
414{
415 QMenu menu;
416 int line = 0, index = 0;
417 q->getCursorPosition(&line, &index);
418
419 if (q->hasBreakpoint(line)) {
420 menu.addAction(tr("Remove Breakpoint"), q, [this, line] { q->removeBreakpoint(line); });
421 if (q->breakpointEnabled(line))
422 menu.addAction(tr("Disable Breakpoint"), q, [this, line] { q->setBreakpointEnabled(line, false); });
423 else
424 menu.addAction(tr("Enable Breakpoint"), q, [this, line] { q->setBreakpointEnabled(line, true); });
425 menu.addAction(tr("Add Condition"), q, [this, line] { q->setBreakpointCondition(line); });
426 } else {
427 static QString text(tr("Add a breakpoint on line %1"));
428 menu.addAction(text.arg(line + 1), q, [this, line] { q->addBreakpoint(line); });
429 }
430
431 auto &ctx = dpfInstance.serviceContext();
432 DebuggerService *debuggerService = ctx.service<DebuggerService>(DebuggerService::name());
433 if (debuggerService->getDebugState() == AbstractDebugger::RunState::kStopped) {
434 menu.addSeparator();
435 menu.addAction(tr("jump to %1 line").arg(line + 1), q, [this, line] { editor.jumpToLine(fileName, line); });
436 menu.addAction(tr("run to %1 line").arg(line + 1), q, [this, line] { editor.runToLine(fileName, line); });
437 }
438
439 // notify other plugin to add action.
440 editor.marginMenu(QVariant::fromValue(&menu));
441 menu.exec(QCursor::pos());
442}
443
444void TextEditorPrivate::gotoNextMark(uint mask)
445{

Callers 1

contextMenuEventMethod · 0.80

Calls 13

getCursorPositionMethod · 0.80
hasBreakpointMethod · 0.80
breakpointEnabledMethod · 0.80
addSeparatorMethod · 0.80
runToLineMethod · 0.80
nameFunction · 0.50
addActionMethod · 0.45
removeBreakpointMethod · 0.45
setBreakpointEnabledMethod · 0.45
addBreakpointMethod · 0.45
jumpToLineMethod · 0.45

Tested by

no test coverage detected