public BreakpointWithHighlighter(
     @NotNull final Project project,
     @NotNull final RangeHighlighter highlighter,
     XBreakpoint breakpoint) {
   super(project, breakpoint);
   myHighlighter = highlighter;
   setEditorFilter(highlighter);
   reload();
 }
 @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;
  }
  private void update(@NotNull List<BreakpointWithHighlighter> breakpoints) {
    final TIntHashSet intHash = new TIntHashSet();
    for (BreakpointWithHighlighter breakpoint : breakpoints) {
      SourcePosition sourcePosition = breakpoint.getSourcePosition();
      breakpoint.reload();

      if (breakpoint.isValid()) {
        if (sourcePosition == null
            || breakpoint.getSourcePosition().getLine() != sourcePosition.getLine()) {
          fireBreakpointChanged(breakpoint);
        }

        if (intHash.contains(breakpoint.getLineIndex())) {
          remove(breakpoint);
        } else {
          intHash.add(breakpoint.getLineIndex());
        }
      } else {
        remove(breakpoint);
      }
    }
  }
 protected BreakpointWithHighlighter(@NotNull Project project, XBreakpoint xBreakpoint) {
   // for persistency
   super(project, xBreakpoint);
   reload();
 }
 protected void reload(PsiFile file) {
   super.reload(file);
   myMethodName = findMethodName(file, getHighlighter().getStartOffset());
 }