Source:
public PluginDisableResult disable(@Nonnull PluginDisableStrategy strategy) throws IOException { PluginDisableResult result = new PluginDisableResult(shortName); if (!this.isEnabled()) { result.setMessage(Messages.PluginWrapper_Already_Disabled(shortName)); result.setStatus(PluginDisableStatus.ALREADY_DISABLED); return result; } String aDependantNotDisabled = null; Set<String> dependantsToCheck; switch (strategy) { case MANDATORY: dependantsToCheck = Sets.difference(this.getDependants(), this.getOptionalDependants()); break; case ALL: dependantsToCheck = this.getDependants(); break; case NONE: default: dependantsToCheck = Sets.difference(this.getDependants(), this.getOptionalDependants()); } for (String dependant : dependantsToCheck) { PluginWrapper dependantPlugin = parent.getPlugin(dependant); if (dependantPlugin == null) { PluginDisableResult dependantStatus = new PluginDisableResult(dependant); dependantStatus.setStatus(PluginDisableStatus.NO_SUCH_PLUGIN); dependantStatus.setMessage(Messages.PluginWrapper_NoSuchPlugin(dependant)); result.addDependantDisableStatus(dependantStatus); } else if (strategy.equals(PluginDisableStrategy.NONE)) { if (dependantPlugin.isEnabled()) { aDependantNotDisabled = dependant; break; } } else if (!dependantPlugin.isEnabled()) { PluginDisableResult dependantStatus = new PluginDisableResult(dependant); dependantStatus.setStatus(PluginDisableStatus.ALREADY_DISABLED); dependantStatus.setMessage(Messages.PluginWrapper_Already_Disabled(dependant)); result.addDependantDisableStatus(dependantStatus); } else { result.addDependantDisableStatus(dependantPlugin.disable(strategy)); } } if (aDependantNotDisabled == null) { this.disableWithoutCheck(); result.setMessage(Messages.PluginWrapper_Plugin_Disabled(shortName)); result.setStatus(PluginDisableStatus.DISABLED); } else { result.setMessage(Messages.PluginWrapper_Plugin_Has_Dependant(shortName, aDependantNotDisabled, strategy)); result.setStatus(PluginDisableStatus.NOT_DISABLED_DEPENDANTS); } return result; }

Target:
public @Nonnull PluginDisableResult disable(@Nonnull PluginDisableStrategy strategy) { PluginDisableResult result = new PluginDisableResult(shortName); if (!this.isEnabled()) { result.setMessage(Messages.PluginWrapper_Already_Disabled(shortName)); result.setStatus(ALREADY_DISABLED); return result; } String aDependantNotDisabled = null; Set<String> dependantsToCheck = dependantsToCheck(strategy); for (String dependant : dependantsToCheck) { PluginWrapper dependantPlugin = parent.getPlugin(dependant); if (dependantPlugin == null) { PluginDisableResult dependantStatus = new PluginDisableResult(dependant, NO_SUCH_PLUGIN, Messages.PluginWrapper_NoSuchPlugin(dependant)); result.addDependantDisableStatus(dependantStatus); } else if (strategy.equals(PluginDisableStrategy.NONE)) { if (dependantPlugin.isEnabled()) { aDependantNotDisabled = dependant; break; } } else if (!dependantPlugin.isEnabled()) { PluginDisableResult dependantStatus = new PluginDisableResult(dependant, ALREADY_DISABLED, Messages.PluginWrapper_Already_Disabled(dependant)); result.addDependantDisableStatus(dependantStatus); } else { PluginDisableResult dependantResult = dependantPlugin.disable(strategy); PluginDisableStatus dependantStatus = dependantResult.status; if (ERROR_DISABLING.equals(dependantStatus) || NOT_DISABLED_DEPENDANTS.equals(dependantStatus)) { aDependantNotDisabled = dependant; break; } result.addDependantDisableStatus(dependantResult); } } if (aDependantNotDisabled == null) { try { this.disableWithoutCheck(); result.setMessage(Messages.PluginWrapper_Plugin_Disabled(shortName)); result.setStatus(DISABLED); } catch (IOException io) { result.setMessage(Messages.PluginWrapper_Error_Disabling(shortName, io.toString())); result.setStatus(ERROR_DISABLING); } } else { result.setMessage(Messages.PluginWrapper_Plugin_Has_Dependant(shortName, aDependantNotDisabled, strategy)); result.setStatus(NOT_DISABLED_DEPENDANTS); } return result; }