mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-196437 Plugin manager: problem with enabled/disabled plugins blocks any interaction
IDEA-202302 Plugins management: confusing reaction in case of required plugin disabling, and the dependent plugin uninstalling
This commit is contained in:
+18
-18
@@ -663,30 +663,31 @@ public class PluginManagerConfigurableNew
|
||||
|
||||
@Override
|
||||
public void apply() throws ConfigurationException {
|
||||
Map<PluginId, Set<PluginId>> dependencies = new HashMap<>(myPluginsModel.getDependentToRequiredListMap());
|
||||
Map<PluginId, Boolean> enabledMap = myPluginsModel.getEnabledMap();
|
||||
List<String> dependencies = new ArrayList<>();
|
||||
|
||||
for (Iterator<Entry<PluginId, Set<PluginId>>> I = dependencies.entrySet().iterator(); I.hasNext(); ) {
|
||||
Entry<PluginId, Set<PluginId>> entry = I.next();
|
||||
boolean hasNonModuleDeps = false;
|
||||
for (Entry<PluginId, Set<PluginId>> entry : myPluginsModel.getDependentToRequiredListMap().entrySet()) {
|
||||
PluginId id = entry.getKey();
|
||||
|
||||
for (PluginId pluginId : entry.getValue()) {
|
||||
if (!PluginManagerCore.isModuleDependency(pluginId)) {
|
||||
hasNonModuleDeps = true;
|
||||
if (enabledMap.get(id) == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (PluginId dependId : entry.getValue()) {
|
||||
if (!PluginManagerCore.isModuleDependency(dependId)) {
|
||||
IdeaPluginDescriptor descriptor = PluginManager.getPlugin(id);
|
||||
if (!(descriptor instanceof IdeaPluginDescriptorImpl) || !((IdeaPluginDescriptorImpl)descriptor).isDeleted()) {
|
||||
dependencies.add("\"" + (descriptor == null ? id.getIdString() : descriptor.getName()) + "\"");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!hasNonModuleDeps) {
|
||||
I.remove();
|
||||
}
|
||||
}
|
||||
|
||||
if (!dependencies.isEmpty()) {
|
||||
throw new ConfigurationException("<html><body style=\"padding: 5px;\">Unable to apply changes: plugin" +
|
||||
(dependencies.size() == 1 ? " " : "s ") +
|
||||
StringUtil.join(dependencies.keySet(), pluginId -> {
|
||||
IdeaPluginDescriptor descriptor = PluginManager.getPlugin(pluginId);
|
||||
return "\"" + (descriptor == null ? pluginId.getIdString() : descriptor.getName()) + "\"";
|
||||
}, ", ") +
|
||||
StringUtil.join(dependencies, ", ") +
|
||||
" won't be able to load.</body></html>");
|
||||
}
|
||||
|
||||
@@ -697,7 +698,7 @@ public class PluginManagerConfigurableNew
|
||||
}
|
||||
|
||||
List<String> disableIds = new ArrayList<>();
|
||||
for (Entry<PluginId, Boolean> entry : myPluginsModel.getEnabledMap().entrySet()) {
|
||||
for (Entry<PluginId, Boolean> entry : enabledMap.entrySet()) {
|
||||
Boolean enabled = entry.getValue();
|
||||
if (enabled != null && !enabled) {
|
||||
disableIds.add(entry.getKey().getIdString());
|
||||
@@ -728,11 +729,10 @@ public class PluginManagerConfigurableNew
|
||||
|
||||
for (int i = 0; i < rowCount; i++) {
|
||||
IdeaPluginDescriptor descriptor = myPluginsModel.getObjectAt(i);
|
||||
PluginId pluginId = descriptor.getPluginId();
|
||||
boolean enabledInTable = myPluginsModel.isEnabled(pluginId);
|
||||
boolean enabledInTable = myPluginsModel.isEnabled(descriptor);
|
||||
|
||||
if (descriptor.isEnabled() != enabledInTable) {
|
||||
if (enabledInTable && !disabledPlugins.contains(pluginId.getIdString())) {
|
||||
if (enabledInTable && !disabledPlugins.contains(descriptor.getPluginId().getIdString())) {
|
||||
continue; // was disabled automatically on startup
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user