private static void updateRefs(List<UsageInfo> usages, final String memberName, final GrImportStatement updatedImport) {

    if (updatedImport == null) return;

    final String name = ReadAction.compute(() -> updatedImport.getImportedName());

    for (final UsageInfo usage : usages) {
      ApplicationManager.getApplication().runWriteAction(() -> {
        final PsiElement usageElement = usage.getElement();
        if (usageElement == null) return;

        if (usageElement.getParent() instanceof GrImportStatement) return;

        if (usageElement instanceof GrReferenceElement ref) {
          final PsiElement qualifier = ref.getQualifier();

          if (qualifier == null) {
            final String refName = ref.getReferenceName();
            if (refName == null) return;

            if (memberName.equals(refName)) {
              ref.handleElementRename(name);
            }
            else if (refName.equals(GroovyPropertyUtils.getPropertyNameByAccessorName(memberName))) {
              final String newPropName = GroovyPropertyUtils.getPropertyNameByAccessorName(name);
              if (newPropName != null) {
                ref.handleElementRename(newPropName);
              }
              else {
                ref.handleElementRename(name);
              }
            }
            else if (refName.equals(GroovyPropertyUtils.getGetterNameBoolean(memberName))) {
              final String getterName = GroovyPropertyUtils.getGetterNameBoolean(name);
              ref.handleElementRename(getterName);
            }
            else if (refName.equals(GroovyPropertyUtils.getGetterNameNonBoolean(memberName))) {
              final String getterName = GroovyPropertyUtils.getGetterNameNonBoolean(name);
              ref.handleElementRename(getterName);
            }
            else if (refName.equals(GroovyPropertyUtils.getSetterName(memberName))) {
              final String getterName = GroovyPropertyUtils.getSetterName(name);
              ref.handleElementRename(getterName);
            }
          }
        }
      });
    }
  }
private static void updateRefs(List<UsageInfo> usages, final String memberName, final GrImportStatement updatedImport)