diff --git a/python/ide/src/com/jetbrains/python/configuration/PyActiveSdkConfigurable.java b/python/ide/src/com/jetbrains/python/configuration/PyActiveSdkConfigurable.java index b4af04d96609..d4c9fd13e4b1 100644 --- a/python/ide/src/com/jetbrains/python/configuration/PyActiveSdkConfigurable.java +++ b/python/ide/src/com/jetbrains/python/configuration/PyActiveSdkConfigurable.java @@ -44,9 +44,9 @@ import com.intellij.webcore.packaging.PackagesNotificationPanel; import com.jetbrains.python.packaging.ui.PyInstalledPackagesPanel; import com.jetbrains.python.packaging.ui.PyPackageManagementService; import com.jetbrains.python.psi.LanguageLevel; -import com.jetbrains.python.sdk.DetailsChooser; import com.jetbrains.python.sdk.PyDetectedSdk; import com.jetbrains.python.sdk.PySdkListCellRenderer; +import com.jetbrains.python.sdk.PythonSdkDetailsStep; import com.jetbrains.python.sdk.PythonSdkType; import com.jetbrains.python.sdk.flavors.PythonSdkFlavor; import icons.PythonIcons; @@ -108,19 +108,20 @@ public class PyActiveSdkConfigurable implements UnnamedConfigurable { myDetailsButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - DetailsChooser.show(myProject, myProjectSdksModel.getSdks(), new PythonSdkOptions(myProject), - RelativePoint.fromScreen(myDetailsButton.getLocationOnScreen()), true, - new NullableConsumer() { - @Override - public void consume(Sdk sdk) { - if (sdk == null) return; - mySdkAdded = true; - updateSdkList(false); - mySdkCombo.getModel().setSelectedItem(sdk); - myPackagesPanel.updatePackages(new PyPackageManagementService(myProject, sdk)); - } - } - ); + PythonSdkDetailsStep + .show(myProject, myProjectSdksModel.getSdks(), new PythonSdkOptions(myProject), + RelativePoint.fromScreen(myDetailsButton.getLocationOnScreen()), true, + new NullableConsumer() { + @Override + public void consume(Sdk sdk) { + if (sdk == null) return; + mySdkAdded = true; + updateSdkList(false); + mySdkCombo.getModel().setSelectedItem(sdk); + myPackagesPanel.updatePackages(new PyPackageManagementService(myProject, sdk)); + } + } + ); } } ); diff --git a/python/ide/src/com/jetbrains/python/configuration/PythonSdkConfigurable.java b/python/ide/src/com/jetbrains/python/configuration/PythonSdkConfigurable.java index d90b0e6c3024..43468d1d710c 100644 --- a/python/ide/src/com/jetbrains/python/configuration/PythonSdkConfigurable.java +++ b/python/ide/src/com/jetbrains/python/configuration/PythonSdkConfigurable.java @@ -359,13 +359,14 @@ public class PythonSdkConfigurable implements Configurable, Configurable.NoScrol } private void addSdk(AnActionButton button) { - DetailsChooser - .show(myProject, myProjectSdksModel.getSdks(), new PythonSdkOptions(myProject), button.getPreferredPopupPoint(), false, new NullableConsumer() { - @Override - public void consume(Sdk sdk) { - addCreatedSdk(sdk, false); - } - }); + PythonSdkDetailsStep + .show(myProject, myProjectSdksModel.getSdks(), new PythonSdkOptions(myProject), button.getPreferredPopupPoint(), false, + new NullableConsumer() { + @Override + public void consume(Sdk sdk) { + addCreatedSdk(sdk, false); + } + }); } private void addCreatedSdk(@Nullable final Sdk sdk, boolean newVirtualEnv) { diff --git a/python/ide/src/com/jetbrains/python/configuration/PythonSdkOptions.java b/python/ide/src/com/jetbrains/python/configuration/PythonSdkOptions.java index 2d489d03f47a..2b6cfb2b65df 100644 --- a/python/ide/src/com/jetbrains/python/configuration/PythonSdkOptions.java +++ b/python/ide/src/com/jetbrains/python/configuration/PythonSdkOptions.java @@ -269,7 +269,7 @@ public class PythonSdkOptions extends DialogWrapper { } private void addSdk(AnActionButton button) { - DetailsChooser + PythonSdkDetailsStep .show(myProject, myProjectSdksModel.getSdks(), this, button.getPreferredPopupPoint(), false, new NullableConsumer() { @Override public void consume(Sdk sdk) { diff --git a/python/src/com/jetbrains/python/sdk/DetailsChooser.java b/python/src/com/jetbrains/python/sdk/PythonSdkDetailsStep.java similarity index 91% rename from python/src/com/jetbrains/python/sdk/DetailsChooser.java rename to python/src/com/jetbrains/python/sdk/PythonSdkDetailsStep.java index 9cd1f1ec58ef..ea13bc1e692b 100644 --- a/python/src/com/jetbrains/python/sdk/DetailsChooser.java +++ b/python/src/com/jetbrains/python/sdk/PythonSdkDetailsStep.java @@ -36,10 +36,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -/** -* @author yole -*/ -public class DetailsChooser extends BaseListPopupStep { +public class PythonSdkDetailsStep extends BaseListPopupStep { private static DialogWrapper myMore; private final Project myProject; private final Component myOwnerComponent; @@ -57,16 +54,16 @@ public class DetailsChooser extends BaseListPopupStep { final boolean showMore, final NullableConsumer callback) { myMore = component; - final ListPopupStep sdkHomesStep = new DetailsChooser(project, popupPoint.getComponent(), existingSdks, showMore, callback); + final ListPopupStep sdkHomesStep = new PythonSdkDetailsStep(project, popupPoint.getComponent(), existingSdks, showMore, callback); final ListPopup popup = JBPopupFactory.getInstance().createListPopup(sdkHomesStep); popup.show(popupPoint); } - public DetailsChooser(Project project, - Component ownerComponent, - Sdk[] existingSdks, - boolean showMore, - NullableConsumer callback) { + public PythonSdkDetailsStep(Project project, + Component ownerComponent, + Sdk[] existingSdks, + boolean showMore, + NullableConsumer callback) { super(null, getAvailableOptions(showMore)); myProject = project; myOwnerComponent = ownerComponent; diff --git a/python/src/com/jetbrains/python/sdk/PythonSdkType.java b/python/src/com/jetbrains/python/sdk/PythonSdkType.java index e3bd6e95927e..3ad05e039612 100644 --- a/python/src/com/jetbrains/python/sdk/PythonSdkType.java +++ b/python/src/com/jetbrains/python/sdk/PythonSdkType.java @@ -45,7 +45,10 @@ import com.intellij.openapi.util.io.FileSystemUtil; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.text.CharFilter; import com.intellij.openapi.util.text.StringUtil; -import com.intellij.openapi.vfs.*; +import com.intellij.openapi.vfs.JarFileSystem; +import com.intellij.openapi.vfs.LocalFileSystem; +import com.intellij.openapi.vfs.VfsUtilCore; +import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiElement; import com.intellij.reference.SoftReference; import com.intellij.remotesdk.RemoteSdkData; @@ -277,15 +280,16 @@ public class PythonSdkType extends SdkType { public void showCustomCreateUI(SdkModel sdkModel, final JComponent parentComponent, final Consumer sdkCreatedCallback) { Project project = CommonDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext(parentComponent)); - DetailsChooser.show(project, sdkModel.getSdks(), null, RelativePoint.getCenterOf(parentComponent), true, new NullableConsumer() { - @Override - public void consume(@Nullable Sdk sdk) { - if (sdk != null) { - sdk.putUserData(SDK_CREATOR_COMPONENT_KEY, new WeakReference(parentComponent)); - sdkCreatedCallback.consume(sdk); + PythonSdkDetailsStep + .show(project, sdkModel.getSdks(), null, RelativePoint.getCenterOf(parentComponent), true, new NullableConsumer() { + @Override + public void consume(@Nullable Sdk sdk) { + if (sdk != null) { + sdk.putUserData(SDK_CREATOR_COMPONENT_KEY, new WeakReference(parentComponent)); + sdkCreatedCallback.consume(sdk); + } } - } - }); + }); } public static boolean isVirtualEnv(Sdk sdk) {