mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 06:50:54 +07:00
[execution] IJPL-201709 check whether a plugin can be enabled for an unknown run configuration quick fix
- do not offer an enablement quick fix if the Ultimate plugin is disabled and the given plugin requires it (cherry picked from commit d3d2182b0368a2f55d9b927c049ce3d3cdfb8e85) IJ-CR-172226 GitOrigin-RevId: 98008448f08a14001b2083c0a9d4af069d991eb8
This commit is contained in:
committed by
intellij-monorepo-bot
parent
3aa2dd8684
commit
aaae53f01e
@@ -7,6 +7,7 @@ import com.intellij.execution.Executor;
|
||||
import com.intellij.execution.RunManager;
|
||||
import com.intellij.execution.runners.ExecutionEnvironment;
|
||||
import com.intellij.ide.plugins.PluginFeatureService;
|
||||
import com.intellij.ide.plugins.UltimateDependencyChecker;
|
||||
import com.intellij.ide.plugins.PluginManagerConfigurableService;
|
||||
import com.intellij.ide.plugins.advertiser.FeaturePluginData;
|
||||
import com.intellij.openapi.options.SettingsEditor;
|
||||
@@ -109,7 +110,8 @@ public final class UnknownRunConfiguration implements RunConfiguration, WithoutO
|
||||
return;
|
||||
}
|
||||
FeaturePluginData plugin = PluginFeatureService.Companion.__getPluginForFeature(RunManager.CONFIGURATION_TYPE_FEATURE_ID, typeId);
|
||||
if (plugin != null) {
|
||||
if (plugin != null &&
|
||||
UltimateDependencyChecker.getInstance().canBeEnabled(plugin.pluginData.getPluginId())) {
|
||||
RuntimeConfigurationError err = new RuntimeConfigurationError(
|
||||
ExecutionBundle.message("dialog.message.broken.configuration.missing.plugin", plugin.displayName));
|
||||
err.setQuickFix(() -> {
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
com.intellij.ide.plugins.PluginManagerConfigurableService
|
||||
- s:getInstance():com.intellij.ide.plugins.PluginManagerConfigurableService
|
||||
- a:showPluginConfigurableAndEnable(com.intellij.openapi.project.Project,java.lang.String[]):V
|
||||
com.intellij.ide.plugins.UltimateDependencyChecker
|
||||
- sf:Companion:com.intellij.ide.plugins.UltimateDependencyChecker$Companion
|
||||
- a:canBeEnabled(com.intellij.openapi.extensions.PluginId):Z
|
||||
- s:getInstance():com.intellij.ide.plugins.UltimateDependencyChecker
|
||||
f:com.intellij.ide.plugins.UltimateDependencyChecker$Companion
|
||||
- f:getInstance():com.intellij.ide.plugins.UltimateDependencyChecker
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.ide.plugins
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.components.service
|
||||
import com.intellij.openapi.extensions.PluginId
|
||||
|
||||
interface UltimateDependencyChecker {
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun getInstance(): UltimateDependencyChecker = ApplicationManager.getApplication().service()
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether a plugin with the specified [pluginId] can be enabled in the current IDE context.
|
||||
*
|
||||
* The result depends on whether the Ultimate plugin is enabled and whether the given plugin requires the Ultimate plugin.
|
||||
* If the Ultimate plugin is disabled and the plugin has a dependency on it, this method will return `false`.
|
||||
*
|
||||
* @param pluginId the unique identifier of the plugin to check.
|
||||
* @return `true` if the plugin can be enabled in the current IDE context, `false` otherwise.
|
||||
*/
|
||||
fun canBeEnabled(pluginId: PluginId): Boolean
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.ide.plugins
|
||||
|
||||
import com.intellij.openapi.extensions.PluginId
|
||||
|
||||
internal class UltimateDependencyCheckerImpl : UltimateDependencyChecker {
|
||||
override fun canBeEnabled(pluginId: PluginId): Boolean {
|
||||
if (!PluginManagerCore.isDisabled(PluginManagerCore.ULTIMATE_PLUGIN_ID)) return true
|
||||
|
||||
val pluginIdMap = PluginManagerCore.buildPluginIdMap()
|
||||
val pluginSet = PluginManagerCore.getPluginSet()
|
||||
val contentModuleIdMap = pluginSet.buildContentModuleIdMap()
|
||||
|
||||
return !pluginRequiresUltimatePlugin(pluginId, pluginIdMap, contentModuleIdMap)
|
||||
}
|
||||
}
|
||||
@@ -149,6 +149,8 @@
|
||||
|
||||
<applicationService serviceInterface="com.intellij.ide.plugins.PluginManagerConfigurableService"
|
||||
serviceImplementation="com.intellij.ide.plugins.PluginManagerConfigurableServiceImpl"/>
|
||||
<applicationService serviceInterface="com.intellij.ide.plugins.UltimateDependencyChecker"
|
||||
serviceImplementation="com.intellij.ide.plugins.UltimateDependencyCheckerImpl"/>
|
||||
|
||||
<applicationService serviceInterface="com.intellij.ide.plugins.PluginManagementPolicy"
|
||||
serviceImplementation="com.intellij.ide.plugins.DefaultPluginManagementPolicy"/>
|
||||
|
||||
Reference in New Issue
Block a user