public synchronized String uninstallAddOns ( List < String > addons ) { StringBuilder errorMessages = new StringBuilder ( ) ; AddOnCollection aoc = this . getLocalVersionInfo ( ) ; if ( aoc == null ) { String error = Constant . messages . getString ( "cfu.cmdline.nocfu" ) ; errorMessages . append ( error ) ; CommandLine . error ( error ) ; } else { for ( String aoName : addons ) { AddOn ao = aoc . getAddOn ( aoName ) ; if ( ao == null ) { String error = Constant . messages . getString ( "cfu.cmdline.noaddon" , aoName ) ; errorMessages . append ( error ) ; errorMessages . append ( "\n" ) ; CommandLine . error ( error ) ; continue ; } AddOnDependencyChecker addOnDependencyChecker = new AddOnDependencyChecker ( getLocalVersionInfo ( ) , aoc ) ; Set < AddOn > addonSet = new HashSet < AddOn > ( ) ; addonSet . add ( ao ) ; UninstallationResult result = addOnDependencyChecker . calculateUninstallChanges ( addonSet ) ; // Check to see if other add-ons depend on it if ( result . getUninstallations ( ) . size ( ) > 1 ) { // Will always report this add-on as needing to be uninstalled // Remove the specified add-on for the error message result . getUninstallations ( ) . remove ( ao ) ; String error = Constant . messages . getString ( "cfu.cmdline.addonuninst.uninstalls.required" , result . getUninstallations ( ) ) ; errorMessages . append ( error ) ; errorMessages . append ( "\n" ) ; CommandLine . error ( error ) ; continue ; } if ( this . uninstallAddOn ( null , ao , false ) ) { CommandLine . info ( Constant . messages . getString ( "cfu.cmdline.uninstallok" , aoName ) ) ; } else { String error = Constant . messages . getString ( "cfu.cmdline.uninstallfail" , aoName ) ; errorMessages . append ( error ) ; errorMessages . append ( "\n" ) ; CommandLine . error ( error ) ; } } } return errorMessages . toString ( ) ; }
Uninstalls the specified add - ons