void () { ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> { ProgressIndicator progressIndicator = ProgressManager.getInstance().getProgressIndicator(); progressIndicator.setIndeterminate(false); // let's do result a bit more predictable final List<String> dictionaries = new ArrayList<>(myDict2FolderMap.keySet()); // ruby dictionary generate(myDefaultDictName, progressIndicator); progressIndicator.setFraction(1. / (dictionaries.size() + 1)); // other gem-related dictionaries in alphabet order Collections.sort(dictionaries); for (int i = 0; i < dictionaries.size(); i++) { String dict = dictionaries.get(i); if (myDefaultDictName.equals(dict)) { continue; } generate(dict, progressIndicator); progressIndicator.setFraction(i / (dictionaries.size() + 1.)); } }, SpellCheckerBundle.message("dictionary.generator.progress.title"), true, myProject); }