Пример #1
0
  public ConfigurationDialog(
      Shell parent, ExecutionConfiguration configuration, AbstractMeta meta) {
    super(parent);
    this.parent = parent;
    this.configuration = configuration;
    this.abstractMeta = meta;
    initCheckboxFlag();

    // Fill the parameters, maybe do this in another place?
    Map<String, String> params = configuration.getParams();
    params.clear();
    String[] paramNames = meta.listParameters();
    for (String name : paramNames) {
      params.put(name, "");
    }

    props = PropsUI.getInstance();
  }
Пример #2
0
  protected void parametersSectionLayout(Class<?> PKG, String prefix) {

    tabFolder = new CTabFolder(shell, SWT.BORDER);
    props.setLook(tabFolder, Props.WIDGET_STYLE_TAB);
    fdDetails.bottom = new FormAttachment(tabFolder, -16);
    fd_tabFolder = new FormData();
    fd_tabFolder.right = new FormAttachment(100, -15);
    fd_tabFolder.left = new FormAttachment(0, 15);
    fd_tabFolder.top = new FormAttachment(0, 276);
    tabFolder.setLayoutData(fd_tabFolder);

    // Parameters
    CTabItem tbtmParameters = new CTabItem(tabFolder, SWT.NONE);
    tbtmParameters.setText(BaseMessages.getString(PKG, prefix + ".Params.Label"));
    Composite parametersComposite = new Composite(tabFolder, SWT.NONE);
    props.setLook(parametersComposite);

    parametersComposite.setLayout(new FormLayout());
    tbtmParameters.setControl(parametersComposite);

    ColumnInfo[] cParams = {
      new ColumnInfo(
          BaseMessages.getString(PKG, prefix + ".ParamsColumn.Argument"),
          ColumnInfo.COLUMN_TYPE_TEXT,
          false,
          true,
          126), // Stepname
      new ColumnInfo(
          BaseMessages.getString(PKG, prefix + ".ParamsColumn.Default"),
          ColumnInfo.COLUMN_TYPE_TEXT,
          false,
          true,
          138), // Preview size
      new ColumnInfo(
          BaseMessages.getString(PKG, prefix + ".ParamsColumn.Value"),
          ColumnInfo.COLUMN_TYPE_TEXT,
          false,
          false,
          142), // Preview size
      new ColumnInfo(
          BaseMessages.getString(PKG, prefix + ".ParamsColumn.Description"),
          ColumnInfo.COLUMN_TYPE_TEXT,
          false,
          true,
          181), // Preview size
    };

    String[] namedParams = abstractMeta.listParameters();
    int nrParams = namedParams.length;
    wParams =
        new TableView(
            abstractMeta,
            parametersComposite,
            SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI,
            cParams,
            nrParams,
            false,
            null,
            props,
            false);
    FormData fdParams = new FormData();
    fdParams.top = new FormAttachment(0, 10);
    fdParams.left = new FormAttachment(0, 10);
    wParams.setLayoutData(fdParams);

    tabFolder.setSelection(0);

    Button argsButton = new Button(parametersComposite, SWT.NONE);
    fdParams.right = new FormAttachment(argsButton, 0, SWT.RIGHT);
    fdParams.bottom = new FormAttachment(argsButton, -6);
    FormData fd_argsButton = new FormData();
    fd_argsButton.right = new FormAttachment(100, -10);
    fd_argsButton.bottom = new FormAttachment(100, -10);
    argsButton.setLayoutData(fd_argsButton);
    argsButton.setText(BaseMessages.getString(PKG, prefix + ".Arguments.Label"));

    argsButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            new ArgumentsDialog(shell, configuration, abstractMeta);
          }
        });

    // Variables
    CTabItem tbtmVariables = new CTabItem(tabFolder, SWT.NONE);
    tbtmVariables.setText(BaseMessages.getString(PKG, prefix + ".Variables.Label"));

    Composite variablesComposite = new Composite(tabFolder, SWT.NONE);
    props.setLook(variablesComposite);
    variablesComposite.setLayout(new FormLayout());
    tbtmVariables.setControl(variablesComposite);

    ColumnInfo[] cVariables = {
      new ColumnInfo(
          BaseMessages.getString(PKG, prefix + ".VariablesColumn.Argument"),
          ColumnInfo.COLUMN_TYPE_TEXT,
          false,
          false,
          287), // Stepname
      new ColumnInfo(
          BaseMessages.getString(PKG, prefix + ".VariablesColumn.Value"),
          ColumnInfo.COLUMN_TYPE_TEXT,
          false,
          false,
          300), // Preview size
    };

    int nrVariables =
        configuration.getVariables() != null ? configuration.getVariables().size() : 0;
    wVariables =
        new TableView(
            abstractMeta,
            variablesComposite,
            SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI,
            cVariables,
            nrVariables,
            false,
            null,
            props,
            false);

    FormData fdVariables = new FormData();
    fdVariables.top = new FormAttachment(0, 10);
    fdVariables.left = new FormAttachment(0, 10);
    fdVariables.bottom = new FormAttachment(0, 221);
    fdVariables.right = new FormAttachment(100, -10);

    wVariables.setLayoutData(fdVariables);
  }