From 362b4d74fc0d87b97fd62f5277663d3e4970f7cb Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Tue, 22 Apr 2014 12:26:47 +0400 Subject: [PATCH] IDEA-123986 New project wizard: remove highlighting from disabled templates --- .../ide/projectWizard/ProjectTemplateList.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectTemplateList.java b/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectTemplateList.java index 3c6d456b420f..57918b1843d1 100644 --- a/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectTemplateList.java +++ b/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectTemplateList.java @@ -25,8 +25,8 @@ import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.util.text.StringUtil; import com.intellij.platform.ProjectTemplate; import com.intellij.platform.templates.ArchivedProjectTemplate; -import com.intellij.ui.*; -import com.intellij.ui.SingleSelectionModel; +import com.intellij.ui.CollectionListModel; +import com.intellij.ui.IdeBorderFactory; import com.intellij.ui.components.JBList; import com.intellij.ui.popup.list.GroupedItemsListRenderer; import com.intellij.util.containers.ContainerUtil; @@ -100,7 +100,6 @@ public class ProjectTemplateList extends JPanel { } }; myList.setCellRenderer(renderer); - myList.setSelectionModel(new SingleSelectionModel()); myList.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { @@ -136,7 +135,9 @@ public class ProjectTemplateList extends JPanel { int index = preserveSelection ? myList.getSelectedIndex() : -1; //noinspection unchecked myList.setModel(new CollectionListModel(list)); - myList.setSelectedIndex(index == -1 ? 0 : index); + if (myList.isEnabled()) { + myList.setSelectedIndex(index == -1 ? 0 : index); + } updateSelection(); } @@ -149,6 +150,12 @@ public class ProjectTemplateList extends JPanel { public void setEnabled(boolean enabled) { super.setEnabled(enabled); myList.setEnabled(enabled); + if (!enabled) { + myList.clearSelection(); + } + else { + myList.setSelectedIndex(0); + } myDescriptionPane.setEnabled(enabled); }