/** * Sets the contents to rendered in the scrolled form text. The stream must * contain formatting tags. The caller is responsible for closing the input * stream. The call may be long running. For best results, call this method * from another thread and call 'reflow' when done (but make both calls * using 'Display.asyncExec' because these calls must be made in the event * dispatching thread). * * @param is * content input stream */ public void setContents(InputStream is) { loadContents(is); } /**
flayout.marginHeight = 1; container.setLayout(flayout); formText = new ScrolledFormText(container, SWT.V_SCROLL | SWT.H_SCROLL, false); if (borderStyle == SWT.NULL) { formText.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TREE_BORDER); toolkit.paintBordersFor(container); formText.setFormText(ftext); formText.setExpandHorizontal(true); formText.setExpandVertical(true); formText.setBackground(toolkit.getColors().getBackground()); formText.setForeground(toolkit.getColors().getForeground()); ftext.marginWidth = 2; ftext.marginHeight = 2; ftext.setHyperlinkSettings(toolkit.getHyperlinkGroup()); formText.addDisposeListener(e -> { if (toolkit != null) { toolkit.dispose(); formText.setText(text);
@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(); }
/** * Sets the form text to be managed by this scrolled form text. The * instance must be a direct child of this class. If this method is used, * <code>false</code> must be passed in either of the constructors to * avoid creating form text instance. * * @param formText * the form text instance to use. */ public void setFormText(FormText formText) { this.content = formText; super.setContent(content); content.setMenu(getMenu()); if (text != null) loadText(text); } /**
/** * Creates the new scrolled text instance in the provided parent * * @param parent * the parent composite * @param style * the style to pass to the scrolled composite * @param createFormText * if <code>true</code>, enclosing form text instance will be * created in this constructor. */ public ScrolledFormText(Composite parent, int style, boolean createFormText) { super(parent, style); if (createFormText) setFormText(new FormText(this, SWT.NULL)); } /**
treeViewer.setInput(cheatsheetCategories); desc = new ScrolledFormText(sform, true); desc.setEnabled(false);
/** * Sets the form text to be managed by this scrolled form text. The * instance must be a direct child of this class. If this method is used, * <code>false</code> must be passed in either of the constructors to * avoid creating form text instance. * * @param formText * the form text instance to use. */ public void setFormText(FormText formText) { this.content = formText; super.setContent(content); content.setMenu(getMenu()); if (text != null) loadText(text); } /**
/** * Creates the new scrolled text instance in the provided parent * * @param parent * the parent composite * @param style * the style to pass to the scrolled composite * @param createFormText * if <code>true</code>, enclosing form text instance will be * created in this constructor. */ public ScrolledFormText(Composite parent, int style, boolean createFormText) { super(parent, style); if (createFormText) setFormText(new FormText(this, SWT.NULL)); } /**
/** * Sets the contents to rendered in the scrolled form text. The stream must * contain formatting tags. The caller is responsible for closing the input * stream. The call may be long running. For best results, call this method * from another thread and call 'reflow' when done (but make both calls * using 'Display.asyncExec' because these calls must be made in the event * dispatching thread). * * @param is * content input stream */ public void setContents(InputStream is) { loadContents(is); } /**