@Nullable
  public static RefPackage getPackage(RefEntity refEntity) {
    while (refEntity != null && !(refEntity instanceof RefPackage)) {
      if (refEntity instanceof RefElement) {
        ((RefElement)refEntity).initializeIfNeeded();
      }
      refEntity = refEntity.getOwner();
    }

    return (RefPackage)refEntity;
  }
@Nullable
  public static RefPackage getPackage(RefEntity refEntity)