private static int offsetOfLine(final PsiFile psiFile, final int lineNumber) {
    final LineTokenizer lineTokenizer = new LineTokenizer(psiFile.getViewProvider().getContents());
    for (int i = 0; i < lineNumber; i++) lineTokenizer.advance();
    return lineTokenizer.getOffset();
  }
private static int offsetOfLine(final PsiFile psiFile, final int lineNumber)