use of com.intellij.openapi.ui.JBMenuItem in project intellij-community by JetBrains.
the class TabbedLanguageCodeStylePanel method fillLanguages.
private void fillLanguages(JComponent parentMenu) {
Language[] languages = LanguageCodeStyleSettingsProvider.getLanguagesWithCodeStyleSettings();
@SuppressWarnings("UnnecessaryFullyQualifiedName") java.util.List<JMenuItem> langItems = new ArrayList<>();
for (final Language lang : languages) {
if (!lang.equals(getDefaultLanguage())) {
final String langName = LanguageCodeStyleSettingsProvider.getLanguageName(lang);
JMenuItem langItem = new JBMenuItem(langName);
langItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
applyLanguageSettings(lang);
}
});
langItems.add(langItem);
}
}
Collections.sort(langItems, (item1, item2) -> item1.getText().compareToIgnoreCase(item2.getText()));
for (JMenuItem langItem : langItems) {
parentMenu.add(langItem);
}
}
Aggregations