if (tray == null) {
tray = new HelpTray();
dialog.openTray(tray);
}
ReusableHelpPart helpPart = tray.getHelpPart();
IHelpPartPage page = helpPart.createPage(CheatSheetHelpPart.ID, null, null);
page.setVerticalSpacing(0);
page.setHorizontalMargin(0);
CheatSheetElement contentElement = CheatSheetRegistryReader.getInstance().findCheatSheet(id);
helpPart.addPart(CheatSheetHelpPart.ID, new CheatSheetHelpPart(helpPart.getForm().getForm().getBody(), helpPart.getForm().getToolkit(), page.getToolBarManager(), contentElement, new DefaultStateManager()));
page.addPart(CheatSheetHelpPart.ID, true);
helpPart.addPage(page);
helpPart.showPage(CheatSheetHelpPart.ID);
}
else {
CheatSheetView view = ViewUtilities.showCheatSheetView();
if (view == null) {
return;
}
// Depending on which constructor was used open the cheat sheet view from a
// URL, an XML string or based on the id
if(url != null) {
view.setInput(id, name, url);
} else if (xml != null) {
view.setInputFromXml(id, name, xml, basePath);
} else {
view.setInput(id);
}
IWorkbenchPage page = view.getSite().getWorkbenchWindow().getActivePage();
page.bringToTop(view);
}
}