void (@NotNull ProgressIndicator indicator) { ReadAction.run(() -> { myReferences = ReferencesSearch.search(myProperty.myField).findAll(); final Set<PsiElement> occurrences = new HashSet<>(); occurrences.add(myProperty.myField); occurrences.addAll(ContainerUtil.mapNotNull(myReferences, PsiReference::getElement)); myFiles = ContainerUtil.map2SetNotNull(occurrences, element -> { final PsiFile file = element.getContainingFile(); return file != null && file.isPhysical() ? file : null; }); }); WriteCommandAction .runWriteCommandAction(myProject, JavaFXBundle.message("command.name.convert.to.javafx.property", myProperty.myFieldName), null, this::replaceOccurrences, myFiles.toArray(PsiFile.EMPTY_ARRAY)); }