}
int selection = Integer.parseInt(answer);
PluginMetadata target = ((PluginMetadata) available.get(selection - 1));
long start = System.currentTimeMillis();
Object key = mgr.startInstall(PluginList.createInstallList(data, target.getModuleId()), null, null);
DownloadResults results = CommandInstallCAR.showProgress(mgr, key);
int time = (int)(System.currentTimeMillis() - start) / 1000;
out.println();
if(!results.isFailed()) {
out.print(DeployUtils.reformat("**** Installation Complete!", 4, 72));
for (int i = 0; i < results.getDependenciesPresent().length; i++) {
Artifact uri = results.getDependenciesPresent()[i];
out.print(DeployUtils.reformat("Used existing: "+uri, 4, 72));
}
for (int i = 0; i < results.getDependenciesInstalled().length; i++) {
Artifact uri = results.getDependenciesInstalled()[i];
out.print(DeployUtils.reformat("Installed new: "+uri, 4, 72));
}
out.println();
out.print(DeployUtils.reformat("Downloaded "+(results.getTotalDownloadBytes()/1024)+" kB in "+time+"s ("+results.getTotalDownloadBytes()/(1024*time)+" kB/s)", 4, 72));
}
if(results.isFinished() && !results.isFailed()) {
out.print(DeployUtils.reformat("Now starting "+target.getModuleId()+"...", 4, 72));
out.flush();
new CommandStart().execute(out, connection, new String[]{target.getModuleId().toString()});
}
} catch (IOException e) {