@Nullable
  public static XSourcePosition getCaretPosition(@NotNull Project project, DataContext context) {
    Editor editor = getEditor(project, context);
    if (editor == null) return null;

    Integer lineNumber = LINE_NUMBER.getData(context);
    if (lineNumber != null) {
      return XSourcePositionImpl.create(editor.getVirtualFile(), lineNumber);
    }
    Integer offsetFromDataContext = OFFSET.getData(context);
    if (offsetFromDataContext != null) {
      return XSourcePositionImpl.createByOffset(editor.getVirtualFile(), offsetFromDataContext);
    }

    final Document document = editor.getDocument();
    int offset = editor.getCaretModel().getOffset();
    VirtualFile file = FileDocumentManager.getInstance().getFile(document);
    return XSourcePositionImpl.createByOffset(file, offset);
  }
@Nullable
  public static XSourcePosition getCaretPosition(@NotNull Project project, DataContext context)