void () { Object source = getSource(); if (source instanceof LanguageFileType) { List<String> extensions = getAllExtensions((LanguageFileType)source); if (extensions.size() > 1) { ExtensionComparator comp = new ExtensionComparator(extensions.get(0)); extensions.sort(comp); SortedComboBoxModel<String> model = new SortedComboBoxModel<>(comp); model.setAll(extensions); myExtensionComboBox.setModel(model); myExtensionComboBox.setVisible(true); myExtensionLabel.setVisible(true); VirtualFile file = myExternalDocument ? FileDocumentManager.getInstance().getFile(myEditor.getDocument()) : null; String fileExt = file == null ? "" : FileUtilRt.getExtension(file.getName()); //NON-NLS if (!fileExt.isEmpty() && extensions.contains(fileExt)) { myExtensionComboBox.setSelectedItem(fileExt); return; } myExtensionComboBox.setSelectedIndex(0); return; } } myExtensionComboBox.setVisible(false); myExtensionLabel.setVisible(false); }