void (JComponent parentMenu) { List<Language> languages = getProvider() != null ? getProvider().getApplicableLanguages() : Collections.emptyList(); for (final Language lang : languages) { if (!lang.equals(getDefaultLanguage())) { final String langName = LanguageCodeStyleSettingsProvider.getLanguageName(lang); JMenuItem langItem = new JBMenuItem(langName); langItem.addActionListener(__ -> applyLanguageSettings(lang)); parentMenu.add(langItem); } } }