mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 21:11:28 +07:00
[evaluation-plugin] Change isApplicable for steps
(cherry picked from commit 648041f19c9b39356b3fed391f92cea984b13c47) IJ-MR-155917 GitOrigin-RevId: 84364c855b474bc6c46c791ff7f58890ca547014
This commit is contained in:
committed by
intellij-monorepo-bot
parent
963adb24ee
commit
8fadc115b9
@@ -2,7 +2,9 @@
|
||||
package com.intellij.cce.python.evaluation
|
||||
|
||||
import com.intellij.cce.core.Language
|
||||
import com.intellij.cce.evaluable.EvaluationStrategy
|
||||
import com.intellij.cce.evaluation.SetupSdkStep
|
||||
import com.intellij.cce.execution.ExecutionMode
|
||||
import com.intellij.cce.workspace.EvaluationWorkspace
|
||||
import com.intellij.ide.plugins.PluginManagerCore
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
@@ -27,6 +29,9 @@ class SetupPythonInterpreterStep(private val project: Project) : SetupSdkStep()
|
||||
|
||||
override fun isApplicable(language: Language): Boolean = language == Language.PYTHON
|
||||
|
||||
override fun isApplicable(language: Language, strategy: EvaluationStrategy): Boolean =
|
||||
strategy.executionMode == ExecutionMode.LOCAL && isApplicable(language)
|
||||
|
||||
override fun start(workspace: EvaluationWorkspace): EvaluationWorkspace? {
|
||||
val pythonPluginEnabled = PluginManagerCore.getPlugin(PluginId.getId(pythonPluginId))?.isEnabled ?: false
|
||||
val pythonPluginProEnabled = PluginManagerCore.getPlugin(PluginId.getId(pythonPluginProId))?.isEnabled ?: false
|
||||
|
||||
@@ -3,20 +3,22 @@ package com.intellij.cce.evaluation
|
||||
|
||||
import com.intellij.cce.core.Language
|
||||
import com.intellij.cce.execution.ExecutionMode
|
||||
import com.intellij.cce.evaluable.EvaluationStrategy
|
||||
import com.intellij.openapi.extensions.ExtensionPointName
|
||||
import com.intellij.openapi.project.Project
|
||||
|
||||
abstract class SetupSdkStep : ForegroundEvaluationStep {
|
||||
companion object {
|
||||
private val EP_NAME = ExtensionPointName.create<SetupSdkStep>("com.intellij.cce.setupSdkStep")
|
||||
fun forLanguage(project: Project, language: Language, executionMode: ExecutionMode): SetupSdkStep? {
|
||||
fun forLanguage(project: Project, language: Language, strategy: EvaluationStrategy): SetupSdkStep? {
|
||||
return EP_NAME.getExtensionList(project).firstOrNull {
|
||||
it.isApplicable(language) &&
|
||||
it.isDockerBased == (executionMode == ExecutionMode.DOCKER)
|
||||
it.isApplicable(language, strategy)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
open val isDockerBased: Boolean = false
|
||||
abstract fun isApplicable(language: Language): Boolean
|
||||
}
|
||||
|
||||
open fun isApplicable(language: Language, strategy: EvaluationStrategy): Boolean =
|
||||
strategy.executionMode == ExecutionMode.LOCAL && isApplicable(language)
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import com.intellij.cce.evaluable.common.CommonActionsInvoker
|
||||
import com.intellij.cce.evaluation.*
|
||||
import com.intellij.cce.evaluation.step.CheckProjectSdkStep
|
||||
import com.intellij.cce.evaluation.step.runInIntellij
|
||||
import com.intellij.cce.execution.ExecutionMode
|
||||
import com.intellij.cce.interpreter.*
|
||||
import com.intellij.cce.processor.DefaultEvaluationRootProcessor
|
||||
import com.intellij.cce.processor.EvaluationRootByRangeProcessor
|
||||
@@ -55,7 +54,7 @@ open class ProjectActionsEnvironment(
|
||||
}
|
||||
private var datasetRefIsHandled = false
|
||||
|
||||
override val setupSdk: EvaluationStep? = SetupSdkStep.forLanguage(project, Language.resolve(config.language), ExecutionMode.resolve(config.executionMode))
|
||||
override val setupSdk: EvaluationStep? = SetupSdkStep.forLanguage(project, Language.resolve(config.language), strategy)
|
||||
override val checkSdk: EvaluationStep? = CheckProjectSdkStep(project, config.language)
|
||||
|
||||
override val preparationDescription: String = "Generating actions by selected files"
|
||||
|
||||
Reference in New Issue
Block a user