@Override protected Composite createToolTipContentArea(Event event, Composite parent){ FormToolkit toolkit = new FormToolkit(parent.getDisplay()); FormColors colors = toolkit.getColors(); Form form = toolkit.createForm(parent); GridLayout layout = new GridLayout(); layout.numColumns = 1; form.getBody().setLayout(layout); FormText text = toolkit.createFormText(form.getBody(), true); GridData td = new GridData(); td.heightHint = 200; td.widthHint = 300; text.setLayoutData(td); try { text.setText("<form>"+m_htmlString+"</form>", true, true); } catch (IllegalArgumentException e) { text.setText("<form><p>Fehlerhafter ToolTip Eingabestring</p><br /></form>", true, true); } return parent; }
private FormText buildConstraintText(BinaryTemporalConstraint constraint, EPlanElement origin, Composite parent) { FormText text = constraintPrinter.createConstraintText(toolkit, parent); // display the english String string = "<form><p>"; string += constraintPrinter.getText(constraint, origin); String rationale = constraint.getRationale(); if ((rationale != null) && (rationale.trim().length() != 0)) { string += "</p><p>" + constraintPrinter.getRationaleText(constraint); } string += "</p></form>"; text.setText(string, true, false); trace.debug(" : " + string); // activate the links for hover/clicking text.addHyperlinkListener(new TemporalNodeHyperlinkListener(selectionProvider, model.getEPlan(), identifiableRegistry)); return text; }
/** * Override to return form text for the violation. The form text * object is available for calling setColor/setFont. Do not call * setText on this because it will be ignored. * Example: Activity Requirement: ALL_S_BAND_AVAIL is required during COMMS-ETF HRD-DL involving COMMS-ETF HRD-DL * @param text * @param identifiableRegistry * @return */ public String getFormText(FormText text, IdentifiableRegistry<EPlanElement> identifiableRegistry) { PlanPrinter printer = new PlanPrinter(identifiableRegistry); StringBuilder builder = new StringBuilder(); builder.append(StringEscapeFormat.escape(getType())); builder.append(": "); builder.append(StringEscapeFormat.escape(getName())); builder.append(" "); builder.append(StringEscapeFormat.escape(getDescription())); List<? extends EPlanElement> elements = getElements(); if (!elements.isEmpty()) { builder.append(" (involves "); List<String> strings = new ArrayList<String>(elements.size()); for (EPlanElement element : elements) { strings.add(printer.getText(element)); } builder.append(PlanPrinter.getListText(strings)); builder.append(")"); } appendTime(builder); return builder.toString(); }
@Override public String getFormText(FormText text, IdentifiableRegistry<EPlanElement> identifiableRegistry) { if (constraint != null) { return getConstraintFormText(text, identifiableRegistry); } if (effect != null) { return getEffectFormText(text, identifiableRegistry); } PlanPrinter printer = new PlanPrinter(identifiableRegistry); StringBuilder builder = new StringBuilder(); if (difference instanceof ChangedByModifyingParameterOrReference) { buildModificationFormText((ChangedByModifyingParameterOrReference)difference, printer, builder); } else if (difference instanceof ChangedByRemovingElement) { buildRemovalFormText((ChangedByRemovingElement)difference, printer, builder); } else if (difference instanceof ChangedByAddingNewElement) { buildAdditionFormText((ChangedByAddingNewElement)difference, printer, builder); } return builder.toString(); }
private String getConstraintFormText(FormText text, IdentifiableRegistry<EPlanElement> identifiableRegistry) { if (text != null) { text.setColor("start", ColorConstants.darkGreen); text.setColor("end", ColorConstants.red); } if (constraint instanceof ProfileConstraint) { return getProfileConstraintFormText((ProfileConstraint)constraint, identifiableRegistry); } TemporalConstraintPrinter constraintPrinter = new TemporalConstraintPrinter(identifiableRegistry); if (constraint instanceof BinaryTemporalConstraint) { BinaryTemporalConstraint binary = (BinaryTemporalConstraint)constraint; return constraintPrinter.getText(binary, null); } else if (constraint instanceof PeriodicTemporalConstraint) { PeriodicTemporalConstraint periodic = (PeriodicTemporalConstraint)constraint; return constraintPrinter.getText(periodic, false); } else if (constraint instanceof TemporalChain) { TemporalChain chain = (TemporalChain)constraint; return constraintPrinter.getText(chain, null); } return ""; }
/** * 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(); } }
/** * 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= 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() { @Override public void linkActivated(HyperlinkEvent e) { action.run(); } }); }
/** * Sole constructor for this class. * @param plp The {@link ProductLineProject} edited in this editor page. * @param title The title for this editor page. * @param parent The parent, holding this editor page. */ public AbstractEASyEditorPage(ProductLineProject plp, String title, Composite parent) { super(parent, SWT.BORDER); this.plp = plp; setLayout(new FillLayout()); pageListeners = new ArrayList<IEASyPageListener>(); toolkit = new FormToolkit(getDisplay()); // display is assumed to be valid! contentPane = toolkit.createScrolledForm(this); GridLayout layout = new GridLayout(); contentPane.getBody().setLayout(layout); //Set Title contentPane.setText(text) will cause that scrollbars won't work correctly. FormText titleText = toolkit.createFormText(contentPane.getBody(), false); String htmlTitle = "<form><p><span color=\"header\" font=\"header\">" + title + ": " + plp.getProjectName() + "</span></p></form>"; titleText.setWhitespaceNormalized(true); titleText.setFont("header", JFaceResources.getHeaderFont()); titleText.setColor("header", toolkit.getColors().getColor(IFormColors.TITLE)); titleText.setText(htmlTitle, true, false); }
private void createPluginsSection(Composite parent) { Section sctnPlugins = createSection(parent, "Plug-ins"); sctnPlugins.setLayout(FormUtils.createClearTableWrapLayout(false, 1)); TableWrapData data = new TableWrapData(TableWrapData.FILL_GRAB); sctnPlugins.setLayoutData(data); FormText text = formToolkit.createFormText(sctnPlugins, true); ImageDescriptor idesc = HybridUI.getImageDescriptor(HybridUI.PLUGIN_ID, "/icons/etool16/cordovaplug_wiz.png"); text.setImage("plugin", idesc.createImage()); text.setText(PLUGINS_SECTION_CONTENT, true, false); sctnPlugins.setClient(text); text.addHyperlinkListener(this); }
private void configureFormText(final Form form, FormText text) { text.addHyperlinkListener(new HyperlinkAdapter() { @SuppressWarnings("unchecked") public void linkActivated(HyperlinkEvent e) { String is = (String) e.getHref(); try { ((FormText) e.widget).getShell().dispose(); int index = Integer.parseInt(is); IMessage[] messages = form.getChildrenMessages(); IMessage message = messages[index]; Set<IvyNodeElement> conflicts = (Set<IvyNodeElement>) message.getData(); if (conflicts != null) { viewer.setSelection(new StructuredSelection(new ArrayList<>(conflicts))); } } catch (NumberFormatException ex) { } } }); text.setImage("error", getImage(IMessageProvider.ERROR)); text.setImage("warning", getImage(IMessageProvider.WARNING)); text.setImage("info", getImage(IMessageProvider.INFORMATION)); }
public static void initFormText(FormText formText) { formText.setWhitespaceNormalized(false); Font formTextFont = formText.getFont(); FontData formTextFontData = formTextFont.getFontData()[0]; FontData h1FontData = new FontData(formTextFontData.getName(), formTextFontData.getHeight() + 5, SWT.BOLD); final Font h1Font = new Font(formTextFont.getDevice(), h1FontData); formText.setFont(FONT_H1_KEY, h1Font); FontData h3FontData = new FontData(formTextFontData.getName(), formTextFontData.getHeight() + 3, SWT.BOLD); final Font h3Font = new Font(formTextFont.getDevice(), h3FontData); formText.setFont(FONT_H3_KEY, h3Font); Font codeFont = JFaceResources.getTextFont(); formText.setFont(FONT_CODE_KEY, codeFont); formText.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e) { h1Font.dispose(); h3Font.dispose(); } }); // Set fontKeySet = JFaceResources.getFontRegistry().getKeySet(); // if (fontKeySet != null) { // for (Object fontKey : fontKeySet) { // System.out.println(fontKey); // } // } }
public static void bindToExternalLink(final FormText formText, final String key, final String webSiteTaggerDocUrl) { formText.addHyperlinkListener(new HyperlinkAdapter(){ @Override public void linkActivated(HyperlinkEvent e) { if(e.getHref().equals(key)) { try { java.awt.Desktop.getDesktop().browse(java.net.URI.create(webSiteTaggerDocUrl)); } catch (IOException e1) { MessageDialog.openInformation(formText.getShell(), "No browser found", "Could not open the url in your Web browser."); } } } }); }
@Override public String getFormText(FormText text, IdentifiableRegistry<EPlanElement> identifiableRegistry) { setupFormText(text); String printed = new ConstraintViolationPrinter(identifiableRegistry).getBoundText(temporalBound); StringBuilder builder = new StringBuilder(printed); appendWaiverRationale(builder, temporalBound.getWaiverRationale()); return builder.toString(); }
@Override public String getFormText(FormText text, IdentifiableRegistry<EPlanElement> identifiableRegistry) { setupFormText(text); String printed = super.getFormText(text, identifiableRegistry); StringBuilder builder = new StringBuilder(printed); TemporalChain chain = getChain(); if (chain != null) { appendWaiverRationale(builder, chain.getWaiverRationale()); } return builder.toString(); }
@Override public String getFormText(FormText text, IdentifiableRegistry<EPlanElement> identifiableRegistry) { setupFormText(text); String printed = new ConstraintViolationPrinter(identifiableRegistry).getDistanceText(temporalRelation); StringBuilder builder = new StringBuilder(printed); appendWaiverRationale(builder, temporalRelation.getWaiverRationale()); return builder.toString(); }
/** * Create an instance of form text prepared to display a plan element. * @param toolkit * @param parent * @return the form text instance. */ public FormText createConstraintText(FormToolkit toolkit, Composite parent) { final FormText text = createPlanText(toolkit, parent); final FontData fontData = parent.getFont().getFontData()[0]; final Font font = new Font(null, fontData.getName(), fontData.getHeight(), SWT.ITALIC); text.setFont("rationale", font); return text; }
/** * This is a callback that will allow us * to create the viewer and initialize it. */ @Override public void createControl(Composite parent) { sashForm = new SashForm(parent, SWT.VERTICAL); viewer = new PlanAdvisorTreeViewer(sashForm); viewer.setContentProvider(new ViolationContentProvider()); viewer.addDoubleClickListener(new ViolationClickListener(editor, planAdvisorMember)); if (EnsembleProperties.getBooleanPropertyValue("advisor.singleclicktoselectculprits", true)) { viewer.addPostSelectionChangedListener(new ViolationClickListener(editor, planAdvisorMember)); } viewer.addPostSelectionChangedListener(new FixTreeSelectionChangedListener()); viewer.setInput(plan); createTreeContextMenu(viewer.getTree()); Composite composite = new EnsembleComposite(sashForm, SWT.NONE); composite.setLayout(new FillLayout()); composite.setBackground(ColorConstants.blue); scrolledFormText = new ScrolledFormText(composite, SWT.VERTICAL, true); scrolledFormText.setExpandHorizontal(true); scrolledFormText.setExpandVertical(true); scrolledFormText.setAlwaysShowScrollBars(true); FormText formText = scrolledFormText.getFormText(); toolkit = new FormToolkit(parent.getDisplay()); toolkit.adapt(formText); formText.addHyperlinkListener(new TemporalNodeHyperlinkListener(selectionProvider, plan, identifiableRegistry)); ViolationDetailsTreeListener detailsListener = new ViolationDetailsTreeListener(viewer, scrolledFormText, identifiableRegistry); refreshListener = new RefreshListener(viewer, plan, detailsListener); sashForm.setWeights(new int[] {80, 20}); setup(); }
private void appendViolationContents(StringBuilder builder, List<Object> objects) { FormText formText = violationDetails.getFormText(); for (Object object : objects) { builder.append("<p>"); if (object instanceof ViolationTracker) { Violation violation = ((ViolationTracker)object).getViolation(); builder.append(violation.getFormText(formText, identifiableRegistry)); } else { builder.append(StringEscapeFormat.escape(object.toString())); } builder.append("</p>"); } }
@Override protected Composite getBodyComposite() { TimelineViewer viewer = scaleTimelineMarkerEditPart.getViewer(); final EPlan plan = (EPlan) viewer.getTimeline().getModel(); ISelectionProvider selectionProvider = viewer.getSite().getSelectionProvider(); FormText formText = new FormText(mainComposite, SWT.NONE); formText.setBackground(shell.getBackground()); formText.addHyperlinkListener(new TemporalNodeHyperlinkListener(selectionProvider, plan, identifiableRegistry) { @Override public void linkActivated(HyperlinkEvent e) { super.linkActivated(e); Object object = e.getSource(); if(object instanceof Composite) { Composite composite = (Composite)object; composite.getShell().dispose(); } } }); TableWrapData layoutData = new TableWrapData(TableWrapData.FILL); layoutData.maxWidth = TOOLTIP_WIDTH; formText.setLayoutData(layoutData); Violation violation = this.getViolationTracker().getViolation(); String violationText = violation.getFormText(formText, identifiableRegistry); formText.setText("<form><P>" + violationText + "</P></form>", true, false); return formText; }
@Override public String getFormText(FormText text, IdentifiableRegistry<EPlanElement> identifiableRegistry) { String printed = super.getFormText(text, identifiableRegistry); StringBuilder builder = new StringBuilder(printed); appendWaiverRationale(builder, getWaiverRationale()); return builder.toString(); }
@Override public String getFormText(FormText text, IdentifiableRegistry<EPlanElement> identifiableRegistry) { PlanPrinter printer = new PlanPrinter(identifiableRegistry); StringBuilder builder = new StringBuilder(); builder.append(StringEscapeFormat.escape(getType())); builder.append(": "); builder.append(StringEscapeFormat.escape(getName())); builder.append(" "); builder.append(StringEscapeFormat.escape(getDescription())); switch (requirement.getPeriod()) { case REQUIRES_THROUGHOUT: builder.append(" during "); break; case REQUIRES_BEFORE_START: builder.append(" before "); break; } builder.append(printer.getText(activity)); // Are there ever additional participants? If so, list them. List<EPlanElement> elements = new ArrayList<EPlanElement>(); elements.addAll(getElements()); elements.remove(activity); // already mentioned above if (!elements.isEmpty()) { builder.append(" (also involves "); List<String> strings = new ArrayList<String>(elements.size()); for (EPlanElement element : elements) { strings.add(printer.getText(element)); } builder.append(PlanPrinter.getListText(strings)); builder.append(")"); } appendTime(builder); List<String> waivers = getActivityRequirementPlanAdvisorWaivers(); appendWaiverRationale(builder, WaiverUtils.getRationale(getPrefix(), waivers)); return builder.toString(); }
private void addChain(TemporalChain chain, EPlanElement origin) { Label label = toolkit.createLabel(constraintsComposite, ""); label.setImage(CHAIN_IMAGE); label.setLayoutData(new TableWrapData(TableWrapData.CENTER, TableWrapData.MIDDLE)); FormText text = buildChainText(chain, origin, constraintsComposite); TableWrapData data = new TableWrapData(TableWrapData.FILL); text.setLayoutData(data); toolkit.createLabel(constraintsComposite, ""); }
private void addConstraint(PeriodicTemporalConstraint bound, boolean selected) { Button button = buildDeleteButton(bound, constraintsComposite); button.setLayoutData(new TableWrapData(TableWrapData.CENTER, TableWrapData.MIDDLE)); FormText text = buildConstraintText(bound, constraintsComposite, selected); TableWrapData data = new TableWrapData(TableWrapData.FILL, TableWrapData.MIDDLE); text.setLayoutData(data); toolkit.createLabel(constraintsComposite, ""); }
private void addConstraint(BinaryTemporalConstraint constraint, EPlanElement origin) { Button button = buildDeleteButton(constraint, constraintsComposite); button.setLayoutData(new TableWrapData(TableWrapData.CENTER, TableWrapData.MIDDLE)); FormText text = buildConstraintText(constraint, origin, constraintsComposite); text.setLayoutData(new TableWrapData(TableWrapData.FILL, TableWrapData.MIDDLE)); Button button2 = buildEditButton(constraint, constraintsComposite); button2.setLayoutData(new TableWrapData(TableWrapData.CENTER, TableWrapData.MIDDLE)); }
private FormText buildChainText(TemporalChain chain, EPlanElement origin, Composite parent) { FormText text = constraintPrinter.createConstraintText(toolkit, parent); // display the english String string = "<form><p>"; string += constraintPrinter.getText(chain, origin); string += "</p></form>"; text.setText(string, true, false); trace.debug(" : " + string); text.addHyperlinkListener(new TemporalNodeHyperlinkListener(selectionProvider, model.getEPlan(), identifiableRegistry)); return text; }
private FormText buildConstraintText(PeriodicTemporalConstraint bound, Composite parent, boolean selected) { FormText text = constraintPrinter.createConstraintText(toolkit, parent); // display the english String string = "<form><p>"; string += constraintPrinter.getText(bound, selected); string += "</p></form>"; text.setText(string, true, false); trace.debug(" : " + string); // activate the links for hover/clicking text.addHyperlinkListener(new TemporalNodeHyperlinkListener(selectionProvider, model.getEPlan(), identifiableRegistry)); return text; }
/** * Create an instance of form text prepared to display a plan element. * @param toolkit * @param parent * @return the form text instance. */ public static FormText createPlanText(FormToolkit toolkit, Composite parent) { FormText text = toolkit.createFormText(parent, true); text.setColor("start", ColorConstants.darkGreen); text.setColor("end", ColorConstants.red); return text; }
@Override public String getFormText(FormText text, IdentifiableRegistry<EPlanElement> identifiableRegistry) { String printed = new FlightRuleViolationPrinter(identifiableRegistry).getText(spifeViolation); StringBuilder builder = new StringBuilder(printed); appendTime(builder); return builder.toString(); }
private String getEffectFormText(FormText text, IdentifiableRegistry<EPlanElement> identifiableRegistry) { if (text != null) { text.setColor("start", ColorConstants.darkGreen); text.setColor("end", ColorConstants.red); } PlanPrinter printer = new PlanPrinter(identifiableRegistry); StringBuilder builder = new StringBuilder(); switch (getDiffType()) { case MODIFY: EcoreEList<ProfileEffect> currentEffects = (EcoreEList)target.getMember(ProfileMember.class).getEffects(); ProfileEffect oldEffect = null; for (ProfileEffect currentEffect : currentEffects) { if (similarProfileReferences(currentEffect, effect)) { oldEffect = currentEffect; break; } } if (oldEffect != null) { builder.append(getTargetSource()).append(": "); buildEffectFormText(target, oldEffect, printer, builder); builder.append("<BR/>"); } builder.append(getUpdatedSource()).append(": "); buildEffectFormText(updated, effect, printer, builder); break; case ADD: builder.append(getUpdatedSource()).append(": "); buildEffectFormText(updated, effect, printer, builder); break; case REMOVE: builder.append(getTargetSource()).append(": "); buildEffectFormText(target, effect, printer, builder); break; default: } return builder.toString(); }
public void createControl(Composite parent) { toolkit = new FormToolkit(parent.getDisplay()); int borderStyle = toolkit.getBorderStyle() == SWT.BORDER ? SWT.NULL : SWT.BORDER; container = new Composite(parent, borderStyle); FillLayout flayout = new FillLayout(); flayout.marginWidth = 1; 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 ftext = toolkit.createFormText(formText, false); 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(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { if (toolkit != null) { toolkit.dispose(); toolkit = null; } } }); if (text != null) formText.setText(text); }
private void createExportSection(Composite parent) { Section sctnExport = createSection(parent, "Export"); sctnExport.setLayout(FormUtils.createClearTableWrapLayout(false, 1)); TableWrapData data = new TableWrapData(TableWrapData.FILL_GRAB); sctnExport.setLayoutData(data); FormText text = formToolkit.createFormText(sctnExport, true); ImageDescriptor idesc = HybridUI.getImageDescriptor(HybridUI.PLUGIN_ID, "/icons/etool16/export_wiz.png"); text.setImage("export", idesc.createImage()); text.setText(EXPORT_SECTION_CONTENT, true, false); sctnExport.setClient(text); text.addHyperlinkListener(this); }
@Override protected Control createMessageArea(Composite composite) { // create composite // create image Image image = getImage(); if (image != null) { imageLabel = new Label(composite, SWT.NULL); image.setBackground(imageLabel.getBackground()); imageLabel.setImage(image); // addAccessibleListeners(imageLabel, image); GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.BEGINNING).applyTo(imageLabel); } composite.setLayoutData(new GridData()); FormText formText = new FormText(composite, SWT.NONE); GridData gd = new GridData(GridData.FILL_BOTH); formText.setLayoutData(gd); StringBuilder buf = new StringBuilder(); buf.append("<form>"); //$NON-NLS-1$ buf.append(message); buf.append("</form>"); //$NON-NLS-1$ formText.setText(buf.toString(), true, false); formText.addHyperlinkListener(new HyperlinkAdapter() { @Override public void linkActivated(HyperlinkEvent e) { HyperLinkMessageDialog.this.linkActivated(e); } }); return composite; }
protected FormText getTextControl( Composite parent ) { if ( textField == null ) { textField = FormWidgetFactory.getInstance( ) .createFormText( parent, false ); textField.setLayoutData( new GridData( ) ); textField.addDisposeListener( new DisposeListener( ) { public void widgetDisposed( DisposeEvent event ) { textField = null; } } ); if ( text != null ) { textField.setText( text, true, false ); } Iterator iter = map.keySet( ).iterator( ); while ( iter.hasNext( ) ) { String key = (String) iter.next( ); Object obj = map.get( key ); if ( obj instanceof Image ) textField.setImage( key, (Image) obj ); else if ( obj instanceof Color ) textField.setColor( key, (Color) obj ); } } else { checkParent( textField, parent ); } return textField; }
private void createTextPluginMissingForm(Composite parent){ String expl = Messages.TextTemplateVeiw_NoTxtPluginDescription + Messages.TextTemplateVeiw_NoTxtPluginReason1 + Messages.TextTemplateVeiw_NoTxtPluginReason2 + Messages.TextTemplateVeiw_NoTxtPluginReason3; Form form = UiDesk.getToolkit().createForm(parent); form.setText(Messages.TextTemplateVeiw_NoTxtPluginTitel); form.setLayoutData(SWTHelper.fillGrid(parent, 1)); form.getBody().setLayout(new GridLayout(1, false)); FormText ft = UiDesk.getToolkit().createFormText(form.getBody(), false); ft.setText(expl, true, false); }
public Composite createContainer(final Composite parent, final ITextPlugin.ICallback h){ parent.setLayout(new FillLayout()); // Composite ret=new Composite(parent,SWT.BORDER); Form form = UiDesk.getToolkit().createForm(parent); form.setText(Messages.TextContainer_NoPluginCaption); form.getBody().setLayout(new FillLayout()); FormText ft = UiDesk.getToolkit().createFormText(form.getBody(), false); ft.setText(expl, true, false); return form.getBody(); }
public ScrollHelper(ScrolledFormText comp){ this.comp = comp; FormText ft = comp.getFormText(); ft.addDisposeListener(this); ft.addKeyListener(this); comp.addKeyListener(this); ft.addFocusListener(this); scPeriod = Preferences.getArchivKGScrollPeriod(); scDistUp = Preferences.getArchivKGScrollDistUp(); scDistDown = Preferences.getArchivKGScrollDistDown(); }
@Override protected Control createDialogArea(final Composite parent) { Composite container = (Composite) super.createDialogArea(parent); FormToolkit toolkit = new FormToolkit(container.getDisplay()); ScrolledForm form = toolkit.createScrolledForm(container); GridDataFactory.fillDefaults().grab(true, true).applyTo(container); GridDataFactory.fillDefaults().grab(true, true).applyTo(form); GridDataFactory.fillDefaults().grab(true, true).applyTo(form.getBody()); form.getBody().setLayout(new GridLayout()); Bundle bundle = FrameworkUtil.getBundle(this.getClass()); BundleContext bundleContext = bundle.getBundleContext(); FormText notice = toolkit.createFormText(form.getBody(), true); GridDataFactory.fillDefaults().hint(600, SWT.DEFAULT).applyTo(notice); StringBuffer buf = new StringBuffer(); buf.append("<form>"); buf.append("<p>"+TermSuiteUI.DESCRIPTION+"</p>"); buf.append("<p>"+TermSuiteUI.COPYRIGHT+"</p>"); buf.append("</form>"); notice.setText(buf.toString(), true, false); GridDataFactory.fillDefaults().grab(true, false).applyTo(toolkit.createSeparator(form.getBody(), SWT.HORIZONTAL)); notice = toolkit.createFormText(form.getBody(), true); GridDataFactory.fillDefaults().hint(600, SWT.DEFAULT).applyTo(notice); buf = new StringBuffer(); buf.append("<form>"); buf.append("<p>Current version: "+Platform.getProduct().getDefiningBundle()+"</p>"); buf.append("<p>Last modified: "+dateFormat.format(new Date(bundle.getLastModified()))+"</p>"); buf.append("<p>Plugins:</p>"); for(Bundle b:bundleContext.getBundles()) { if(b.getSymbolicName().startsWith("fr.univnantes.termsuite")) buf.append("<li>"+b.getSymbolicName()+":"+ b.getVersion()+"</li>"); } buf.append("</form>"); notice.setText(buf.toString(), true, false); GridDataFactory.fillDefaults().grab(true, false).applyTo(toolkit.createSeparator(form.getBody(), SWT.HORIZONTAL)); notice = toolkit.createFormText(form.getBody(), true); GridDataFactory.fillDefaults().hint(600, SWT.DEFAULT).applyTo(notice); buf = new StringBuffer(); buf.append("<form>"); buf.append("<p>Web site: <a href=\"web\">"+TermSuiteUI.WEB_SITE_URL+"</a></p>"); buf.append("<p>Source code: <a href=\"github\">"+TermSuiteUI.GITHUB_URL+"</a></p>"); buf.append("<p>Documentation: <a href=\"doc\">"+TermSuiteUI.WEB_SITE_DOC_URL+"</a></p>"); buf.append("</form>"); FormTextUtil.bindToExternalLink(notice, "web", TermSuiteUI.WEB_SITE_URL); FormTextUtil.bindToExternalLink(notice, "github", TermSuiteUI.GITHUB_URL); FormTextUtil.bindToExternalLink(notice, "doc", TermSuiteUI.WEB_SITE_DOC_URL); notice.setText(buf.toString(), true, false); return container; }
public FormText getLabel() { return label; }