Wednesday August 08, 2007
Feature Viewer (Part 1)
Run through the New Module wizard, run through the New Window Component wizard, drop a JEditorPane on the TopComponent, set its content type to text/html, add a dependency on Auto Update Services, and then stick this snippet to the end of your TopComponent constructor:
List featureUpdateUnit = UpdateManager.getDefault().getUpdateUnits(UpdateManager.TYPE.FEATURE);
StringBuilder sb = new StringBuilder();
sb.append("<table border=\"1\">");
sb.append("<tr><th>Feature</th><th>Details</th></tr>");
for (int i = 0; i < featureUpdateUnit.size(); i++) {
UpdateUnit uu = (UpdateUnit) featureUpdateUnit.get(i);
List<UpdateElement> el = uu.getAvailableUpdates();
for (int j = 0; j < el.size(); j++) {
String displayName = el.get(j).getDisplayName();
String desc = el.get(j).getDescription();
sb.append("" +
"<tr>" +
"<td>" + displayName + "</td>" +
"<td>" + desc + "</td>" +
"<tr>"
);
}
}
sb.append("</table>");
jEditorPane1.setText(sb.toString());
Install the module and then you have a feature viewer, especially useful for seeing which modules are currently available but not (yet) installed:

Next, work with the PrintCookie, as described here and here. And then... you will be able to create reports from the data retrieved from the Plugin Manager, which is something the Plugin Manager itself can't do. For example, here's a print preview:

Continue here for part 2.
Aug 08 2007, 01:40:47 AM PDT Permalink


