コード例 #1
0
  /**
   * Creates the Quartz controls.
   *
   * @param parent the parent
   * @param editorStyle true to use the editor style, false for wizards
   */
  public void createControls(final Composite parent, boolean editorStyle) {

    Label l =
        SwtFactory.createLabel(
            parent, Messages.cronExpression, "A CRON expression to schedule service invocations");
    if (editorStyle) l.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_DARK_BLUE));

    this.cronText = SwtFactory.createSimpleTextField(parent, true);

    Link cronLink = new Link(parent, SWT.NONE);
    cronLink.setText("<A>" + Messages.cronHelp + "</A>");
    cronLink.setLayoutData(new GridData(SWT.RIGHT, SWT.DEFAULT, true, false, 2, 1));
    cronLink.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            try {
              final IWebBrowser browser =
                  PlatformUI.getWorkbench().getBrowserSupport().getExternalBrowser();
              browser.openURL(
                  new URL(
                      "http://www.quartz-scheduler.org/documentation/quartz-1.x/tutorials/crontrigger"));

            } catch (Exception ex) {
              PetalsQuartzPlugin.log(ex, IStatus.ERROR);
              new ErrorDialog(
                      parent.getShell(),
                      Messages.couldNotOpenEditorTitle,
                      Messages.couldNotOpenEditorMessage,
                      new Status(IStatus.ERROR, PetalsQuartzPlugin.PLUGIN_ID, ex.getMessage()),
                      0)
                  .open();
            }
          }
        });

    // The message skeleton
    l =
        SwtFactory.createLabel(
            parent, Messages.content, "A XML message to send to the target service");
    GridDataFactory.swtDefaults().indent(0, 5).span(2, 1).applyTo(l);
    if (editorStyle) l.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_DARK_BLUE));

    this.msgText = SwtFactory.createXmlTextViewer(parent);
    GridDataFactory.swtDefaults()
        .align(SWT.FILL, SWT.FILL)
        .grab(true, true)
        .span(2, 1)
        .applyTo(this.msgText.getParent());
  }
コード例 #2
0
  /**
   * Creates the section for the properties of a service unit.
   *
   * @param parent the parent
   * @return a new section
   */
  private Composite createSuSection(Composite parent) {

    // Container
    FormToolkit toolkit = this.ise.getFormToolkit();
    Composite container = toolkit.createComposite(parent);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginTop = 11;
    layout.marginLeft = 3;
    container.setLayout(layout);
    container.setLayoutData(new GridData(GridData.FILL_BOTH));

    Section section =
        toolkit.createSection(
            container,
            Section.DESCRIPTION | ExpandableComposite.TITLE_BAR | ExpandableComposite.EXPANDED);
    section.setLayoutData(new GridData(GridData.FILL_BOTH));
    section.clientVerticalSpacing = 10;
    section.setText("Service Unit's Properties");
    section.setDescription("Edit the properties of the selected service unit.");

    container = toolkit.createComposite(section, SWT.NONE);
    layout = new GridLayout(2, false);
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.horizontalSpacing = 10;
    container.setLayout(layout);
    container.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
    section.setClient(container);

    // Texts
    final ServiceUnit su = (ServiceUnit) this.viewerSelection;
    Label label = SwtFactory.createLabel(container, "Name:", "The name of the service assembly");
    label.setForeground(this.blueFont);

    this.suNameText = toolkit.createText(container, "", SWT.SINGLE | SWT.BORDER);
    this.suNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    this.suNameText.addModifyListener(
        new ModifyListener() {
          @Override
          public void modifyText(ModifyEvent e) {
            SaEditionComposite.this.viewer.refresh(su, true);
          }
        });

    this.ise
        .getDataBindingContext()
        .bindValue(
            SWTObservables.observeText(this.suNameText),
            EMFEditObservables.observeValue(
                this.ise.getEditingDomain(),
                su.getIdentification(),
                JbiPackage.Literals.IDENTIFICATION__NAME));

    label =
        SwtFactory.createLabel(
            container, "Description:", "The description of the service assembly");
    label.setForeground(this.blueFont);
    label.setLayoutData(new GridData(SWT.DEFAULT, SWT.TOP, false, false));

    this.suDescText = toolkit.createText(container, "", SWT.MULTI | SWT.BORDER);
    GridData layoutData = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
    layoutData.heightHint = 60;
    this.suDescText.setLayoutData(layoutData);
    this.ise
        .getDataBindingContext()
        .bindValue(
            SWTObservables.observeText(this.suDescText),
            EMFEditObservables.observeValue(
                this.ise.getEditingDomain(),
                su.getIdentification(),
                JbiPackage.Literals.IDENTIFICATION__DESCRIPTION));

    label = SwtFactory.createLabel(container, "Zip Artifact:", "The name of the *.zip artifact");
    label.setForeground(this.blueFont);

    this.suArtifactsText = toolkit.createText(container, "", SWT.SINGLE | SWT.BORDER);
    this.suArtifactsText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    this.ise
        .getDataBindingContext()
        .bindValue(
            SWTObservables.observeText(this.suArtifactsText),
            EMFEditObservables.observeValue(
                this.ise.getEditingDomain(),
                su.getTarget(),
                JbiPackage.Literals.TARGET__ARTIFACTS_ZIP));

    label =
        SwtFactory.createLabel(container, "Component name:", "The name of the target component");
    label.setForeground(this.blueFont);

    this.suComponentText = toolkit.createText(container, "", SWT.SINGLE | SWT.BORDER);
    this.suComponentText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    this.ise
        .getDataBindingContext()
        .bindValue(
            SWTObservables.observeText(this.suComponentText),
            EMFEditObservables.observeValue(
                this.ise.getEditingDomain(),
                su.getTarget(),
                JbiPackage.Literals.TARGET__COMPONENT_NAME));

    return section.getParent();
  }