mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
show flavor icons in SDK choosers of Python plugin (PY-9015)
This commit is contained in:
@@ -4,9 +4,9 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectManager;
|
||||
import com.intellij.openapi.projectRoots.ProjectJdkTable;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.projectRoots.impl.SdkListCellRenderer;
|
||||
import com.intellij.openapi.projectRoots.ui.ProjectJdksEditor;
|
||||
import com.intellij.ui.ComboboxWithBrowseButton;
|
||||
import com.jetbrains.python.sdk.PySdkListCellRenderer;
|
||||
import com.jetbrains.python.sdk.PythonSdkType;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -21,7 +21,7 @@ public class PythonSdkComboBox extends ComboboxWithBrowseButton {
|
||||
private Project myProject;
|
||||
|
||||
public PythonSdkComboBox() {
|
||||
getComboBox().setRenderer(new SdkListCellRenderer("<No Interpreter>"));
|
||||
getComboBox().setRenderer(new PySdkListCellRenderer("<No Interpreter>", null));
|
||||
addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Sdk selectedSdk = getSelectedSdk();
|
||||
|
||||
@@ -32,7 +32,7 @@ public class PyManagePackagesDialog extends DialogWrapper {
|
||||
List<Sdk> sdks = PythonSdkType.getAllSdks();
|
||||
Collections.sort(sdks, new PreferredSdkComparator());
|
||||
final JComboBox sdkComboBox = new JComboBox(new CollectionComboBoxModel(sdks, sdk));
|
||||
sdkComboBox.setRenderer(new PySdkListCellRenderer(null));
|
||||
sdkComboBox.setRenderer(new PySdkListCellRenderer());
|
||||
|
||||
PyPackagesNotificationPanel notificationPanel = new PyPackagesNotificationPanel(project);
|
||||
final PyPackagesPanel packagesPanel = new PyPackagesPanel(project, notificationPanel);
|
||||
|
||||
@@ -222,7 +222,7 @@ public class CreateVirtualEnvDialog extends IdeaDialog {
|
||||
}
|
||||
|
||||
private void updateSdkList(final List<Sdk> allSdks, @Nullable Sdk initialSelection) {
|
||||
mySdkCombo.setRenderer(new PySdkListCellRenderer(null));
|
||||
mySdkCombo.setRenderer(new PySdkListCellRenderer());
|
||||
List<Sdk> baseSdks = new ArrayList<Sdk>();
|
||||
for (Sdk s : allSdks) {
|
||||
if (!PythonSdkType.isInvalid(s) && !PythonSdkType.isVirtualEnv(s) && !RemoteSdkDataHolder.isRemoteSdk(s.getHomePath())) {
|
||||
|
||||
@@ -13,9 +13,16 @@ import javax.swing.*;
|
||||
import java.util.Map;
|
||||
|
||||
public class PySdkListCellRenderer extends ListCellRendererWrapper<Sdk> {
|
||||
private final String myNullText;
|
||||
private final Map<Sdk, SdkModificator> mySdkModifiers;
|
||||
|
||||
public PySdkListCellRenderer(@Nullable Map<Sdk, SdkModificator> sdkModifiers) {
|
||||
public PySdkListCellRenderer() {
|
||||
myNullText = "";
|
||||
mySdkModifiers = null;
|
||||
}
|
||||
|
||||
public PySdkListCellRenderer(String nullText, @Nullable Map<Sdk, SdkModificator> sdkModifiers) {
|
||||
myNullText = nullText;
|
||||
mySdkModifiers = sdkModifiers;
|
||||
}
|
||||
|
||||
@@ -46,6 +53,9 @@ public class PySdkListCellRenderer extends ListCellRendererWrapper<Sdk> {
|
||||
setIcon(icon);
|
||||
}
|
||||
}
|
||||
else {
|
||||
setText(myNullText);
|
||||
}
|
||||
}
|
||||
|
||||
private LayeredIcon wrapIconWithWarningDecorator(Icon icon) {
|
||||
|
||||
Reference in New Issue
Block a user