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. GitOrigin-RevId: 0c87588c4f87bc9888993d845b0c8588b27e104d
This commit is contained in:
committed by
intellij-monorepo-bot
parent
0f4517b7cc
commit
c8a4b34bd2
@@ -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