PluginEnableDisableAction (@NotNull List<? extends ListPluginComponent> selection) { Iterator<? extends ListPluginComponent> iterator = selection.iterator(); BooleanSupplier isGloballyEnabledGenerator = () -> myPluginModel.getState(iterator.next().getPluginDescriptor()) == PluginEnabledState.ENABLED; boolean firstDisabled = !isGloballyEnabledGenerator.getAsBoolean(); while (iterator.hasNext()) { if (firstDisabled == isGloballyEnabledGenerator.getAsBoolean()) { return PluginEnableDisableAction.ENABLE_GLOBALLY; } } return PluginEnableDisableAction.globally(firstDisabled); }