mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
sort case-insensitively and cleanup
This commit is contained in:
+8
-8
@@ -25,7 +25,7 @@ import com.intellij.openapi.fileTypes.SyntaxHighlighterFactory;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.ComboBox;
|
||||
import com.intellij.ui.AncestorListenerAdapter;
|
||||
import com.intellij.ui.ColoredListCellRendererWrapper;
|
||||
import com.intellij.ui.ColoredListCellRenderer;
|
||||
import com.intellij.ui.EditorTextField;
|
||||
import com.intellij.ui.SimpleTextAttributes;
|
||||
import org.intellij.plugins.intelliLang.inject.InjectedLanguage;
|
||||
@@ -42,7 +42,7 @@ import java.util.Set;
|
||||
|
||||
public class LanguagePanel extends AbstractInjectionPanel<BaseInjection> {
|
||||
private JPanel myRoot;
|
||||
private ComboBox myLanguage;
|
||||
private ComboBox<String> myLanguage;
|
||||
private EditorTextField myPrefix;
|
||||
private EditorTextField mySuffix;
|
||||
|
||||
@@ -51,14 +51,14 @@ public class LanguagePanel extends AbstractInjectionPanel<BaseInjection> {
|
||||
$$$setupUI$$$();
|
||||
|
||||
final String[] languageIDs = InjectedLanguage.getAvailableLanguageIDs();
|
||||
Arrays.sort(languageIDs);
|
||||
Arrays.sort(languageIDs, String::compareToIgnoreCase);
|
||||
|
||||
myLanguage.setModel(new DefaultComboBoxModel(languageIDs));
|
||||
myLanguage.setRenderer(new ColoredListCellRendererWrapper<String>() {
|
||||
myLanguage.setModel(new DefaultComboBoxModel<>(languageIDs));
|
||||
myLanguage.setRenderer(new ColoredListCellRenderer<String>() {
|
||||
final Set<String> IDs = new HashSet<>(Arrays.asList(languageIDs));
|
||||
|
||||
@Override
|
||||
protected void doCustomize(JList list, String s, int index, boolean selected, boolean hasFocus) {
|
||||
protected void customizeCellRenderer(JList list, String s, int index, boolean selected, boolean hasFocus) {
|
||||
final SimpleTextAttributes attributes =
|
||||
IDs.contains(s) ? SimpleTextAttributes.REGULAR_ATTRIBUTES : SimpleTextAttributes.ERROR_ATTRIBUTES;
|
||||
append(s, attributes);
|
||||
@@ -91,7 +91,7 @@ public class LanguagePanel extends AbstractInjectionPanel<BaseInjection> {
|
||||
});
|
||||
}
|
||||
|
||||
private void updateHighlighters() {
|
||||
void updateHighlighters() {
|
||||
final EditorImpl editor = ((EditorImpl)myPrefix.getEditor());
|
||||
if (editor == null) return;
|
||||
|
||||
@@ -117,7 +117,7 @@ public class LanguagePanel extends AbstractInjectionPanel<BaseInjection> {
|
||||
}
|
||||
|
||||
public void setLanguage(String id) {
|
||||
final DefaultComboBoxModel model = (DefaultComboBoxModel)myLanguage.getModel();
|
||||
final DefaultComboBoxModel<String> model = (DefaultComboBoxModel)myLanguage.getModel();
|
||||
if (model.getIndexOf(id) == -1 && id.length() > 0) {
|
||||
model.insertElementAt(id, 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user