From d17f8bbe67b0ef87cedbd6e729dcd555e10adb7f Mon Sep 17 00:00:00 2001 From: "Ilya.Kazakevich" Date: Tue, 10 Feb 2026 23:05:37 +0100 Subject: [PATCH] cleanup [python]: remove unused symbols GitOrigin-RevId: fbe0990d113825039ca6341860c24915a1493cf7 --- .../intellij.python.community.impl.xml | 2 - .../featuresTrainer/ift/PythonLangSupport.kt | 1 + .../IndicatedProcessOutputListener.java | 1 + .../python/configuration/EditSdkDialog.form | 69 -------- .../python/configuration/EditSdkDialog.java | 151 ------------------ .../PyIntegratedToolsConfigurable.java | 3 +- .../PythonLocalInterpreterConfigurable.kt | 1 - .../configuration/PythonPathEditor.java | 25 --- .../packaging/PyAbstractPackageCache.java | 1 + .../CondaEnvYamlModificationTracker.kt | 21 --- .../setupPy/SetupPyModificationTracker.kt | 17 -- .../python/remote/PyCommandLineStateUtil.java | 66 -------- .../python/remote/PyRemoteProcessHandler.java | 4 + .../remote/PythonSshInterpreterManager.java | 36 ----- .../python/sdk/PythonSdkUpdater.java | 1 + .../python/sdk/add/PyAddSdkGroupPanel.kt | 10 +- .../jetbrains/python/sdk/add/PyAddSdkPanel.kt | 4 +- .../sdk/add/PySdkPathChoosingComboBox.kt | 17 +- 18 files changed, 24 insertions(+), 406 deletions(-) delete mode 100644 python/src/com/jetbrains/python/configuration/EditSdkDialog.form delete mode 100644 python/src/com/jetbrains/python/configuration/EditSdkDialog.java delete mode 100644 python/src/com/jetbrains/python/packaging/conda/environmentYml/CondaEnvYamlModificationTracker.kt delete mode 100644 python/src/com/jetbrains/python/packaging/setupPy/SetupPyModificationTracker.kt delete mode 100644 python/src/com/jetbrains/python/remote/PythonSshInterpreterManager.java diff --git a/python/pluginResources/intellij.python.community.impl.xml b/python/pluginResources/intellij.python.community.impl.xml index 1ffcd426464d..4f2902ff951d 100644 --- a/python/pluginResources/intellij.python.community.impl.xml +++ b/python/pluginResources/intellij.python.community.impl.xml @@ -779,8 +779,6 @@ - , context: UserDataHolder): Sdk? { + @Suppress("DEPRECATION_ERROR") val baseSdkField = PySdkPathChoosingComboBox() val warningPlaceholder = JLabel() diff --git a/python/python-sdk/src/com/jetbrains/python/packaging/IndicatedProcessOutputListener.java b/python/python-sdk/src/com/jetbrains/python/packaging/IndicatedProcessOutputListener.java index 5f95951dfe53..0e67531bf1a6 100644 --- a/python/python-sdk/src/com/jetbrains/python/packaging/IndicatedProcessOutputListener.java +++ b/python/python-sdk/src/com/jetbrains/python/packaging/IndicatedProcessOutputListener.java @@ -12,6 +12,7 @@ import org.jetbrains.annotations.NotNull; /** * @deprecated use {@link com.intellij.execution.process.ProcessListener} directly */ + @Deprecated(forRemoval = true) public final class IndicatedProcessOutputListener extends ProcessAdapter { private final @NotNull ProgressIndicator myIndicator; diff --git a/python/src/com/jetbrains/python/configuration/EditSdkDialog.form b/python/src/com/jetbrains/python/configuration/EditSdkDialog.form deleted file mode 100644 index e07051bd1ae0..000000000000 --- a/python/src/com/jetbrains/python/configuration/EditSdkDialog.form +++ /dev/null @@ -1,69 +0,0 @@ - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/python/src/com/jetbrains/python/configuration/EditSdkDialog.java b/python/src/com/jetbrains/python/configuration/EditSdkDialog.java deleted file mode 100644 index a47a99aeb3ff..000000000000 --- a/python/src/com/jetbrains/python/configuration/EditSdkDialog.java +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -package com.jetbrains.python.configuration; - -import com.intellij.execution.target.BrowsableTargetEnvironmentType; -import com.intellij.execution.target.TargetBasedSdkAdditionalData; -import com.intellij.execution.target.TargetBrowserHints; -import com.intellij.execution.target.TargetEnvironmentConfigurationKt; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.projectRoots.SdkAdditionalData; -import com.intellij.openapi.projectRoots.SdkModificator; -import com.intellij.openapi.ui.DialogWrapper; -import com.intellij.openapi.ui.TextComponentAccessor; -import com.intellij.openapi.ui.TextFieldWithBrowseButton; -import com.intellij.openapi.util.NlsContexts; -import com.intellij.openapi.util.NlsSafe; -import com.intellij.openapi.util.io.FileUtil; -import com.intellij.ui.ClickListener; -import com.intellij.ui.DocumentAdapter; -import com.intellij.ui.components.JBCheckBox; -import com.intellij.ui.components.JBLabel; -import com.intellij.util.NullableFunction; -import com.jetbrains.python.PyBundle; -import com.jetbrains.python.sdk.PythonSdkAdditionalData; -import com.jetbrains.python.sdk.PythonSdkType; -import com.jetbrains.python.sdk.flavors.PythonSdkFlavor; -import com.jetbrains.python.sdk.flavors.VirtualEnvSdkFlavor; -import com.jetbrains.python.sdk.flavors.conda.CondaEnvSdkFlavor; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import javax.swing.JComponent; -import javax.swing.JPanel; -import javax.swing.JTextField; -import javax.swing.event.DocumentEvent; -import java.awt.event.ActionListener; -import java.awt.event.MouseEvent; - - -public class EditSdkDialog extends DialogWrapper { - private JPanel myMainPanel; - private JTextField myNameTextField; - private TextFieldWithBrowseButton myInterpreterPathTextField; - private JBCheckBox myAssociateCheckbox; - private JBLabel myRemoveAssociationLabel; - private final boolean myWasAssociated; - private boolean myAssociationRemoved = false; - - protected EditSdkDialog(Project project, SdkModificator sdk, final NullableFunction nameValidator) { - super(project, true); - setTitle(PyBundle.message("sdk.edit.dialog.title")); - myNameTextField.setText(sdk.getName()); - myNameTextField.getDocument().addDocumentListener(new DocumentAdapter() { - @Override - protected void textChanged(@NotNull DocumentEvent e) { - @NlsSafe String nameError = nameValidator.fun(getName()); - setErrorText(nameError, myNameTextField); - setOKActionEnabled(nameError == null); - } - }); - final String homePath = sdk.getHomePath(); - myInterpreterPathTextField.setText(homePath); - var sdkAdditionalData = sdk.getSdkAdditionalData(); - var label = PyBundle.message("sdk.edit.dialog.specify.interpreter.path"); - var targetListener = createBrowseTargetListener(project, sdkAdditionalData, label); - if (targetListener != null) { - myInterpreterPathTextField.addActionListener(targetListener); - } - else { - myInterpreterPathTextField.addBrowseFolderListener(project, PythonSdkType.getInstance().getHomeChooserDescriptor().withTitle(label)); - } - myRemoveAssociationLabel.setVisible(false); - final PythonSdkFlavor sdkFlavor = PythonSdkFlavor.getPlatformIndependentFlavor(homePath); - if ((sdkFlavor instanceof VirtualEnvSdkFlavor) || (sdkFlavor instanceof CondaEnvSdkFlavor)) { - PythonSdkAdditionalData data = (PythonSdkAdditionalData)sdk.getSdkAdditionalData(); - if (data != null) { - final String path = data.getAssociatedModulePath(); - if (path != null) { - myAssociateCheckbox.setSelected(true); - final String basePath = project.getBasePath(); - if (basePath != null && !path.equals(FileUtil.toSystemIndependentName(basePath))) { - myAssociateCheckbox.setEnabled(false); - myAssociateCheckbox.setText(PyBundle.message("sdk.edit.dialog.associate.virtual.env.with.path", - FileUtil.toSystemDependentName(path))); - myRemoveAssociationLabel.setVisible(true); - } - } - } - } - else { - myAssociateCheckbox.setVisible(false); - } - myWasAssociated = myAssociateCheckbox.isSelected(); - init(); - new ClickListener() { - @Override - public boolean onClick(@NotNull MouseEvent e, int clickCount) { - myAssociateCheckbox.setSelected(false); - myAssociateCheckbox.setEnabled(true); - myAssociateCheckbox.setText(PyBundle.message("sdk.edit.dialog.associate.virtual.env.current.project")); - myRemoveAssociationLabel.setVisible(false); - myAssociationRemoved = true; - return true; - } - }.installOn(myRemoveAssociationLabel); - } - - /** - * @return action to call when user clicks on "browse" button if sdk is target SDK that supports browsing - */ - private @Nullable ActionListener createBrowseTargetListener(@NotNull Project project, @NotNull SdkAdditionalData sdkAdditionalData, - @NotNull @NlsContexts.DialogTitle String label) { - if (!(sdkAdditionalData instanceof TargetBasedSdkAdditionalData)) { - return null; - } - var configuration = ((TargetBasedSdkAdditionalData)sdkAdditionalData).getTargetEnvironmentConfiguration(); - if (configuration != null) { - var type = TargetEnvironmentConfigurationKt.getTargetType(configuration); - if (type instanceof BrowsableTargetEnvironmentType) { - return ((BrowsableTargetEnvironmentType)type).createBrowser(project, label, TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT, - myInterpreterPathTextField.getTextField(), () -> configuration, new TargetBrowserHints(true, null)); - } - } - return null; - } - - @Override - protected JComponent createCenterPanel() { - return myMainPanel; - } - - @Override - public JComponent getPreferredFocusedComponent() { - return myNameTextField; - } - - public @NlsSafe String getName() { - return myNameTextField.getText(); - } - - public String getHomePath() { - return myInterpreterPathTextField.getText(); - } - - public boolean associateWithProject() { - return myAssociateCheckbox.isSelected(); - } - - public boolean isAssociateChanged() { - return myWasAssociated != associateWithProject() || myAssociationRemoved; - } -} diff --git a/python/src/com/jetbrains/python/configuration/PyIntegratedToolsConfigurable.java b/python/src/com/jetbrains/python/configuration/PyIntegratedToolsConfigurable.java index 8dd8f1a079d0..afe9f64deab5 100644 --- a/python/src/com/jetbrains/python/configuration/PyIntegratedToolsConfigurable.java +++ b/python/src/com/jetbrains/python/configuration/PyIntegratedToolsConfigurable.java @@ -73,7 +73,6 @@ public class PyIntegratedToolsConfigurable implements SearchableConfigurable { private JComboBox> myTestRunnerComboBox; private JComboBox myDocstringFormatComboBox; private PyTestRunConfigurationsModel myModel; - private final PyPackageRequirementsSettings myPackagingSettings; private final @Nullable Module myModule; private final @NotNull Project myProject; private final PyDocumentationSettings myDocumentationSettings; @@ -104,7 +103,7 @@ public class PyIntegratedToolsConfigurable implements SearchableConfigurable { myModule = module; myProject = project; myDocumentationSettings = PyDocumentationSettings.getInstance(myModule); - myPackagingSettings = PyPackageRequirementsSettings.getInstance(module); + PyPackageRequirementsSettings packagingSettings = PyPackageRequirementsSettings.getInstance(module); myDocstringFormatComboBox.setModel(new CollectionComboBoxModel<>(new ArrayList<>(Arrays.asList(DocStringFormat.values())), myDocumentationSettings.getFormat())); myDocstringFormatComboBox.setRenderer(SimpleListCellRenderer.create("", DocStringFormat::getName)); diff --git a/python/src/com/jetbrains/python/configuration/PythonLocalInterpreterConfigurable.kt b/python/src/com/jetbrains/python/configuration/PythonLocalInterpreterConfigurable.kt index d850eec5420f..b2746d280b94 100644 --- a/python/src/com/jetbrains/python/configuration/PythonLocalInterpreterConfigurable.kt +++ b/python/src/com/jetbrains/python/configuration/PythonLocalInterpreterConfigurable.kt @@ -26,7 +26,6 @@ import com.jetbrains.python.sdk.flavors.conda.CondaEnvSdkFlavor /** * Configurable for local Python interpreter. * - * Replaces [EditSdkDialog]. */ class PythonLocalInterpreterConfigurable(private val project: Project, private val module: Module?, private val sdk: Sdk) : BoundConfigurable(sdk.name) { diff --git a/python/src/com/jetbrains/python/configuration/PythonPathEditor.java b/python/src/com/jetbrains/python/configuration/PythonPathEditor.java index 33a0ec334066..22e2aa2fefb4 100644 --- a/python/src/com/jetbrains/python/configuration/PythonPathEditor.java +++ b/python/src/com/jetbrains/python/configuration/PythonPathEditor.java @@ -67,17 +67,6 @@ public class PythonPathEditor extends SdkPathEditor { } } - public void reload(@Nullable SdkModificator sdkModificator) { - if (sdkModificator != null) { - List list = ImmutableList.copyOf(sdkModificator.getRoots(getOrderRootType())); - resetPath(myPathListModel.reload(list)); - setModified(true); - } - else { - setEnabled(false); - } - } - @Override public void apply(SdkModificator sdkModificator) { sdkModificator.removeRoots(getOrderRootType()); @@ -152,7 +141,6 @@ public class PythonPathEditor extends SdkPathEditor { private final List myFilteredOut = new ArrayList<>(); private final DefaultListModel myListModel; private final OrderRootType myOrderRootType; - private final Set myUserAddedToRemove = new HashSet<>(); PathListModel(OrderRootType orderRootType, DefaultListModel listModel) { myOrderRootType = orderRootType; @@ -172,7 +160,6 @@ public class PythonPathEditor extends SdkPathEditor { if (!myFoundFiles.contains(file)) { if (!myExcluded.remove(file)) { //if it was excluded we only delete exclusion mark myAdded.add(file); - myUserAddedToRemove.remove(file); } else { myFoundFiles.add(file); @@ -192,7 +179,6 @@ public class PythonPathEditor extends SdkPathEditor { if (myAdded.contains(e.first)) { toRemove.add(e.second); myAdded.remove(e.first); - myUserAddedToRemove.add(e.first); } else if (myExcluded.contains(e.first)) { myExcluded.remove(e.first); @@ -243,23 +229,12 @@ public class PythonPathEditor extends SdkPathEditor { return ""; } - public @NotNull List reload(@NotNull List list) { - myFoundFiles.clear(); - myFoundFiles.addAll(list); - List result = filterOutStubs(list, myFilteredOut); - result.removeAll(myUserAddedToRemove); - result.addAll(myAdded); - - return result; - } - public @NotNull List reset(@NotNull List list, @NotNull SdkModificator modificator) { myFilteredOut.clear(); List result = filterOutStubs(list, myFilteredOut); myFoundFiles.clear(); myFoundFiles.addAll(list); - myUserAddedToRemove.clear(); if (modificator.getSdkAdditionalData() instanceof PythonSdkAdditionalData data) { setAdded(data.getAddedPathFiles()); diff --git a/python/src/com/jetbrains/python/packaging/PyAbstractPackageCache.java b/python/src/com/jetbrains/python/packaging/PyAbstractPackageCache.java index b38a35f1f992..152180fd38f7 100644 --- a/python/src/com/jetbrains/python/packaging/PyAbstractPackageCache.java +++ b/python/src/com/jetbrains/python/packaging/PyAbstractPackageCache.java @@ -154,6 +154,7 @@ public abstract class PyAbstractPackageCache { public PackageInfo() { } + public @Nullable List getVersions() { return myVersions != null ? Collections.unmodifiableList(myVersions) : null; } diff --git a/python/src/com/jetbrains/python/packaging/conda/environmentYml/CondaEnvYamlModificationTracker.kt b/python/src/com/jetbrains/python/packaging/conda/environmentYml/CondaEnvYamlModificationTracker.kt deleted file mode 100644 index 8c2c3e5f45be..000000000000 --- a/python/src/com/jetbrains/python/packaging/conda/environmentYml/CondaEnvYamlModificationTracker.kt +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -package com.jetbrains.python.packaging.conda.environmentYml - -import com.intellij.openapi.components.Service -import com.intellij.openapi.components.service -import com.intellij.openapi.project.Project -import com.intellij.openapi.util.FilesModificationTrackerBase -import com.intellij.openapi.vfs.VirtualFile - -@Service(Service.Level.PROJECT) -internal class CondaEnvYamlModificationTracker(project: Project) : FilesModificationTrackerBase(project) { - override fun isFileSupported(virtualFile: VirtualFile): Boolean { - return virtualFile.name in setOf(CondaEnvironmentYmlSdkUtils.ENV_YML_FILE_NAME, CondaEnvironmentYmlSdkUtils.ENV_YAML_FILE_NAME) - } - - companion object { - fun getInstance(project: Project): CondaEnvYamlModificationTracker { - return project.service() - } - } -} \ No newline at end of file diff --git a/python/src/com/jetbrains/python/packaging/setupPy/SetupPyModificationTracker.kt b/python/src/com/jetbrains/python/packaging/setupPy/SetupPyModificationTracker.kt deleted file mode 100644 index 18ba9cddf238..000000000000 --- a/python/src/com/jetbrains/python/packaging/setupPy/SetupPyModificationTracker.kt +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -package com.jetbrains.python.packaging.setupPy - -import com.intellij.openapi.components.Service -import com.intellij.openapi.components.service -import com.intellij.openapi.project.Project -import com.intellij.openapi.util.FilesModificationTrackerBase -import com.intellij.openapi.vfs.VirtualFile - -@Service(Service.Level.PROJECT) -internal class SetupPyModificationTracker(project: Project) : FilesModificationTrackerBase(project) { - override fun isFileSupported(virtualFile: VirtualFile): Boolean = virtualFile.name == SetupPyHelpers.SETUP_PY - - companion object { - fun getInstance(project: Project): SetupPyModificationTracker = project.service() - } -} \ No newline at end of file diff --git a/python/src/com/jetbrains/python/remote/PyCommandLineStateUtil.java b/python/src/com/jetbrains/python/remote/PyCommandLineStateUtil.java index 87ee15443828..174ab7065921 100644 --- a/python/src/com/jetbrains/python/remote/PyCommandLineStateUtil.java +++ b/python/src/com/jetbrains/python/remote/PyCommandLineStateUtil.java @@ -1,85 +1,19 @@ // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.jetbrains.python.remote; -import com.intellij.execution.configurations.GeneralCommandLine; -import com.intellij.execution.configurations.ParamsGroup; import com.intellij.remote.RemoteFile; -import com.intellij.remote.RemoteProcessUtil; import com.intellij.util.PathMapper; -import com.jetbrains.python.debugger.PyDebugRunner; -import com.jetbrains.python.run.PythonCommandLineState; -import com.jetbrains.python.sdk.PythonEnvUtil; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import java.io.File; import java.util.ArrayList; import java.util.List; -import java.util.Map; import java.util.regex.Pattern; @SuppressWarnings("SameParameterValue") public final class PyCommandLineStateUtil { - // the environment variable used by BDD to hold a set of folder or feature files - private static final String PY_STUFF_TO_RUN = "PY_STUFF_TO_RUN"; private PyCommandLineStateUtil() { } - public static void remap(@NotNull String interpreterPath, @NotNull GeneralCommandLine commandLine, @NotNull PathMapper pathMapper) { - ParamsGroup paramsGroup = commandLine.getParametersList().getParamsGroup(PythonCommandLineState.GROUP_SCRIPT); - remapParameters(interpreterPath, pathMapper, paramsGroup, commandLine.getWorkDirectory()); - - remapEnvPaths(commandLine.getEnvironment(), pathMapper, interpreterPath, PythonEnvUtil.PYTHONPATH); - remapEnvPaths(commandLine.getEnvironment(), pathMapper, interpreterPath, PyDebugRunner.IDE_PROJECT_ROOTS); - remapEnvStuffPaths(commandLine.getEnvironment(), pathMapper, interpreterPath, PY_STUFF_TO_RUN); - } - - public static void remapParameters( - @NotNull String interpreterPath, - @NotNull PathMapper pathMapper, - @Nullable ParamsGroup paramsGroup, - @Nullable File workDirectory - ) { - if (paramsGroup != null) { - if (!paramsGroup.getParameters().isEmpty()) { - makeParamAbsoluteIfRelative(paramsGroup, 0, workDirectory); - } - - int i = 0; - boolean isWin = RemoteFile.isWindowsPath(interpreterPath); - for (String param : paramsGroup.getParameters()) { - if (pathMapper.canReplaceLocal(param)) { - paramsGroup.getParametersList().set(i++, RemoteFile.createRemoteFile(pathMapper.convertToRemote(param), isWin).getPath()); - } - } - } - } - - private static void makeParamAbsoluteIfRelative(ParamsGroup paramsGroup, int paramIndex, @Nullable File workDirectory) { - String param = paramsGroup.getParameters().get(paramIndex); - if (!new File(param).isAbsolute() && workDirectory != null) { - File paramFile = new File(workDirectory, param); - if (paramFile.exists()) { - paramsGroup.getParametersList().set(paramIndex, paramFile.getPath()); - } - } - } - - private static void remapEnvPaths(Map env, PathMapper pathMapper, String interpreterPath, String envKey) { - if (env.isEmpty()) return; - - String envPaths = env.get(envKey); - if (envPaths != null) { - env.put(envKey, RemoteProcessUtil.remapPathsList(envPaths, pathMapper, interpreterPath)); - } - } - - private static void remapEnvStuffPaths(Map env, PathMapper pathMapper, String interpreterPath, String envKey) { - String envPaths = env.get(envKey); - if (envPaths != null) { - env.put(envKey, remapStuffPathsList(envPaths, pathMapper, interpreterPath)); - } - } public static @NotNull String remapStuffPathsList(@NotNull String pathsValue, @NotNull PathMapper pathMapper, @NotNull String interpreterPath) { boolean isWin = RemoteFile.isWindowsPath(interpreterPath); diff --git a/python/src/com/jetbrains/python/remote/PyRemoteProcessHandler.java b/python/src/com/jetbrains/python/remote/PyRemoteProcessHandler.java index 3d11008723e1..5ebcb57e41fb 100644 --- a/python/src/com/jetbrains/python/remote/PyRemoteProcessHandler.java +++ b/python/src/com/jetbrains/python/remote/PyRemoteProcessHandler.java @@ -60,6 +60,7 @@ public final class PyRemoteProcessHandler extends BaseRemoteProcessHandler getRemoteSocket(int localPort) throws RemoteSdkException { try { @@ -70,6 +71,7 @@ public final class PyRemoteProcessHandler extends BaseRemoteProcessHandler EP_NAME = ExtensionPointName.create("Pythonid.sshInterpreterManager"); - - final class Factory { - public static @Nullable PythonSshInterpreterManager getInstance() { - var extensions = EP_NAME.getExtensionList(); - return switch (extensions.size()) { - case 0 -> { - LOG.debug(MessageFormat.format("Extension for ''{0}'' extension point is absent", EP_NAME.getName())); - yield null; - } - case 1 -> extensions.get(0); - default -> { - LOG.error(MessageFormat.format("Several extensions registered for ''{0}'' extension point", EP_NAME.getName())); - yield null; - } - }; - } - } -} diff --git a/python/src/com/jetbrains/python/sdk/PythonSdkUpdater.java b/python/src/com/jetbrains/python/sdk/PythonSdkUpdater.java index 9ecb2bf2b5ad..a84f70c07a1c 100644 --- a/python/src/com/jetbrains/python/sdk/PythonSdkUpdater.java +++ b/python/src/com/jetbrains/python/sdk/PythonSdkUpdater.java @@ -443,6 +443,7 @@ public final class PythonSdkUpdater { * @see #updateVersionAndPathsSynchronouslyAndScheduleRemaining(Sdk, Project) */ @ApiStatus.Internal + public static void updateOrShowError(@NotNull Sdk sdk, @Nullable Project project, @Nullable Component ownerComponent) { boolean versionAndPathsUpdated = updateVersionAndPathsSynchronouslyAndScheduleRemaining(sdk, project); if (!versionAndPathsUpdated) { diff --git a/python/src/com/jetbrains/python/sdk/add/PyAddSdkGroupPanel.kt b/python/src/com/jetbrains/python/sdk/add/PyAddSdkGroupPanel.kt index 5d529a97c099..d36550cc7071 100644 --- a/python/src/com/jetbrains/python/sdk/add/PyAddSdkGroupPanel.kt +++ b/python/src/com/jetbrains/python/sdk/add/PyAddSdkGroupPanel.kt @@ -18,15 +18,15 @@ import javax.swing.JPanel "Custom Python SDKs support was removed from python plugin for IDEA because of UI/UX unification with PyCharm", level = DeprecationLevel.ERROR ) -@Suppress("DEPRECATION_ERROR") -class PyAddSdkGroupPanel(private val nameGetter: Supplier<@Nls String>, +class PyAddSdkGroupPanel @Suppress("DEPRECATION_ERROR") constructor(private val nameGetter: Supplier<@Nls String>, + panelIcon: Icon, val panels: List, defaultPanel: PyAddSdkPanel -) : PyAddSdkPanel() { +) : @Suppress("DEPRECATION_ERROR") PyAddSdkPanel() { override val panelName: String get() = nameGetter.get() // NON-NLS override val icon: Icon = panelIcon - var selectedPanel: PyAddSdkPanel = defaultPanel + var selectedPanel: @Suppress("DEPRECATION_ERROR") PyAddSdkPanel = defaultPanel private val changeListeners: MutableList = mutableListOf() override var newProjectPath: String? @@ -59,7 +59,7 @@ class PyAddSdkGroupPanel(private val nameGetter: Supplier<@Nls String>, panel.addChangeListener(listener) } } - + @Suppress("DEPRECATION_ERROR") private fun createRadioButtonPanel(panels: List, defaultPanel: PyAddSdkPanel): JPanel { val buttonMap = panels.map { JBRadioButton(it.panelName) to it }.toMap(linkedMapOf()) ButtonGroup().apply { diff --git a/python/src/com/jetbrains/python/sdk/add/PyAddSdkPanel.kt b/python/src/com/jetbrains/python/sdk/add/PyAddSdkPanel.kt index f4fabb0187f2..e5cb45ddba8a 100644 --- a/python/src/com/jetbrains/python/sdk/add/PyAddSdkPanel.kt +++ b/python/src/com/jetbrains/python/sdk/add/PyAddSdkPanel.kt @@ -38,9 +38,11 @@ abstract class PyAddSdkPanel : JPanel(), PyAddSdkView { */ @Deprecated( message ="this ComboBox was designed only for plain venv, not tool-specific pythons and doesn't supported anymore", - replaceWith = ReplaceWith("PythonInterpreterComboBox") + replaceWith = ReplaceWith("PythonInterpreterComboBox"), + DeprecationLevel.ERROR ) fun addInterpretersAsync( + @Suppress("DEPRECATION_ERROR") sdkComboBox: PySdkPathChoosingComboBox, sdkObtainer: () -> List, onAdded: (List) -> Unit, diff --git a/python/src/com/jetbrains/python/sdk/add/PySdkPathChoosingComboBox.kt b/python/src/com/jetbrains/python/sdk/add/PySdkPathChoosingComboBox.kt index db4badf87d5f..4b9a272c5a3a 100644 --- a/python/src/com/jetbrains/python/sdk/add/PySdkPathChoosingComboBox.kt +++ b/python/src/com/jetbrains/python/sdk/add/PySdkPathChoosingComboBox.kt @@ -82,7 +82,6 @@ private class PySdkListCellRendererExt : ListCellRenderer { * A combobox with browse button for choosing a path to SDK, also capable of showing progress indicator. * To toggle progress indicator visibility use [setBusy] method. * - * To fill this box in async mode use [addInterpretersToComboAsync] * */ @Deprecated( @@ -196,7 +195,8 @@ class PySdkPathChoosingComboBox @JvmOverloads constructor( } companion object { - class PySdkComboBoxTextAccessor(private val targetEnvironmentConfiguration: TargetEnvironmentConfiguration?) : TextComponentAccessor> { + class PySdkComboBoxTextAccessor(private val targetEnvironmentConfiguration: TargetEnvironmentConfiguration?) : + TextComponentAccessor> { override fun getText(component: JComboBox): String = (component.selectedItem as? ExistingPySdkComboBoxItem)?.getText().orEmpty() @@ -217,17 +217,11 @@ class PySdkPathChoosingComboBox @JvmOverloads constructor( } } -/** - * Obtains a list of sdk on a pool using [sdkObtainer], then fills [sdkComboBox] on the EDT. - */ -internal fun addInterpretersToComboAsync(sdkComboBox: PySdkPathChoosingComboBox, sdkObtainer: () -> List) { - addInterpretersToComboAsync(sdkComboBox, sdkObtainer, {}) -} - /** * Obtains a list of sdk on a pool using [sdkObtainer], then fills [sdkComboBox] and calls [onAdded] on the EDT. */ internal fun addInterpretersToComboAsync( + @Suppress("DEPRECATION_ERROR") sdkComboBox: PySdkPathChoosingComboBox, sdkObtainer: () -> List, onAdded: (List) -> Unit, @@ -253,6 +247,8 @@ internal fun addInterpretersToComboAsync( /** * Keeps [NewPySdkComboBoxItem] if it is present in the combobox. */ + +@Suppress("DEPRECATION_ERROR") private fun PySdkPathChoosingComboBox.removeAllItems() { if (childComponent.itemCount > 0 && childComponent.getItemAt(0) is NewPySdkComboBoxItem) { while (childComponent.itemCount > 1) { @@ -270,7 +266,8 @@ private fun PySdkPathChoosingComboBox.removeAllItems() { */ @ApiStatus.Internal fun addBaseInterpretersAsync( - sdkComboBox: PySdkPathChoosingComboBox, + sdkComboBox: @Suppress("DEPRECATION_ERROR") PySdkPathChoosingComboBox, + existingSdks: List, module: Module?, context: UserDataHolder,