* installations are detected.
*
* @return the install step (not <code>null</code>)
*/
protected ChoiceStep checkUnlinkedInstallsStep() {
final ChoiceStep step = new ChoiceStep(installer) {
public boolean canBack() {
return false;
}
public boolean canExecute() {
String[] unlinkedInstallPaths = installer.getOptions().getStrings(
ScanUnlinkedInstallsOperation.OPTION_UNLINKED_INSTALL_DIRS);
String[] unusedInstallPaths = installer.getOptions().getStrings(
ScanUnusedInstallsOperation.OPTION_UNUSED_INSTALL_DIRS);
return (unlinkedInstallPaths.length > 0 || unusedInstallPaths.length > 0)
&& options.getBoolean(OPTION_CLEAN_CONFIG);
}
public void aboutToStep() {
super.aboutToStep();
StringWriter stringWriter = new StringWriter();
PrintWriter writer = new PrintWriter(stringWriter);
String[] unlinkedInstallPaths = installer.getOptions().getStrings(
ScanUnlinkedInstallsOperation.OPTION_UNLINKED_INSTALL_DIRS);
String[] unusedInstallPaths = installer.getOptions().getStrings(
ScanUnusedInstallsOperation.OPTION_UNUSED_INSTALL_DIRS);
for (int i = 0; i < unlinkedInstallPaths.length; i++)
writer.println(unlinkedInstallPaths[i]);
for (int i = 0; i < unusedInstallPaths.length; i++)
writer.println(unusedInstallPaths[i]);
setChoiceText(stringWriter.toString());
}
};
step.setTitle("Delete old installations");
step.setDescription("The following installations appear to be unused."
+ "\nDo you want to delete these installations?");
step.setChoiceText("Scanning for unused installations...");
step.setAcceptText("Yes, delete the installations listed above");
step.setDeclineText("No, do NOT delete any installations");
step.setDefaultChoice(false);
step.setOptionName(OPTION_DELETE_UNUSED_INSTALLATIONS);
installer.add(step);
return step;
}