Geertjan's Blog

  • August 8, 2007

Feature Viewer (Part 1)

Geertjan Wielenga
Product Manager
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\\">");
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>" +

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.

Join the discussion

Comments ( 2 )
  • Pan Feng Wednesday, August 8, 2007

    sb.append("" +

    "<tr>" +

    "<td>" + displayName + "</td>" +

    "<td>" + desc + "</td>" +



    I think that you should not concatenate string in the StringBuilder's append method especially in the loop because of it will generate a lot of redundant StringBuilder for concatenating strings implicitly. So I think the following code snippet is better than the above :).





  • Geertjan Thursday, August 9, 2007


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha