mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-84969 Make sure sdkAdded callback is called for remote interpreters
After changing dialogs for creating remote SDKs we ended up in a situation when we've already persisted our SDK (see commonKt#setupSdk). That leads to a situation when we're not calling our sdkCreated callback in exitHandler of TargetEnvironmentWizard (see AddInterpreterActions). There is a check for existing SDK (and it was already persisted), and only if SDK doesn't exist we execute the callback. And if we don't invoke that callback, we're also not getting to the jdkAdded call in PythonSdkTableListener, which in the end leads to a missing SDK entry in IDEA after creation (it only appears after reopening Project Structure). The fix is to move the sdkCreated callback out of the condition, however we don't really need the calls to addSdk and apply since we do addSdk inside the callback anyway and it's not necessary to call apply since it only affects the changelog of sdks for Apply button in Project Structure. (cherry picked from commit 56ec8af1889117503d19aeae9c95fe3f930de95d) IJ-MR-181485 GitOrigin-RevId: feec34e57b7c6a9df13e4158c53593f1b8d6f1f1
This commit is contained in:
committed by
intellij-monorepo-bot
parent
5778f428e9
commit
6335103904
@@ -22,7 +22,6 @@ import com.intellij.openapi.ui.DialogWrapper.OK_EXIT_CODE
|
||||
import com.intellij.openapi.util.Disposer
|
||||
import com.intellij.openapi.util.NlsActions
|
||||
import com.jetbrains.python.PyBundle
|
||||
import com.jetbrains.python.configuration.PyConfigurableInterpreterList
|
||||
import com.jetbrains.python.run.PythonInterpreterTargetEnvironmentFactory
|
||||
import com.jetbrains.python.run.allowCreationTargetOfThisType
|
||||
import com.jetbrains.python.sdk.ModuleOrProject.ModuleAndProject
|
||||
@@ -131,15 +130,10 @@ private class AddInterpreterOnTargetAction(
|
||||
|
||||
private fun exitHandler(dialogWrapper: TargetEnvironmentWizard) {
|
||||
if (dialogWrapper.exitCode != OK_EXIT_CODE) return
|
||||
val model = PyConfigurableInterpreterList.getInstance(project).model
|
||||
val sdk = (dialogWrapper.currentStepObject as? TargetCustomToolWizardStep)?.customTool as? Sdk ?: return
|
||||
|
||||
PythonNewInterpreterAddedCollector.logPythonNewInterpreterAdded(sdk, isPreviouslyConfigured = true)
|
||||
if (model.findSdk(sdk.name) == null) {
|
||||
model.addSdk(sdk)
|
||||
model.apply()
|
||||
onSdkCreated.accept(sdk)
|
||||
}
|
||||
onSdkCreated.accept(sdk)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user