Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
public class ${NAME}TopComponent extends TopComponent {
   ...
}

 

Help

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

Code Block
languagejava
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:

Code Block
languagejava
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 

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

 

References

  • Jira Legacy
    serverJIRA (senbox.atlassian.net)
    columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
    serverId34c99a62-e5be-31ca-898a-01c2aded1b99
    keySNAP-45
  • Window and Selection Management Specification

...