public void applyChanges() { int nrLines = wMappingParameters.nrNonEmpty(); String variables[] = new String[nrLines]; String inputFields[] = new String[nrLines]; parameters.setVariable(variables); parameters.setInputField(inputFields); for (int i = 0; i < nrLines; i++) { TableItem item = wMappingParameters.getNonEmpty(i); parameters.getVariable()[i] = item.getText(1); parameters.getInputField()[i] = item.getText(2); } parameters.setInheritingAllVariables(wInheritAll.getSelection()); }
private void addParametersTab(final MappingParameters parameters) { CTabItem wParametersTab = new CTabItem(wTabFolder, SWT.NONE); wParametersTab.setText( Messages.getString("MappingFieldRunnerDialog.Parameters.Title")); // $NON-NLS-1$ wParametersTab.setToolTipText( Messages.getString("MappingFieldRunnerDialog.Parameters.Tooltip")); // $NON-NLS-1$ Composite wParametersComposite = new Composite(wTabFolder, SWT.NONE); props.setLook(wParametersComposite); FormLayout parameterTabLayout = new FormLayout(); parameterTabLayout.marginWidth = Const.FORM_MARGIN; parameterTabLayout.marginHeight = Const.FORM_MARGIN; wParametersComposite.setLayout(parameterTabLayout); // Add a checkbox: inherit all variables... // Button wInheritAll = new Button(wParametersComposite, SWT.CHECK); wInheritAll.setText(Messages.getString("MappingFieldRunnerDialog.Parameters.InheritAll")); props.setLook(wInheritAll); FormData fdInheritAll = new FormData(); fdInheritAll.bottom = new FormAttachment(100, 0); fdInheritAll.left = new FormAttachment(0, 0); fdInheritAll.right = new FormAttachment(100, -30); wInheritAll.setLayoutData(fdInheritAll); wInheritAll.setSelection(parameters.isInheritingAllVariables()); // Now add a tableview with the 2 columns to specify: input and output // fields for the source and target steps. // ColumnInfo[] colinfo = new ColumnInfo[] { new ColumnInfo( Messages.getString("MappingFieldRunnerDialog.Parameters.column.Variable"), ColumnInfo.COLUMN_TYPE_TEXT, false, false), //$NON-NLS-1$ new ColumnInfo( Messages.getString("MappingFieldRunnerDialog.Parameters.column.ValueOrField"), ColumnInfo.COLUMN_TYPE_TEXT, false, false), //$NON-NLS-1$ }; colinfo[1].setUsingVariables(true); final TableView wMappingParameters = new TableView( transMeta, wParametersComposite, SWT.FULL_SELECTION | SWT.SINGLE | SWT.BORDER, colinfo, parameters.getVariable().length, lsMod, props); props.setLook(wMappingParameters); FormData fdMappings = new FormData(); fdMappings.left = new FormAttachment(0, 0); fdMappings.right = new FormAttachment(100, 0); fdMappings.top = new FormAttachment(0, 0); fdMappings.bottom = new FormAttachment(wInheritAll, -margin * 2); wMappingParameters.setLayoutData(fdMappings); for (int i = 0; i < parameters.getVariable().length; i++) { TableItem tableItem = wMappingParameters.table.getItem(i); tableItem.setText(1, parameters.getVariable()[i]); tableItem.setText(2, parameters.getInputField()[i]); } wMappingParameters.setRowNums(); wMappingParameters.optWidth(true); FormData fdParametersComposite = new FormData(); fdParametersComposite.left = new FormAttachment(0, 0); fdParametersComposite.top = new FormAttachment(0, 0); fdParametersComposite.right = new FormAttachment(100, 0); fdParametersComposite.bottom = new FormAttachment(100, 0); wParametersComposite.setLayoutData(fdParametersComposite); wParametersComposite.layout(); wParametersTab.setControl(wParametersComposite); changeList.add(new MappingParametersTab(wMappingParameters, wInheritAll, parameters)); }