/** * Creates Heading for a section with the given heading text. * * @param heading * the heading text */ private void createSectionHeading(String heading) { FormText headingText = toolkit.createFormText(mainComposite, false); GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false, NUM_COLUMNS, 1); gridData.verticalIndent = 20; headingText.setLayoutData(gridData); headingText.setColor("header", toolkit.getColors().getColor(IFormColors.TITLE)); headingText.setFont("header", JFaceResources.getBannerFont()); headingText.setText("<form><p><span color=\"header\" font=\"header\">" + heading + "</span></p></form>", true, false); }
private void createFormText(FormToolkit toolkit, Composite parent, String content, int span) { FormText text = toolkit.createFormText(parent, false); text.setText(content, true, false); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = span; gd.widthHint = 400; text.setLayoutData(gd); text.setBackground(parent.getBackground()); text.addHyperlinkListener(this); }
/** * Adds an item to the specified section. * * @param toolkit * The form toolkit. * @param sectionTitle * The section title. * @param text * The text which will be shown. * @param image * The image which will be shown. * @param minColumnWidth * the minimum width of the column. */ protected void addItemToSection(FormToolkit toolkit, String sectionTitle, String text, Image image, int minColumnWidth) { if (sections.containsKey(sectionTitle)) { FormText formText = toolkit.createFormText(sections.get(sectionTitle), false); if (image != null) { formText.setText("<form><p><img href=\"img\"/> " + text + "</p></form>", true, false); formText.setImage("img", image); } else { formText.setText("<form><p>" + text + "</p></form>", true, false); } formText.setLayoutData(new GridData(minColumnWidth, SWT.DEFAULT)); } }
public void copy() { if (bodyText!=null && !bodyText.isDisposed()) bodyText.copy(); }
public boolean canCopy() { return (bodyText!=null && !bodyText.isDisposed())?bodyText.canCopy():false; } public void copy() {
private void reviewTask(EditableTask task) { TaskEditor taskEditor = getTaskEditor(task); Composite container = taskEditor.getControl().getParent(); Composite separator = toolkit.createCompositeSeparator(container); GridData data = new GridData(); data.heightHint = 1; data.horizontalAlignment = SWT.FILL; separator.setLayoutData(data); FormText text = toolkit.createFormText(container, false); text.setImage(DescriptionPanel.REVIEW_IMAGE, CheatSheetPlugin.getPlugin().getImage(ICheatSheetResource.COMPOSITE_TASK_REVIEW)); text.addHyperlinkListener(getEndReviewListener()); text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); StringBuilder buf = new StringBuilder(); buf.append("<form>"); //$NON-NLS-1$ addHyperlink(buf, END_REVIEW_TAG + task.getId(), DescriptionPanel.REVIEW_IMAGE, Messages.COMPOSITE_PAGE_END_REVIEW ); buf.append("</form>"); //$NON-NLS-1$ text.setText(buf.toString(), true, false); task.setUnderReview(true); container.layout(true); showEditor(task); }
try { FormText text = toolkit.createFormText(composite, true); text.setFont(inner.getFont()); if (fParentCanSwitchPage) { text.setText(Messages.format(NewWizardMessages.AccessRulesDialog_severity_info_with_link, args), true, false); text.addHyperlinkListener(new HyperlinkAdapter() { @Override public void linkActivated(HyperlinkEvent e) { } else { text.setText(Messages.format(NewWizardMessages.AccessRulesDialog_severity_info_no_link, args), true, false); text.setLayoutData(data); } catch (IllegalArgumentException e) {
private FormText createText(Section section, String content, FormToolkit toolkit) { Composite container = toolkit.createComposite(section, SWT.NONE); container.setLayout(FormLayoutFactory.createSectionClientTableWrapLayout(false, 1)); section.setClient(container); FormText text = toolkit.createFormText(container, true); try { text.setText(content, true, false); } catch (SWTException e) { text.setText(e.getMessage(), false, false); } TableWrapData data = new TableWrapData(TableWrapData.FILL_GRAB); data.maxWidth = 250; text.setLayoutData(data); text.addHyperlinkListener(this); return text; }
/** * Creates a form text. * * @param parent the parent to put the form text on * @param text the form text to be displayed * @return the created form text * * @see FormToolkit#createFormText(org.eclipse.swt.widgets.Composite, boolean) */ private FormText createFormText(Composite parent, String text) { FormToolkit toolkit= new FormToolkit(getShell().getDisplay()); try { FormText formText= toolkit.createFormText(parent, true); formText.setFont(parent.getFont()); try { formText.setText(text, true, false); } catch (IllegalArgumentException e) { formText.setText(e.getMessage(), false, false); JavaPlugin.log(e); } formText.marginHeight= 2; formText.marginWidth= 0; formText.setBackground(null); formText.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB)); return formText; } finally { toolkit.dispose(); } }
FormText headingText = new FormText(main, SWT.NONE); headingText.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, NUM_LAYOUT_COLUMNS - 1, 1)); headingText.setFont("header", JFaceResources.getBannerFont()); headingText.setText("<form><p><span color=\"header\" font=\"header\">Tag Specifications</span></p></form>", true, false); Label infoLabelTags = new Label(main, SWT.RIGHT); infoLabelTags.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false)); final FormText addText = new FormText(main, SWT.NONE); addText.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, false, false, NUM_LAYOUT_COLUMNS, 1)); addText.setText("<form><p>Add tag specification ... <a href=\"delete\"><img href=\"addImg\" /></a></p></form>", true, false); addText.setImage("addImg", InspectIT.getDefault().getImage(InspectITImages.IMG_ADD)); addText.addHyperlinkListener(new HyperlinkAdapter() { @Override public void linkActivated(HyperlinkEvent e) {
setLayout(new FormTextLayout()); model = new FormTextModel(); addDisposeListener(e -> { model.dispose(); disposeResourceTable(true); }); addPaintListener(e -> paint(e)); addListener(SWT.KeyDown, e -> { if (e.character == '\r') { activateSelectedLink(); return; addListener(SWT.Traverse, e -> { if (DEBUG_FOCUS) System.out.println("Traversal: " + e); //$NON-NLS-1$ e.doit = advance(true); else if (e.detail == SWT.TRAVERSE_TAB_PREVIOUS) e.doit = advance(false); else if (e.detail != SWT.TRAVERSE_RETURN) e.doit = true; }); addFocusListener(new FocusListener() { @Override public void focusGained(FocusEvent e) { addMouseListener(new MouseListener() { @Override public void mouseDoubleClick(MouseEvent e) {
/** * Sets default text that has no informations displayed. */ private void setDefaultText() { resetDisplayed = false; totalSql.setText("<form><p><b>" + TOTAL_SQLS + "</b></p></form>", true, false); totalDuration.setText("<form><p><b>" + TOTAL_DURATION + "</b></p></form>", true, false); percentageOfDuration.setText("<form><p><b>" + SQLS_DURATION_IN_INVOCATION + "</b></p></form>", true, false); slowestCount.setText("<form><p><b>" + SLOWEST_80_20 + "</b></p></form>", true, false); }
formText.setText(getFormText(), true, false); PDELabelProvider lp = PDEPlugin.getDefault().getLabelProvider(); formText.setImage("loops", lp.get(PDEPluginImages.DESC_LOOP_OBJ)); //$NON-NLS-1$ formText.setImage("search", lp.get(PDEPluginImages.DESC_PSEARCH_OBJ)); //$NON-NLS-1$ formText.setImage("hierarchy", lp.get(PDEPluginImages.DESC_CALLEES)); //$NON-NLS-1$ formText.setImage("dependencies", lp.get(PDEPluginImages.DESC_CALLERS)); //$NON-NLS-1$ formText.addHyperlinkListener(new HyperlinkAdapter() { @Override public void linkActivated(HyperlinkEvent e) {
protected final FormText createClient(Composite section, String content, FormToolkit toolkit) { FormText text = toolkit.createFormText(section, true); try { text.setText(content, true, false); } catch (SWTException e) { text.setText(e.getMessage(), false, false); } text.addHyperlinkListener(this); return text; }
setLayout(new FormTextLayout()); model = new FormTextModel(); addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e) { addPaintListener(new PaintListener() { @Override public void paintControl(PaintEvent e) { addListener(SWT.KeyDown, new Listener() { @Override public void handleEvent(Event e) { addListener(SWT.Traverse, new Listener() { @Override public void handleEvent(Event e) { addFocusListener(new FocusListener() { @Override public void focusGained(FocusEvent e) { addMouseListener(new MouseListener() { @Override public void mouseDoubleClick(MouseEvent e) { addMouseTrackListener(new MouseTrackListener() { @Override public void mouseEnter(MouseEvent e) {
bodyText.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { bodyText.addFocusListener(new FocusListener() { @Override public void focusGained(FocusEvent e) { bodyText.setText(item.getDescription(), item.getDescription().startsWith(IParserTags.FORM_START_TAG), false); bodyText.setBackground(itemColor); bodyText.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB)); CheatSheetStopWatch.printLapTime("ViewItem.addItem()", "Time in addItem() after create FormText: "); //$NON-NLS-1$ //$NON-NLS-2$
"<br/><br/><span color=\"header\" font=\"header\">Send Error Report</span><br/>Please send us the error report to help fix the problem and improve this software.<br/><br/><a href=\"errorReport\">What data does the error report contain?</a></p></form>"); mainFormText.setText(sb.toString(), true, false); mainFormText.setColor("info", toolkit.getColors().getColor(IFormColors.TITLE)); mainFormText.setColor("header", getShell().getDisplay().getSystemColor(SWT.COLOR_RED)); mainFormText.setFont("header", JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); mainFormText.addHyperlinkListener(new HyperlinkAdapter() { @Override public void linkActivated(HyperlinkEvent e) {
/** * Creates the empty profile hint for the user. */ private void createEmptyInputHint() { FormToolkit toolkit = managedForm.getToolkit(); emptyHintComposite = toolkit.createComposite(tabFolder, SWT.NONE); emptyHintComposite.setLayout(new GridLayout(2, false)); Label infoLabel = toolkit.createLabel(emptyHintComposite, null); infoLabel.setImage(Display.getDefault().getSystemImage(SWT.ICON_INFORMATION)); infoLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false)); FormText formText = toolkit.createFormText(emptyHintComposite, false); formText.setText("<form><p>Seems that there are no sensor assignments in this profile. Use <b>Add</b> action to start defining instrumentation points.</p></form>", true, false); formText.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false)); CTabItem tabItem = new CTabItem(tabFolder, SWT.NONE); tabItem.setControl(emptyHintComposite); tabItem.setText("Getting Started"); tabFolder.setSelection(0); }
/** * Create a label with a hyperlink and a picture. * * @param parent the parent widget of the label * @param text the text of the label * @param action the action to be executed if the hyperlink is activated */ private void createLabel(Composite parent, String text, final BuildpathModifierAction action) { FormText formText= createFormText(parent, text); Image image= (Image)fImageMap.get(action.getId()); if (image == null) { image= action.getImageDescriptor().createImage(); fImageMap.put(action.getId(), image); } formText.setImage("defaultImage", image); //$NON-NLS-1$ formText.addHyperlinkListener(new HyperlinkAdapter() { public void linkActivated(HyperlinkEvent e) { action.run(); } }); }
/** * Same as registerHitIcon() but to register a grayed icon. You * can provide the same URL for both the regular and grayed icons, * but two different IDs will be returned. * * @param iconURL the URL to the icon * @return the ID to use for referencing the icon */ private String registerGrayedHitIcon(URL iconURL) { Image image = HelpUIResources.getImage(iconURL); if (image != null) { searchResults.setImage(iconURL.toString(), image); return KEY_PREFIX_GRAYED + iconURL.toString(); } return null; }