@Override @Nullable public String getShortClassName() { final SourcePosition pos = getSourcePosition(); if (pos != null) { if (pos.getFile() instanceof JspFile) { return getClassName(); } } return super.getShortClassName(); }
@Nullable public Document getDocument() { final RangeHighlighter highlighter = getHighlighter(); if (highlighter != null) { return highlighter.getDocument(); } final SourcePosition position = getSourcePosition(); if (position != null) { final PsiFile file = position.getFile(); return PsiDocumentManager.getInstance(getProject()).getDocument(file); } return null; }
public boolean canMoveTo(@Nullable final SourcePosition position) { if (position == null || !position.getFile().isValid()) { return false; } final PsiFile psiFile = position.getFile(); final Document document = PsiDocumentManager.getInstance(getProject()).getDocument(psiFile); if (document == null) { return false; } final int spOffset = position.getOffset(); if (spOffset < 0) { return false; } final BreakpointManager breakpointManager = DebuggerManagerEx.getInstanceEx(getProject()).getBreakpointManager(); return breakpointManager.findBreakpoint(document, spOffset, getCategory()) == null; }
@Override public void reload() { ApplicationManager.getApplication().assertReadAccessAllowed(); XSourcePosition position = myXBreakpoint.getSourcePosition(); PsiFile psiFile = getPsiFile(); if (position != null && psiFile != null) { mySourcePosition = SourcePosition.createFromLine(psiFile, position.getLine()); reload(psiFile); } else { mySourcePosition = null; } }
@Override public void reload() { ApplicationManager.getApplication().assertReadAccessAllowed(); final XSourcePosition position = myXBreakpoint.getSourcePosition(); try { final PsiFile psiFile = PsiManager.getInstance(myProject).findFile(position.getFile()); mySourcePosition = SourcePosition.createFromOffset(psiFile, position.getOffset()); } catch (Exception e) { mySourcePosition = null; } reload(BreakpointManager.getPsiFile(myXBreakpoint, myProject)); }
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; }