summaryrefslogtreecommitdiff
path: root/python/ide/src/com/jetbrains/python/PythonSdkChooserCombo.java
diff options
context:
space:
mode:
Diffstat (limited to 'python/ide/src/com/jetbrains/python/PythonSdkChooserCombo.java')
-rw-r--r--python/ide/src/com/jetbrains/python/PythonSdkChooserCombo.java26
1 files changed, 16 insertions, 10 deletions
diff --git a/python/ide/src/com/jetbrains/python/PythonSdkChooserCombo.java b/python/ide/src/com/jetbrains/python/PythonSdkChooserCombo.java
index b0790146e6f6..ed2163afd9bd 100644
--- a/python/ide/src/com/jetbrains/python/PythonSdkChooserCombo.java
+++ b/python/ide/src/com/jetbrains/python/PythonSdkChooserCombo.java
@@ -25,9 +25,9 @@ import com.intellij.ui.CollectionComboBoxModel;
import com.intellij.ui.ComboboxWithBrowseButton;
import com.intellij.util.NullableConsumer;
import com.intellij.util.containers.ContainerUtil;
-import com.jetbrains.python.configuration.PythonSdkDetailsDialog;
+import com.jetbrains.python.configuration.PyConfigurableInterpreterList;
import com.jetbrains.python.sdk.PyDetectedSdk;
-import com.jetbrains.python.sdk.PythonSdkType;
+import com.jetbrains.python.sdk.PythonSdkDetailsStep;
import com.jetbrains.python.sdk.flavors.PythonSdkFlavor;
import org.jetbrains.annotations.Nullable;
@@ -63,14 +63,7 @@ public class PythonSdkChooserCombo extends ComboboxWithBrowseButton {
});
addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
- final List<Sdk> sdks = PythonSdkType.getAllSdks();
- PythonSdkDetailsDialog dialog = new PythonSdkDetailsDialog(project, new NullableConsumer<Sdk>() {
- @Override
- public void consume(@Nullable Sdk sdk) {
- comboBox.setModel(new CollectionComboBoxModel(sdks, sdk));
- }
- });
- dialog.show();
+ showOptions(project);
notifyChanged(e);
}
});
@@ -81,6 +74,19 @@ public class PythonSdkChooserCombo extends ComboboxWithBrowseButton {
});
}
+ private void showOptions(final Project project) {
+ final PyConfigurableInterpreterList interpreterList = PyConfigurableInterpreterList.getInstance(project);
+ final Sdk[] sdks = interpreterList.getModel().getSdks();
+ PythonSdkDetailsStep.show(project, sdks, null, this, getButton().getLocationOnScreen(), new NullableConsumer<Sdk>() {
+ @Override
+ public void consume(@Nullable Sdk sdk) {
+ //noinspection unchecked
+ getComboBox().setModel(new CollectionComboBoxModel(interpreterList.getAllPythonSdks(), sdk));
+ }
+ }
+ );
+ }
+
private void notifyChanged(ActionEvent e) {
for (ActionListener changedListener : myChangedListeners) {
changedListener.actionPerformed(e);