/*
 * Copyright 2000-2009 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.intellij.openapi.projectRoots.impl;

import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.ui.ColoredListCellRenderer;

import javax.swing.*;

/**
 * @author yole
*/
public class SdkListCellRenderer extends ColoredListCellRenderer {
  private String myNullText = "";
  private boolean myShowHomePath;

  public SdkListCellRenderer() {
  }

  public SdkListCellRenderer(final String nullText) {
    myNullText = nullText;
  }

  public SdkListCellRenderer(String nullText, boolean showHomePath) {
    myNullText = nullText;
    myShowHomePath = showHomePath;
  }

  protected void customizeCellRenderer(final JList list,
                                       final Object value,
                                       final int index,
                                       final boolean selected,
                                       final boolean hasFocus) {
    final Sdk sdk = (Sdk) value;
    if (sdk != null) {
      // icon
      setIcon(sdk.getSdkType().getIcon());
      // text
      append(sdk.getName());
      if (myShowHomePath) {
        append(" (" + FileUtil.toSystemDependentName(sdk.getHomePath()) + ")");
      }
    }
    else {
      append(myNullText);
    }
  }
}

@@ -759,23 +759,20 @@
 llij.ui.
-Colored
+Html
 ListCell
@@ -780,16 +780,61 @@
 enderer;
+%0Aimport com.intellij.ui.SimpleTextAttributes;
 %0A%0Aimport
@@ -918,15 +918,12 @@
 nds 
-Colored
+Html
 List
@@ -934,16 +934,21 @@
 Renderer
+%3CSdk%3E
  %7B%0A  pri
@@ -1044,70 +1044,208 @@
 rer(
-) %7B%0A  %7D%0A%0A  public SdkListCellRenderer(final String nullText) %7B
+final ListCellRenderer listCellRenderer) %7B%0A    super(listCellRenderer);%0A  %7D%0A%0A  public SdkListCellRenderer(final String nullText, final ListCellRenderer listCellRenderer) %7B%0A    super(listCellRenderer);
 %0A   
@@ -1302,16 +1302,22 @@
 enderer(
+final 
 String n
@@ -1324,16 +1324,22 @@
 ullText,
+ final
  boolean
@@ -1347,27 +1347,97 @@
 showHomePath
-) %7B
+, final ListCellRenderer listCellRenderer) %7B%0A    super(listCellRenderer);
 %0A    myNullT
@@ -1492,16 +1492,28 @@
 h;%0A  %7D%0A%0A
+  @Override%0A
   protec
@@ -1525,17 +1525,19 @@
 oid 
-c
+doC
 ustomize
 Cell
@@ -1532,28 +1532,16 @@
 ustomize
-CellRenderer
 (final J
@@ -1554,284 +1554,90 @@
 ist,
-%0A                                       final Object value,%0A                                       final int index,%0A                                       final boolean selected,%0A                                       final boolean hasFocus) %7B%0A    final Sdk sdk = (Sdk) value;
+ final Sdk sdk, final int index, final boolean selected, final boolean hasFocus) %7B
 %0A   
@@ -1861,16 +1861,56 @@
 )) + %22)%22
+, SimpleTextAttributes.GRAYED_ATTRIBUTES
 );%0A     

Fix Python SDK chooser combo for GTK+ L&F