LocalQuickFix[] (boolean useRename, String typo, @Nullable PsiElement element, @NotNull TextRange range) { ArrayList<LocalQuickFix> result = new ArrayList<>(); if (useRename) { result.add(new RenameTo(typo)); } else if (element != null) { result.addAll(new ChangeTo(typo, element, range).getAllAsFixes()); } if (element == null) { result.add(new SaveTo(typo)); return result.toArray(LocalQuickFix.EMPTY_ARRAY); } final SpellCheckerSettings settings = SpellCheckerSettings.getInstance(element.getProject()); if (settings.isUseSingleDictionaryToSave()) { result.add(new SaveTo(typo, DictionaryLevel.getLevelByName(settings.getDictionaryToSave()))); return result.toArray(LocalQuickFix.EMPTY_ARRAY); } result.add(new SaveTo(typo)); return result.toArray(LocalQuickFix.EMPTY_ARRAY); }