SourcePosition (@Nullable XSourcePosition position, Project project) { if (position != null) { if (position instanceof JavaXSourcePosition) { return ((JavaXSourcePosition)position).mySourcePosition; } PsiFile psiFile = getPsiFile(position, project); if (psiFile != null) { return SourcePosition.createFromOffset(psiFile, position.getOffset()); } } return null; }