int () { if (myPsiFileRange != null) { final Segment range = myPsiFileRange.getRange(); if (range != null) { return range.getStartOffset(); } } PsiElement element = getElement(); if (element == null) return -1; PsiFile psiFile = getFile(); boolean isNullOrBinary = psiFile == null || psiFile.getFileType().isBinary(); if (isNullOrBinary) return 0; TextRange range = element.getTextRange(); TextRange rangeInElement = getRangeInElement(); if (rangeInElement == null) return -1; return range.getStartOffset() + rangeInElement.getStartOffset(); }