public void arrange(@NotNull PsiFile file, @NotNull Collection<? extends TextRange> ranges, final @Nullable ArrangementCallback callback) {
    myCodeChanged = false;

    final Document document = PsiDocumentManager.getInstance(file.getProject()).getDocument(file);
    if (document == null || !document.isWritable()) {
      return;
    }

    final Rearranger<?> rearranger = Rearranger.EXTENSION.forLanguage(file.getLanguage());
    if (rearranger == null) {
      return;
    }

    final CodeStyleSettings settings = CodeStyle.getSettings(file);
    if (settings.getExcludedFiles().contains(file)) {
      return;
    }

    ArrangementSettings arrangementSettings = ArrangementUtil.getArrangementSettings(settings, file.getLanguage());

    if (arrangementSettings == null) {
      return;
    }

    Context<? extends ArrangementEntry> context =
    DumbService.getInstance(file.getProject()).computeWithAlternativeResolveEnabled(() -> Context.from(rearranger, document, file, ranges, arrangementSettings, settings));

    ApplicationManager.getApplication().runWriteAction(() -> VcsFacade.getInstance().runHeavyModificationTask(file.getProject(), document, () -> {
      doArrange(context);
      if (callback != null) {
        callback.afterArrangement(context.moveInfos);
      }
    }));
  }
public void arrange(@NotNull PsiFile file, @NotNull Collection<? extends TextRange> ranges, final @Nullable ArrangementCallback callback)