public int getLine() { return mySourcePosition.getLine(); }
@Nullable @Override public XSmartStepIntoHandler<?> getSmartStepIntoHandler() { return super.getSmartStepIntoHandler(); }
@NotNull @Override public XDebugTabLayouter createTabLayouter() { return super.createTabLayouter(); }
@Override public void registerBreakpoint(@NotNull XLineBreakpoint<DlvBreakpointProperties> breakpoint) { XSourcePosition breakpointPosition = breakpoint.getSourcePosition(); if (breakpointPosition == null) return; VirtualFile file = breakpointPosition.getFile(); int line = breakpointPosition.getLine(); send(new DlvRequest.CreateBreakpoint(file.getPath(), line + 1)) .done(b -> { breakpoint.putUserData(ID, b.id); breakpoints.put(b.id, breakpoint); getSession().updateBreakpointPresentation(breakpoint, AllIcons.Debugger.Db_verified_breakpoint, null); }) .rejected(t -> { String message = t == null ? null : t.getMessage(); getSession().updateBreakpointPresentation(breakpoint, AllIcons.Debugger.Db_invalid_breakpoint, message); }); }
@Nullable private XSourcePosition findPosition() { XDebugSession debugSession = getSession(); if (debugSession == null) return null; XStackFrame stackFrame = debugSession.getCurrentStackFrame(); if (stackFrame == null) return null; Project project = debugSession.getProject(); XSourcePosition position = debugSession.getCurrentPosition(); Editor editor = ((FileEditorManagerImpl)FileEditorManager.getInstance(project)).getSelectedTextEditor(true); if (editor == null || position == null) return null; String name = myName.startsWith("&") ? myName.replaceFirst("\\&", "") : myName; PsiElement resolved = findTargetElement(project, position, editor, name); if (resolved == null) return null; VirtualFile virtualFile = resolved.getContainingFile().getVirtualFile(); return XDebuggerUtil.getInstance().createPositionByOffset(virtualFile, resolved.getTextOffset()); } });
@Nullable @Override public XSourcePosition getSourcePosition() { VirtualFile file = findFile(); return file == null ? null : XDebuggerUtil.getInstance().createPosition(file, myLocation.line - 1); }
@NotNull public VirtualFile getFile() { return mySourcePosition.getFile(); }
private static boolean isLineBreakpointAvailable(@NotNull VirtualFile file, int line, @NotNull Project project) { Document document = FileDocumentManager.getInstance().getDocument(file); if (document == null || document.getLineEndOffset(line) == document.getLineStartOffset(line)) return false; Checker canPutAtChecker = new Checker(); XDebuggerUtil.getInstance().iterateLine(project, document, line, canPutAtChecker); return canPutAtChecker.isLineBreakpointAvailable(); }
@Override public void registerBreakpoint(@NotNull XLineBreakpoint<BallerinaBreakpointProperties> breakpoint) { XSourcePosition breakpointPosition = breakpoint.getSourcePosition(); if (breakpointPosition == null) { return; } breakpoints.add(breakpoint); sendBreakpoints(); getSession().updateBreakpointPresentation(breakpoint, AllIcons.Debugger.Db_verified_breakpoint, null); }
@Nullable private Project getProject() { XDebugSession session = getSession(); return session != null ? session.getProject() : null; }
@Override public void stop() { if (getVm() != null) { send(new DlvRequest.Detach(true)); } getSession().stop(); }
private void doSetBreakpoints() { AccessToken token = ReadAction.start(); try { getSession().initBreakpoints(); } finally { token.finish(); } }
@Override public void registerAdditionalActions(@NotNull DefaultActionGroup leftToolbar, @NotNull DefaultActionGroup topToolbar, @NotNull DefaultActionGroup settings) { super.registerAdditionalActions(leftToolbar, topToolbar, settings); topToolbar.remove(ActionManager.getInstance().getAction(XDebuggerActions.RUN_TO_CURSOR)); } }
public BallerinaDebugProcess(@NotNull XDebugSession session, @NotNull BallerinaWebSocketConnector connector, @Nullable ExecutionResult executionResult) { super(session); myConnector = connector; myProcessHandler = executionResult == null ? super.getProcessHandler() : executionResult.getProcessHandler(); myExecutionConsole = executionResult == null ? super.createConsole() : executionResult.getExecutionConsole(); myEditorsProvider = new BallerinaDebuggerEditorsProvider(); myBreakPointHandler = new BallerinaBreakpointHandler(); if (executionResult == null) { isRemoteDebugMode = true; } }
@Nullable @Override public HyperlinkListener getCurrentStateHyperlinkListener() { return super.getCurrentStateHyperlinkListener(); }
@Nullable @Override public XValueMarkerProvider<?, ?> createValueMarkerProvider() { return super.createValueMarkerProvider(); }
@Nullable @Override public XDebuggerEvaluator getEvaluator() { return super.getEvaluator(); }
/** * Returns the source position. This is used to show the debug hit in the file. */ @Nullable @Override public XSourcePosition getSourcePosition() { VirtualFile file = findFile(); return file == null ? null : XDebuggerUtil.getInstance().createPosition(file, myFrame.getLineID() - 1); }
private void doSetBreakpoints() { AccessToken token = ReadAction.start(); try { getSession().initBreakpoints(); } finally { token.finish(); token.close(); } }
@Nullable public static SourcePosition create(@NotNull String filePath, int line) { VirtualFile file = LocalFileSystem.getInstance().findFileByPath(filePath); XSourcePosition sourcePosition = XDebuggerUtil.getInstance().createPosition(file, line); if (sourcePosition != null) { return new SourcePosition(sourcePosition); } else { return null; } }