@Override public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(); container.setLayout(layout); container.setLayoutData(new GridData(GridData.FILL_BOTH)); formText = new ScrolledFormText(container, true); formText.setBackground(parent.getBackground()); GridData gd = new GridData(GridData.FILL_BOTH); gd.widthHint = 300; gd.heightHint = 300; formText.setLayoutData(gd); HyperlinkSettings settings = new HyperlinkSettings(parent.getDisplay()); formText.getFormText().setHyperlinkSettings(settings); setControl(container); updateContent(); PlatformUI.getWorkbench().getHelpSystem().setHelp(container, IHelpContextIds.REVIEW); } }
/** * The user selected either new cheatsheet category(s) or cheatsheet * element(s). Proceed accordingly. * * @param newSelection * ISelection */ @Override public void selectionChanged(SelectionChangedEvent selectionEvent) { Object obj = getSingleSelection(selectionEvent.getStructuredSelection()); if (obj instanceof CheatSheetCollectionElement) { currentSelection = null; } else { currentSelection = (CheatSheetElement) obj; } String description; if (currentSelection != null) { description = currentSelection.getDescription(); } else { description = ""; //$NON-NLS-1$ } desc.getFormText().setText(description, false, false); desc.reflow(true); setOkButton(); }