public boolean moveTo(@NotNull SourcePosition position) { if (!canMoveTo(position)) { return false; } final PsiFile psiFile = position.getFile(); final PsiFile oldFile = getSourcePosition().getFile(); final Document document = PsiDocumentManager.getInstance(getProject()).getDocument(psiFile); final Document oldDocument = PsiDocumentManager.getInstance(getProject()).getDocument(oldFile); if (document == null || oldDocument == null) { return false; } final RangeHighlighter newHighlighter = createHighlighter(myProject, document, position.getLine()); if (newHighlighter == null) { return false; } final RangeHighlighter oldHighlighter = myHighlighter; myHighlighter = newHighlighter; reload(); if (!isValid()) { myHighlighter.dispose(); myHighlighter = oldHighlighter; reload(); return false; } if (oldHighlighter != null) { oldHighlighter.dispose(); } DebuggerManagerEx.getInstanceEx(getProject()) .getBreakpointManager() .fireBreakpointChanged(this); updateUI(); return true; }
public int getLineIndex() { final SourcePosition sourcePosition = getSourcePosition(); return sourcePosition != null ? sourcePosition.getLine() : -1; }