FileEditorLocation () { VirtualFile virtualFile = getFile(); if (virtualFile == null) return null; Project project = getPointer().getProject(); FileEditor editor = FileEditorManager.getInstance(project).getSelectedEditor(virtualFile); if (!(editor instanceof TextEditor)) return null; Segment segment = getPointer().getPsiRange(); if (segment == null) return null; return new TextEditorLocation(segment.getStartOffset(), (TextEditor)editor); }