// Print column headers.
System.out.println(" ID State Level " + getNameHeader());
for (int i = 0; i < bundles.length; i++) {
Bundle bundle = bundles[i];
BundleInfo info = this.bundleService.getInfo(bundle);
if (info.getStartLevel() >= bundleLevelThreshold) {
String name = getNameToShow(info);
// Show bundle version if not showing location.
String version = info.getVersion();
name = (!showLoc && !showUpdate && (version != null)) ? name + " (" + version + ")" : name;
name += printFragments(info) + printHosts(info);
String line = String.format("[%4d] [%10s] [%5d] %s", info.getBundleId(),
getStateString(info.getState()), info.getStartLevel(), name);
System.out.println(line);
}
}
} else {
ShellTable table = new ShellTable();
table.column("ID").alignRight();
table.column("State");
table.column("Lvl").alignRight();
table.column("Version");
table.column(getNameHeader());
for (int i = 0; i < bundles.length; i++) {
Bundle bundle = bundles[i];
BundleInfo info = this.bundleService.getInfo(bundle);
if (info.getStartLevel() >= bundleLevelThreshold) {
String name = getNameToShow(info) + printFragments(info) + printHosts(info);
String version = info.getVersion();
table.addRow().addContent(info.getBundleId(), getStateString(info.getState()),
info.getStartLevel(), version, name);
}
}
table.print(System.out);
}
return null;