use of com.jetbrains.python.configuration.PyConfigurableInterpreterList in project intellij-community by JetBrains.
the class PythonSdkChooserCombo method showOptions.
private void showOptions(final Project project) {
final PyConfigurableInterpreterList interpreterList = PyConfigurableInterpreterList.getInstance(project);
final Sdk[] sdks = interpreterList.getModel().getSdks();
//noinspection unchecked
final JComboBox<Sdk> comboBox = getComboBox();
final Sdk oldSelectedSdk = (Sdk) comboBox.getSelectedItem();
PythonSdkDetailsStep.show(project, sdks, null, this, getButton().getLocationOnScreen(), sdk -> {
if (sdk == null)
return;
final ProjectSdksModel projectSdksModel = interpreterList.getModel();
if (projectSdksModel.findSdk(sdk) == null) {
projectSdksModel.addSdk(sdk);
try {
projectSdksModel.apply();
} catch (ConfigurationException e) {
LOG.error("Error adding new python interpreter " + e.getMessage());
}
}
final List<Sdk> committedSdks = interpreterList.getAllPythonSdks();
final Sdk copiedSdk = interpreterList.getModel().findSdk(sdk.getName());
comboBox.setModel(new CollectionComboBoxModel<>(committedSdks, oldSelectedSdk));
comboBox.setSelectedItem(copiedSdk);
}, true);
}
use of com.jetbrains.python.configuration.PyConfigurableInterpreterList in project intellij-community by JetBrains.
the class PyIdeCommonOptionsForm method subscribe.
@Override
public void subscribe() {
PyConfigurableInterpreterList myInterpreterList = PyConfigurableInterpreterList.getInstance(myProject);
ProjectSdksModel myProjectSdksModel = myInterpreterList.getModel();
myProjectSdksModel.addListener(new MyListener(this, myInterpreterList));
updateSdkList(true, myInterpreterList);
}
Aggregations