Window System Migration

Tool Windows

Basics

What was a derivative of org.esa.beam.framework.ui.application.support.AbstractToolView

public class ${NAME}ToolView extends AbstractToolView {
   ...
}

becomes a derivative of org.openide.windows.TopComponent:

public class ${NAME}TopComponent extends TopComponent {
   ...
}

 

Help

In most toolwindows we had a help button, created and initialised like this:

AbstractButton helpButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/Help22.png"), false);
helpButton.setToolTipText("Help."); /*I18N*/
helpButton.setName("helpButton");
...
if (getDescriptor().getHelpId() != null) {
    HelpSys.enableHelpOnButton(helpButton, getDescriptor().getHelpId());
    HelpSys.enableHelpKey(mainPane, getDescriptor().getHelpId());
}

This code can be replaced by within a ${NAME}TopComponent.initComponents() method as follows:

AbstractButton helpButton = ToolButtonFactory.createButton(new HelpAction(this), false);
helpButton.setName("helpButton");

We can use new HelpAction(this), because this is a TopComponent which is always HelpCtx.Provider. To provide context-sensitive help also add 

@Override
public HelpCtx getHelpCtx() {
    return new HelpCtx(HELP_ID);
}

 

References