Esempio n. 1
0
 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);
 }
  public void setTemplate(final Template template) {
    Template old = this.selected;
    this.selected = template;
    propSupport.firePropertyChange(PROP_TEMPLATE, old, template);

    if (template != null) {
      txtDescription.setText(
          String.format(
              "<form>Loading help content for template '%s'...</form>", template.getName()));
      Job updateDescJob = new UpdateDescriptionJob(template, txtDescription);
      updateDescJob.setSystem(true);
      updateDescJob.schedule();
    } else {
      txtDescription.setText(NO_HELP_CONTENT);
    }
  }
Esempio n. 3
0
 public void setText(String text) {
   this.text = text;
   if (formText != null) formText.setText(text);
 }