/** * Creates a new instance. * * @param parent * @param controller */ public ViewDataDefinition(final Composite parent, final Controller controller) { // Register this.controller = controller; this.controller.addListener(ModelPart.SELECTED_ATTRIBUTE, this); this.controller.addListener(ModelPart.INPUT, this); this.controller.addListener(ModelPart.MODEL, this); // Create the tab folder folder = new CTabFolder(parent, SWT.TOP | SWT.BORDER | SWT.FLAT); folder.setUnselectedCloseVisible(false); folder.setSimple(false); folder.setTabHeight(25); folder.setLayoutData(SWTUtil.createFillGridData()); // Create help button SWTUtil.createHelpButton(controller, folder, "id-1"); // $NON-NLS-1$ // Prevent closing folder.addCTabFolder2Listener( new CTabFolder2Adapter() { @Override public void close(final CTabFolderEvent event) { event.doit = false; } }); folder.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { selectionEvent(); } }); }
/** This method initializes cTabFolder. */ private void createCTabFolder() { GridData gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; gridData.grabExcessVerticalSpace = true; gridData.horizontalSpan = 14; gridData.verticalAlignment = GridData.FILL; cTabFolder = new CTabFolder(hyperLinkShell, SWT.NONE); cTabFolder.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); cTabFolder.setLayoutData(gridData); }
private void createUI() { String newFile = ""; parentShell = ((Spoon) SpoonFactory.getInstance()).getShell(); Display display = parentShell.getDisplay(); comp = new Composite(((Spoon) SpoonFactory.getInstance()).getShell(), SWT.BORDER); comp.setLayout(new GridLayout()); comp.setLayoutData(new GridData(GridData.FILL_BOTH)); lbl = new Label(comp, SWT.CENTER | SWT.TOP); GridData ldata = new GridData(SWT.CENTER, SWT.TOP, true, false); lbl.setLayoutData(ldata); lbl.setText("Preview data returned from HPCC"); Button fileButton = new Button(comp, SWT.PUSH | SWT.SINGLE | SWT.TOP); fileButton.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, false)); fileButton.setText("OPEN FILE"); // Listener for the file open button (fileButton) Listener fileOpenListener = new Listener() { public void handleEvent(Event e) { String newFile = buildFileDialog(); if (newFile != "") { fileName = newFile; // TODO: create new tab for file // openFile(fileName); openResultsXML(fileName); // int len = folder.getChildren().length; int len = folder.getItemCount(); System.out.println("Number of tabs: " + len); folder.setSelection(len - 1); } } }; fileButton.addListener(SWT.Selection, fileOpenListener); folder = new CTabFolder(comp, SWT.CLOSE); folder.setSimple(false); folder.setBorderVisible(true); folder.setLayoutData(new GridData(GridData.FILL_BOTH)); }
/** This method initializes cTabFolder. */ protected void createCTabFolder() { GridData gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; gridData.grabExcessVerticalSpace = true; gridData.horizontalSpan = 5; gridData.verticalAlignment = GridData.FILL; cTabFolder = new CTabFolder(lookforShell, SWT.NONE); cTabFolder.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); cTabFolder.setLayoutData(gridData); createDiagramListcomposite(); createTreeViewcomposite(); CTabItem cTabItem = new CTabItem(cTabFolder, SWT.None); cTabItem.setControl(diagramListcomposite); cTabItem.setText( Messages.AbstractLookForEditorShell_EditorsList); // TODO change this name into Editor List CTabItem cTabItem1 = new CTabItem(cTabFolder, SWT.None); cTabItem1.setText(Messages.AbstractLookForEditorShell_TreeView); cTabItem1.setControl(treeViewcomposite); }
public String open() { Shell parent = getParent(); Display display = parent.getDisplay(); shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN); props.setLook(shell); setShellImage(shell, input); ModifyListener lsMod = new ModifyListener() { public void modifyText(ModifyEvent e) { input.setChanged(); } }; changed = input.hasChanged(); FormLayout formLayout = new FormLayout(); formLayout.marginWidth = Const.FORM_MARGIN; formLayout.marginHeight = Const.FORM_MARGIN; shell.setLayout(formLayout); shell.setText(BaseMessages.getString(PKG, "XsltDialog.Shell.Title")); int middle = props.getMiddlePct(); int margin = Const.MARGIN; // Filename line wlStepname = new Label(shell, SWT.RIGHT); wlStepname.setText(BaseMessages.getString(PKG, "XsltDialog.Stepname.Label")); props.setLook(wlStepname); fdlStepname = new FormData(); fdlStepname.left = new FormAttachment(0, 0); fdlStepname.right = new FormAttachment(middle, -margin); fdlStepname.top = new FormAttachment(0, margin); wlStepname.setLayoutData(fdlStepname); wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); wStepname.setText(stepname); props.setLook(wStepname); wStepname.addModifyListener(lsMod); fdStepname = new FormData(); fdStepname.left = new FormAttachment(middle, 0); fdStepname.top = new FormAttachment(0, margin); fdStepname.right = new FormAttachment(100, 0); wStepname.setLayoutData(fdStepname); wTabFolder = new CTabFolder(shell, SWT.BORDER); props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB); // //////////////////////// // START OF GENERAL TAB /// // //////////////////////// wGeneralTab = new CTabItem(wTabFolder, SWT.NONE); wGeneralTab.setText(BaseMessages.getString(PKG, "XsltDialog.GeneralTab.TabTitle")); wGeneralComp = new Composite(wTabFolder, SWT.NONE); props.setLook(wGeneralComp); FormLayout generalLayout = new FormLayout(); generalLayout.marginWidth = 3; generalLayout.marginHeight = 3; wGeneralComp.setLayout(generalLayout); // FieldName to evaluate wlField = new Label(wGeneralComp, SWT.RIGHT); wlField.setText(BaseMessages.getString(PKG, "XsltDialog.Field.Label")); props.setLook(wlField); FormData fdlField = new FormData(); fdlField.left = new FormAttachment(0, 0); fdlField.top = new FormAttachment(wStepname, 2 * margin); fdlField.right = new FormAttachment(middle, -margin); wlField.setLayoutData(fdlField); wField = new CCombo(wGeneralComp, SWT.BORDER | SWT.READ_ONLY); wField.setEditable(true); props.setLook(wField); wField.addModifyListener(lsMod); FormData fdField = new FormData(); fdField.left = new FormAttachment(middle, margin); fdField.top = new FormAttachment(wStepname, 2 * margin); fdField.right = new FormAttachment(100, -margin); wField.setLayoutData(fdField); wField.addFocusListener( new FocusListener() { public void focusLost(org.eclipse.swt.events.FocusEvent e) {} public void focusGained(org.eclipse.swt.events.FocusEvent e) { Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT); shell.setCursor(busy); PopulateFields(wField); shell.setCursor(null); busy.dispose(); } }); // Step Ouput field grouping? // //////////////////////// // START OF Output Field GROUP // wOutputField = new Group(wGeneralComp, SWT.SHADOW_NONE); props.setLook(wOutputField); wOutputField.setText(BaseMessages.getString(PKG, "XsltDialog.ResultField.Group.Label")); FormLayout outputfieldgroupLayout = new FormLayout(); outputfieldgroupLayout.marginWidth = 10; outputfieldgroupLayout.marginHeight = 10; wOutputField.setLayout(outputfieldgroupLayout); // Output Fieldame wResultField = new LabelTextVar( transMeta, wOutputField, BaseMessages.getString(PKG, "XsltDialog.ResultField.Label"), BaseMessages.getString(PKG, "XsltDialog.ResultField.Tooltip")); props.setLook(wResultField); wResultField.addModifyListener(lsMod); FormData fdResultField = new FormData(); fdResultField.left = new FormAttachment(0, 0); fdResultField.top = new FormAttachment(wField, margin); fdResultField.right = new FormAttachment(100, 0); wResultField.setLayoutData(fdResultField); fdOutputField = new FormData(); fdOutputField.left = new FormAttachment(0, margin); fdOutputField.top = new FormAttachment(wField, margin); fdOutputField.right = new FormAttachment(100, -margin); wOutputField.setLayoutData(fdOutputField); // /////////////////////////////////////////////////////////// // / END OF Output Field GROUP // /////////////////////////////////////////////////////////// // XSL File grouping // //////////////////////// // START OF XSL File GROUP // wXSLFileGroup = new Group(wGeneralComp, SWT.SHADOW_NONE); props.setLook(wXSLFileGroup); wXSLFileGroup.setText(BaseMessages.getString(PKG, "XsltDialog.XSL.Group.Label")); FormLayout XSLFileGroupLayout = new FormLayout(); XSLFileGroupLayout.marginWidth = 10; XSLFileGroupLayout.marginHeight = 10; wXSLFileGroup.setLayout(XSLFileGroupLayout); // Is XSL source defined in a Field? wlXSLFileField = new Label(wXSLFileGroup, SWT.RIGHT); wlXSLFileField.setText(BaseMessages.getString(PKG, "XsltDialog.XSLFilenameFileField.Label")); props.setLook(wlXSLFileField); fdlXSLFileField = new FormData(); fdlXSLFileField.left = new FormAttachment(0, 0); fdlXSLFileField.top = new FormAttachment(wResultField, margin); fdlXSLFileField.right = new FormAttachment(middle, -margin); wlXSLFileField.setLayoutData(fdlXSLFileField); wXSLFileField = new Button(wXSLFileGroup, SWT.CHECK); props.setLook(wXSLFileField); wXSLFileField.setToolTipText( BaseMessages.getString(PKG, "XsltDialog.XSLFilenameFileField.Tooltip")); fdXSLFileField = new FormData(); fdXSLFileField.left = new FormAttachment(middle, margin); fdXSLFileField.top = new FormAttachment(wResultField, margin); wXSLFileField.setLayoutData(fdXSLFileField); SelectionAdapter lsXslFile = new SelectionAdapter() { public void widgetSelected(SelectionEvent arg0) { ActivewlXSLField(); input.setChanged(); } }; wXSLFileField.addSelectionListener(lsXslFile); // If XSL File name defined in a Field wlXSLField = new Label(wXSLFileGroup, SWT.RIGHT); wlXSLField.setText(BaseMessages.getString(PKG, "XsltDialog.XSLFilenameField.Label")); props.setLook(wlXSLField); FormData fdlXSLField = new FormData(); fdlXSLField.left = new FormAttachment(0, 0); fdlXSLField.top = new FormAttachment(wXSLFileField, margin); fdlXSLField.right = new FormAttachment(middle, -margin); wlXSLField.setLayoutData(fdlXSLField); wXSLField = new CCombo(wXSLFileGroup, SWT.BORDER | SWT.READ_ONLY); wXSLField.setEditable(true); props.setLook(wXSLField); wXSLField.addModifyListener(lsMod); FormData fdXSLField = new FormData(); fdXSLField.left = new FormAttachment(middle, margin); fdXSLField.top = new FormAttachment(wXSLFileField, margin); fdXSLField.right = new FormAttachment(100, -margin); wXSLField.setLayoutData(fdXSLField); wXSLField.addFocusListener( new FocusListener() { public void focusLost(org.eclipse.swt.events.FocusEvent e) {} public void focusGained(org.eclipse.swt.events.FocusEvent e) { Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT); shell.setCursor(busy); PopulateFields(wXSLField); shell.setCursor(null); busy.dispose(); } }); // Is XSL field defined in a Field is a file? wlXSLFieldIsAFile = new Label(wXSLFileGroup, SWT.RIGHT); wlXSLFieldIsAFile.setText(BaseMessages.getString(PKG, "XsltDialog.XSLFieldIsAFile.Label")); props.setLook(wlXSLFieldIsAFile); fdlXSLFieldIsAFile = new FormData(); fdlXSLFieldIsAFile.left = new FormAttachment(0, 0); fdlXSLFieldIsAFile.top = new FormAttachment(wXSLField, margin); fdlXSLFieldIsAFile.right = new FormAttachment(middle, -margin); wlXSLFieldIsAFile.setLayoutData(fdlXSLFieldIsAFile); wXSLFieldIsAFile = new Button(wXSLFileGroup, SWT.CHECK); props.setLook(wXSLFieldIsAFile); wXSLFieldIsAFile.setToolTipText( BaseMessages.getString(PKG, "XsltDialog.XSLFieldIsAFile.Tooltip")); fdXSLFieldIsAFile = new FormData(); fdXSLFieldIsAFile.left = new FormAttachment(middle, margin); fdXSLFieldIsAFile.top = new FormAttachment(wXSLField, margin); wXSLFieldIsAFile.setLayoutData(fdXSLFieldIsAFile); wXSLFieldIsAFile.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent arg0) { input.setChanged(); } }); // XSL Filename wlFilename = new Label(wXSLFileGroup, SWT.RIGHT); wlFilename.setText(BaseMessages.getString(PKG, "XsltDialog.XSLFilename.Label")); props.setLook(wlFilename); FormData fdlXSLFilename = new FormData(); fdlXSLFilename.left = new FormAttachment(0, 0); fdlXSLFilename.top = new FormAttachment(wXSLFieldIsAFile, 2 * margin); fdlXSLFilename.right = new FormAttachment(middle, -margin); wlFilename.setLayoutData(fdlXSLFilename); wbbFilename = new Button(wXSLFileGroup, SWT.PUSH | SWT.CENTER); props.setLook(wbbFilename); wbbFilename.setText(BaseMessages.getString(PKG, "XsltDialog.FilenameBrowse.Button")); wbbFilename.setToolTipText( BaseMessages.getString(PKG, "System.Tooltip.BrowseForFileOrDirAndAdd")); FormData fdbXSLFilename = new FormData(); fdbXSLFilename.right = new FormAttachment(100, 0); fdbXSLFilename.top = new FormAttachment(wXSLFieldIsAFile, 2 * margin); wbbFilename.setLayoutData(fdbXSLFilename); wXSLFilename = new TextVar(transMeta, wXSLFileGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wXSLFilename); wXSLFilename.addModifyListener(lsMod); FormData fdXSLFilename = new FormData(); fdXSLFilename.left = new FormAttachment(middle, margin); fdXSLFilename.right = new FormAttachment(wbbFilename, -margin); fdXSLFilename.top = new FormAttachment(wXSLFieldIsAFile, 2 * margin); wXSLFilename.setLayoutData(fdXSLFilename); // XSLTFactory wlXSLTFactory = new Label(wXSLFileGroup, SWT.RIGHT); wlXSLTFactory.setText(BaseMessages.getString(PKG, "XsltDialog.XSLTFactory.Label")); props.setLook(wlXSLTFactory); fdlXSLTFactory = new FormData(); fdlXSLTFactory.left = new FormAttachment(0, 0); fdlXSLTFactory.top = new FormAttachment(wXSLFilename, 2 * margin); fdlXSLTFactory.right = new FormAttachment(middle, -margin); wlXSLTFactory.setLayoutData(fdlXSLTFactory); wXSLTFactory = new CCombo(wXSLFileGroup, SWT.BORDER | SWT.READ_ONLY); wXSLTFactory.setEditable(true); props.setLook(wXSLTFactory); wXSLTFactory.addModifyListener(lsMod); fdXSLTFactory = new FormData(); fdXSLTFactory.left = new FormAttachment(middle, margin); fdXSLTFactory.top = new FormAttachment(wXSLFilename, 2 * margin); fdXSLTFactory.right = new FormAttachment(100, 0); wXSLTFactory.setLayoutData(fdXSLTFactory); wXSLTFactory.add("JAXP"); wXSLTFactory.add("SAXON"); fdXSLFileGroup = new FormData(); fdXSLFileGroup.left = new FormAttachment(0, margin); fdXSLFileGroup.top = new FormAttachment(wOutputField, margin); fdXSLFileGroup.right = new FormAttachment(100, -margin); wXSLFileGroup.setLayoutData(fdXSLFileGroup); // /////////////////////////////////////////////////////////// // / END OF XSL File GROUP // /////////////////////////////////////////////////////////// fdGeneralComp = new FormData(); fdGeneralComp.left = new FormAttachment(0, 0); fdGeneralComp.top = new FormAttachment(wField, 0); fdGeneralComp.right = new FormAttachment(100, 0); fdGeneralComp.bottom = new FormAttachment(100, 0); wGeneralComp.setLayoutData(fdGeneralComp); wGeneralComp.layout(); wGeneralTab.setControl(wGeneralComp); props.setLook(wGeneralComp); // /////////////////////////////////////////////////////////// // / END OF GENERAL TAB // /////////////////////////////////////////////////////////// // Additional tab... // wAdditionalTab = new CTabItem(wTabFolder, SWT.NONE); wAdditionalTab.setText(BaseMessages.getString(PKG, "XsltDialog.AdvancedTab.Title")); FormLayout addLayout = new FormLayout(); addLayout.marginWidth = Const.FORM_MARGIN; addLayout.marginHeight = Const.FORM_MARGIN; wAdditionalComp = new Composite(wTabFolder, SWT.NONE); wAdditionalComp.setLayout(addLayout); props.setLook(wAdditionalComp); // Output properties wlOutputProperties = new Label(wAdditionalComp, SWT.NONE); wlOutputProperties.setText(BaseMessages.getString(PKG, "XsltDialog.OutputProperties.Label")); props.setLook(wlOutputProperties); fdlOutputProperties = new FormData(); fdlOutputProperties.left = new FormAttachment(0, 0); fdlOutputProperties.top = new FormAttachment(0, margin); wlOutputProperties.setLayoutData(fdlOutputProperties); final int OutputPropertiesRows = input.getOutputPropertyName().length; colinf = new ColumnInfo[] { new ColumnInfo( BaseMessages.getString(PKG, "XsltDialog.ColumnInfo.OutputProperties.Name"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] {""}, false), new ColumnInfo( BaseMessages.getString(PKG, "XsltDialog.ColumnInfo.OutputProperties.Value"), ColumnInfo.COLUMN_TYPE_TEXT, false), }; colinf[0].setComboValues(XsltMeta.outputProperties); colinf[1].setUsingVariables(true); wOutputProperties = new TableView( transMeta, wAdditionalComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, OutputPropertiesRows, lsMod, props); fdOutputProperties = new FormData(); fdOutputProperties.left = new FormAttachment(0, 0); fdOutputProperties.top = new FormAttachment(wlOutputProperties, margin); fdOutputProperties.right = new FormAttachment(100, -margin); fdOutputProperties.bottom = new FormAttachment(wlOutputProperties, 200); wOutputProperties.setLayoutData(fdOutputProperties); // Parameters wlFields = new Label(wAdditionalComp, SWT.NONE); wlFields.setText(BaseMessages.getString(PKG, "XsltDialog.Parameters.Label")); props.setLook(wlFields); fdlFields = new FormData(); fdlFields.left = new FormAttachment(0, 0); fdlFields.top = new FormAttachment(wOutputProperties, 2 * margin); wlFields.setLayoutData(fdlFields); wGet = new Button(wAdditionalComp, SWT.PUSH); wGet.setText(BaseMessages.getString(PKG, "XsltDialog.GetFields.Button")); FormData fdGet = new FormData(); fdGet.top = new FormAttachment(wlFields, margin); fdGet.right = new FormAttachment(100, 0); wGet.setLayoutData(fdGet); final int FieldsRows = input.getParameterField().length; colinf = new ColumnInfo[] { new ColumnInfo( BaseMessages.getString(PKG, "XsltDialog.ColumnInfo.Name"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] {""}, false), new ColumnInfo( BaseMessages.getString(PKG, "XsltDialog.ColumnInfo.Parameter"), ColumnInfo.COLUMN_TYPE_TEXT, false), }; colinf[1].setUsingVariables(true); wFields = new TableView( transMeta, wAdditionalComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, lsMod, props); fdFields = new FormData(); fdFields.left = new FormAttachment(0, 0); fdFields.top = new FormAttachment(wlFields, margin); fdFields.right = new FormAttachment(wGet, -margin); fdFields.bottom = new FormAttachment(100, -margin); wFields.setLayoutData(fdFields); // Search the fields in the background final Runnable runnable = new Runnable() { public void run() { StepMeta stepMeta = transMeta.findStep(stepname); if (stepMeta != null) { try { RowMetaInterface row = transMeta.getPrevStepFields(stepMeta); // Remember these fields... for (int i = 0; i < row.size(); i++) { inputFields.put(row.getValueMeta(i).getName(), Integer.valueOf(i)); } setComboBoxes(); } catch (KettleException e) { logError(BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Message")); } } } }; new Thread(runnable).start(); fdAdditionalComp = new FormData(); fdAdditionalComp.left = new FormAttachment(0, 0); fdAdditionalComp.top = new FormAttachment(wStepname, margin); fdAdditionalComp.right = new FormAttachment(100, 0); fdAdditionalComp.bottom = new FormAttachment(100, 0); wAdditionalComp.setLayoutData(fdAdditionalComp); wAdditionalComp.layout(); wAdditionalTab.setControl(wAdditionalComp); // ////// END of Additional Tab FormData fdTabFolder = new FormData(); fdTabFolder.left = new FormAttachment(0, 0); fdTabFolder.top = new FormAttachment(wStepname, margin); fdTabFolder.right = new FormAttachment(100, 0); fdTabFolder.bottom = new FormAttachment(100, -50); wTabFolder.setLayoutData(fdTabFolder); wOK = new Button(shell, SWT.PUSH); wOK.setText(BaseMessages.getString(PKG, "System.Button.OK")); wCancel = new Button(shell, SWT.PUSH); wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel")); setButtonPositions(new Button[] {wOK, wCancel}, margin, wTabFolder); // Add listeners lsCancel = new Listener() { public void handleEvent(Event e) { cancel(); } }; lsGet = new Listener() { public void handleEvent(Event e) { get(); } }; lsOK = new Listener() { public void handleEvent(Event e) { ok(); } }; wCancel.addListener(SWT.Selection, lsCancel); wGet.addListener(SWT.Selection, lsGet); wOK.addListener(SWT.Selection, lsOK); lsDef = new SelectionAdapter() { public void widgetDefaultSelected(SelectionEvent e) { ok(); } }; wStepname.addSelectionListener(lsDef); // Whenever something changes, set the tooltip to the expanded version // of the filename: wXSLFilename.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { wXSLFilename.setToolTipText(transMeta.environmentSubstitute(wXSLFilename.getText())); } }); // Listen to the Browse... button wbbFilename.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { FileDialog dialog = new FileDialog(shell, SWT.OPEN); dialog.setFilterExtensions(new String[] {"*.xsl;*.XSL", "*.xslt;.*XSLT", "*"}); if (wXSLFilename.getText() != null) { String fname = transMeta.environmentSubstitute(wXSLFilename.getText()); dialog.setFileName(fname); } dialog.setFilterNames( new String[] { BaseMessages.getString(PKG, "XsltDialog.FileType"), BaseMessages.getString(PKG, "System.FileType.AllFiles") }); if (dialog.open() != null) { String str = dialog.getFilterPath() + System.getProperty("file.separator") + dialog.getFileName(); wXSLFilename.setText(str); } } }); wTabFolder.setSelection(0); // Set the shell size, based upon previous time... setSize(); getData(); ActivewlXSLField(); input.setChanged(changed); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } return stepname; }
/** Create contents of the window */ protected void createContents() { m_BkscoverageShell = new Shell(); m_BkscoverageShell.setImage( SWTResourceManager.getImage(BKSCoverageAppWnd.class, "/Properties.ico")); final BorderLayout borderLayout = new BorderLayout(0, 0); borderLayout.setVgap(5); m_BkscoverageShell.setLayout(borderLayout); m_BkscoverageShell.setSize(800, 400); m_BkscoverageShell.setMinimumSize(new Point(800, 400)); m_BkscoverageShell.setText("BKSCoverage"); Composite composite; composite = new Composite(m_BkscoverageShell, SWT.NONE); { TabFolder tabFolder = new TabFolder(composite, SWT.NONE); tabFolder.setBounds(10, 10, 748, 173); { TabItem tbtmTools = new TabItem(tabFolder, SWT.NONE); tbtmTools.setText("Parameters"); Composite composite_1 = new Composite(tabFolder, SWT.NONE); tbtmTools.setControl(composite_1); m_txtWKSPFolder = new Text(composite_1, SWT.BORDER); m_txtWKSPFolder.setText(""); m_txtWKSPFolder.setBounds(122, 14, 564, 21); Button btnWKSPFolder = new Button(composite_1, SWT.NONE); btnWKSPFolder.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { _selectFolder(m_txtWKSPFolder); } }); btnWKSPFolder.setText("..."); btnWKSPFolder.setBounds(692, 12, 38, 25); m_txtStorageFile = new Text(composite_1, SWT.BORDER); m_txtStorageFile.setText(""); m_txtStorageFile.setBounds(122, 45, 564, 21); Button btnStorageFile = new Button(composite_1, SWT.NONE); btnStorageFile.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { _selectFolder(m_txtStorageFile); } }); btnStorageFile.setText("..."); btnStorageFile.setBounds(692, 43, 38, 25); m_lblStorageFile = new Label(composite_1, SWT.NONE); m_lblStorageFile.setText("Storage File:"); m_lblStorageFile.setBounds(10, 48, 119, 15); Label lblUpdFolder = new Label(composite_1, SWT.NONE); lblUpdFolder.setText("WKSP Folder:"); lblUpdFolder.setBounds(10, 17, 119, 15); { m_chkLoadFromStorage = new Button(composite_1, SWT.CHECK); m_chkLoadFromStorage.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) {} }); m_chkLoadFromStorage.setLocation(122, 75); m_chkLoadFromStorage.setSize(138, 16); m_chkLoadFromStorage.setSelection(true); m_chkLoadFromStorage.setText("Load From Storage"); } { m_btnCheckWKSP = new Button(composite_1, SWT.NONE); m_btnCheckWKSP.setLocation(120, 109); m_btnCheckWKSP.setSize(90, 25); m_btnCheckWKSP.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { checkWKPS(); } }); m_btnCheckWKSP.setText("Check WKSP"); } } } composite.setLayoutData(BorderLayout.NORTH); final Label lblX = new Label(composite, SWT.NONE); lblX.setBounds(10, 10, 14, 180); final CTabFolder m_tabTraces = new CTabFolder(m_BkscoverageShell, SWT.NONE); m_tabTraces.setLayoutData(BorderLayout.CENTER); m_infoTabItem = new CTabItem(m_tabTraces, SWT.NONE); m_infoTabItem.setText("Info"); final Text txtInfo = new Text(m_tabTraces, SWT.V_SCROLL | SWT.READ_ONLY | SWT.MULTI | SWT.H_SCROLL | SWT.BORDER); txtInfo.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK)); txtInfo.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); txtInfo.setEditable(false); m_infoTabItem.setControl(txtInfo); m_warnTabItem = new CTabItem(m_tabTraces, SWT.NONE); m_warnTabItem.setText("Warning"); final Text txtWarn = new Text(m_tabTraces, SWT.V_SCROLL | SWT.READ_ONLY | SWT.MULTI | SWT.H_SCROLL | SWT.BORDER); txtWarn.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK)); txtWarn.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); txtWarn.setEditable(false); m_warnTabItem.setControl(txtWarn); m_debugTabItem = new CTabItem(m_tabTraces, SWT.NONE); m_debugTabItem.setText("Debug"); final Text txtDebug = new Text(m_tabTraces, SWT.V_SCROLL | SWT.READ_ONLY | SWT.MULTI | SWT.H_SCROLL | SWT.BORDER); txtDebug.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK)); txtDebug.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); txtDebug.setEditable(false); m_debugTabItem.setControl(txtDebug); m_errorTabItem = new CTabItem(m_tabTraces, SWT.NONE); m_errorTabItem.setText("Error"); final Text txtError = new Text(m_tabTraces, SWT.V_SCROLL | SWT.READ_ONLY | SWT.MULTI | SWT.H_SCROLL | SWT.BORDER); txtError.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_RED)); txtError.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); txtError.setEditable(false); m_errorTabItem.setControl(txtError); }
public String open() { Shell parent = getParent(); Display display = parent.getDisplay(); shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX); props.setLook(shell); setShellImage(shell, mappingMeta); lsMod = new ModifyListener() { public void modifyText(ModifyEvent e) { mappingMeta.setChanged(); } }; changed = mappingMeta.hasChanged(); FormLayout formLayout = new FormLayout(); formLayout.marginWidth = Const.FORM_MARGIN; formLayout.marginHeight = Const.FORM_MARGIN; shell.setLayout(formLayout); shell.setText(Messages.getString("MappingFieldRunnerDialog.Shell.Title")); // $NON-NLS-1$ middle = props.getMiddlePct(); margin = Const.MARGIN; // Stepname line wlStepname = new Label(shell, SWT.RIGHT); wlStepname.setText( Messages.getString("MappingFieldRunnerDialog.Stepname.Label")); // $NON-NLS-1$ props.setLook(wlStepname); fdlStepname = new FormData(); fdlStepname.left = new FormAttachment(0, 0); fdlStepname.right = new FormAttachment(middle, -margin); fdlStepname.top = new FormAttachment(0, margin); wlStepname.setLayoutData(fdlStepname); wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); wStepname.setText(stepname); props.setLook(wStepname); wStepname.addModifyListener(lsMod); fdStepname = new FormData(); fdStepname.left = new FormAttachment(middle, 0); fdStepname.top = new FormAttachment(0, margin); fdStepname.right = new FormAttachment(100, 0); wStepname.setLayoutData(fdStepname); // Show a group with 2 main options: a transformation in the repository // or on file // // ////////////////////////////////////////////////// // The key creation box // ////////////////////////////////////////////////// // gTransGroup = new Group(shell, SWT.SHADOW_ETCHED_IN); gTransGroup.setText( Messages.getString("MappingFieldRunnerDialog.TransGroup.Label")); // $NON-NLS-1$; gTransGroup.setBackground(shell.getBackground()); // the default looks // ugly FormLayout transGroupLayout = new FormLayout(); transGroupLayout.marginLeft = margin * 2; transGroupLayout.marginTop = margin * 2; transGroupLayout.marginRight = margin * 2; transGroupLayout.marginBottom = margin * 2; gTransGroup.setLayout(transGroupLayout); wFieldname = new ComboVar(transMeta, gTransGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wFieldname); wFieldname.addModifyListener(lsMod); FormData fdFilename = new FormData(); fdFilename.left = new FormAttachment(0, 25); fdFilename.right = new FormAttachment(100, -margin); fdFilename.top = new FormAttachment(0, 0); wFieldname.setLayoutData(fdFilename); wExecuteForEachRow = new Button(gTransGroup, SWT.CHECK); FormData fdExecuteForEachRow = new FormData(); fdExecuteForEachRow.left = new FormAttachment(0, 25); fdExecuteForEachRow.top = new FormAttachment(wFieldname, margin); wExecuteForEachRow.setLayoutData(fdExecuteForEachRow); wlExecuteForEachRow = new Label(gTransGroup, SWT.NONE); wlExecuteForEachRow.setText( Messages.getString("MappingFieldRunnerDialog.ForEachRow.Label")); // $NON-NLS-1$ FormData fdlExecuteForEachRow = new FormData(); fdlExecuteForEachRow.left = new FormAttachment(wExecuteForEachRow, margin); fdlExecuteForEachRow.top = new FormAttachment(wFieldname, margin); wlExecuteForEachRow.setLayoutData(fdlExecuteForEachRow); FormData fdTransGroup = new FormData(); fdTransGroup.left = new FormAttachment(0, 0); fdTransGroup.top = new FormAttachment(wStepname, 2 * margin); fdTransGroup.right = new FormAttachment(100, 0); // fdTransGroup.bottom = new FormAttachment(wStepname, 350); gTransGroup.setLayoutData(fdTransGroup); // // Add a tab folder for the parameters and various input and output // streams // wTabFolder = new CTabFolder(shell, SWT.BORDER); props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB); wTabFolder.setSimple(false); wTabFolder.setUnselectedCloseVisible(true); FormData fdTabFolder = new FormData(); fdTabFolder.left = new FormAttachment(0, 0); fdTabFolder.right = new FormAttachment(100, 0); fdTabFolder.top = new FormAttachment(gTransGroup, margin * 2); fdTabFolder.bottom = new FormAttachment(100, -75); wTabFolder.setLayoutData(fdTabFolder); // Now add buttons that will allow us to add or remove input or output // tabs... wAddInput = new Button(shell, SWT.PUSH); props.setLook(wAddInput); wAddInput.setText(Messages.getString("MappingFieldRunnerDialog.button.AddInput")); wAddInput.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { // Simply add a new MappingIODefinition object to the // inputMappings MappingIODefinition definition = new MappingIODefinition(); inputMappings.add(definition); int index = inputMappings.size() - 1; addInputMappingDefinitionTab(definition, index); } }); wAddOutput = new Button(shell, SWT.PUSH); props.setLook(wAddOutput); wAddOutput.setText(Messages.getString("MappingFieldRunnerDialog.button.AddOutput")); wAddOutput.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { // Simply add a new MappingIODefinition object to the // inputMappings MappingIODefinition definition = new MappingIODefinition(); outputMappings.add(definition); int index = outputMappings.size() - 1; addOutputMappingDefinitionTab(definition, index); } }); setButtonPositions(new Button[] {wAddInput, wAddOutput}, margin, wTabFolder); // Some buttons wOK = new Button(shell, SWT.PUSH); wOK.setText(Messages.getString("System.Button.OK")); // $NON-NLS-1$ wCancel = new Button(shell, SWT.PUSH); wCancel.setText(Messages.getString("System.Button.Cancel")); // $NON-NLS-1$ setButtonPositions(new Button[] {wOK, wCancel}, margin, null); // Add listeners lsCancel = new Listener() { public void handleEvent(Event e) { cancel(); } }; lsOK = new Listener() { public void handleEvent(Event e) { ok(); } }; wCancel.addListener(SWT.Selection, lsCancel); wOK.addListener(SWT.Selection, lsOK); lsDef = new SelectionAdapter() { public void widgetDefaultSelected(SelectionEvent e) { ok(); } }; wStepname.addSelectionListener(lsDef); wFieldname.addSelectionListener(lsDef); wExecuteForEachRow.addSelectionListener(lsDef); // Detect X or ALT-F4 or something that kills this window... shell.addShellListener( new ShellAdapter() { public void shellClosed(ShellEvent e) { cancel(); } }); // Set the shell size, based upon previous time... setSize(); getData(); getFields(); mappingMeta.setChanged(changed); wTabFolder.setSelection(0); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } return stepname; }
public String open() { Shell parent = getParent(); Display display = parent.getDisplay(); shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN); props.setLook(shell); setShellImage(shell, input); ModifyListener lsMod = new ModifyListener() { public void modifyText(ModifyEvent e) { input.setChanged(); } }; ModifyListener lsTableMod = new ModifyListener() { public void modifyText(ModifyEvent arg0) { input.setChanged(); } }; changed = input.hasChanged(); FormLayout formLayout = new FormLayout(); formLayout.marginWidth = Const.FORM_MARGIN; formLayout.marginHeight = Const.FORM_MARGIN; shell.setLayout(formLayout); shell.setText(BaseMessages.getString(PKG, "SalesforceDeleteDialog.DialogTitle")); int middle = props.getMiddlePct(); int margin = Const.MARGIN; // Stepname line wlStepname = new Label(shell, SWT.RIGHT); wlStepname.setText(BaseMessages.getString(PKG, "System.Label.StepName")); props.setLook(wlStepname); fdlStepname = new FormData(); fdlStepname.left = new FormAttachment(0, 0); fdlStepname.top = new FormAttachment(0, margin); fdlStepname.right = new FormAttachment(middle, -margin); wlStepname.setLayoutData(fdlStepname); wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); wStepname.setText(stepname); props.setLook(wStepname); wStepname.addModifyListener(lsMod); fdStepname = new FormData(); fdStepname.left = new FormAttachment(middle, 0); fdStepname.top = new FormAttachment(0, margin); fdStepname.right = new FormAttachment(100, 0); wStepname.setLayoutData(fdStepname); wTabFolder = new CTabFolder(shell, SWT.BORDER); props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB); // //////////////////////// // START OF FILE TAB /// // //////////////////////// wGeneralTab = new CTabItem(wTabFolder, SWT.NONE); wGeneralTab.setText(BaseMessages.getString(PKG, "SalesforceDeleteDialog.General.Tab")); wGeneralComp = new Composite(wTabFolder, SWT.NONE); props.setLook(wGeneralComp); FormLayout generalLayout = new FormLayout(); generalLayout.marginWidth = 3; generalLayout.marginHeight = 3; wGeneralComp.setLayout(generalLayout); // /////////////////////////////// // START OF Connection GROUP // // /////////////////////////////// wConnectionGroup = new Group(wGeneralComp, SWT.SHADOW_NONE); props.setLook(wConnectionGroup); wConnectionGroup.setText( BaseMessages.getString(PKG, "SalesforceDeleteDialog.ConnectionGroup.Label")); FormLayout connectionGroupLayout = new FormLayout(); connectionGroupLayout.marginWidth = 10; connectionGroupLayout.marginHeight = 10; wConnectionGroup.setLayout(connectionGroupLayout); // Webservice URL wURL = new LabelTextVar( transMeta, wConnectionGroup, BaseMessages.getString(PKG, "SalesforceDeleteDialog.URL.Label"), BaseMessages.getString(PKG, "SalesforceDeleteDialog.URL.Tooltip")); props.setLook(wURL); wURL.addModifyListener(lsMod); fdURL = new FormData(); fdURL.left = new FormAttachment(0, 0); fdURL.top = new FormAttachment(wStepname, margin); fdURL.right = new FormAttachment(100, 0); wURL.setLayoutData(fdURL); // UserName line wUserName = new LabelTextVar( transMeta, wConnectionGroup, BaseMessages.getString(PKG, "SalesforceDeleteDialog.User.Label"), BaseMessages.getString(PKG, "SalesforceDeleteDialog.User.Tooltip")); props.setLook(wUserName); wUserName.addModifyListener(lsMod); fdUserName = new FormData(); fdUserName.left = new FormAttachment(0, 0); fdUserName.top = new FormAttachment(wURL, margin); fdUserName.right = new FormAttachment(100, 0); wUserName.setLayoutData(fdUserName); // Password line wPassword = new LabelTextVar( transMeta, wConnectionGroup, BaseMessages.getString(PKG, "SalesforceDeleteDialog.Password.Label"), BaseMessages.getString(PKG, "SalesforceDeleteDialog.Password.Tooltip"), true); props.setLook(wPassword); wPassword.addModifyListener(lsMod); fdPassword = new FormData(); fdPassword.left = new FormAttachment(0, 0); fdPassword.top = new FormAttachment(wUserName, margin); fdPassword.right = new FormAttachment(100, 0); wPassword.setLayoutData(fdPassword); // Test Salesforce connection button wTest = new Button(wConnectionGroup, SWT.PUSH); wTest.setText(BaseMessages.getString(PKG, "SalesforceDeleteDialog.TestConnection.Label")); props.setLook(wTest); fdTest = new FormData(); wTest.setToolTipText( BaseMessages.getString(PKG, "SalesforceDeleteDialog.TestConnection.Tooltip")); fdTest.top = new FormAttachment(wPassword, margin); fdTest.right = new FormAttachment(100, 0); wTest.setLayoutData(fdTest); fdConnectionGroup = new FormData(); fdConnectionGroup.left = new FormAttachment(0, margin); fdConnectionGroup.top = new FormAttachment(wStepname, margin); fdConnectionGroup.right = new FormAttachment(100, -margin); wConnectionGroup.setLayoutData(fdConnectionGroup); // /////////////////////////////// // END OF Connection GROUP // // /////////////////////////////// // /////////////////////////////// // START OF Settings GROUP // // /////////////////////////////// wSettingsGroup = new Group(wGeneralComp, SWT.SHADOW_NONE); props.setLook(wSettingsGroup); wSettingsGroup.setText( BaseMessages.getString(PKG, "SalesforceDeleteDialog.SettingsGroup.Label")); FormLayout settingGroupLayout = new FormLayout(); settingGroupLayout.marginWidth = 10; settingGroupLayout.marginHeight = 10; wSettingsGroup.setLayout(settingGroupLayout); // Timeout wlTimeOut = new Label(wSettingsGroup, SWT.RIGHT); wlTimeOut.setText(BaseMessages.getString(PKG, "SalesforceDeleteDialog.TimeOut.Label")); props.setLook(wlTimeOut); fdlTimeOut = new FormData(); fdlTimeOut.left = new FormAttachment(0, 0); fdlTimeOut.top = new FormAttachment(wSettingsGroup, margin); fdlTimeOut.right = new FormAttachment(middle, -margin); wlTimeOut.setLayoutData(fdlTimeOut); wTimeOut = new TextVar(transMeta, wSettingsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wTimeOut); wTimeOut.addModifyListener(lsMod); fdTimeOut = new FormData(); fdTimeOut.left = new FormAttachment(middle, 0); fdTimeOut.top = new FormAttachment(wSettingsGroup, margin); fdTimeOut.right = new FormAttachment(100, 0); wTimeOut.setLayoutData(fdTimeOut); // Use compression? wlUseCompression = new Label(wSettingsGroup, SWT.RIGHT); wlUseCompression.setText( BaseMessages.getString(PKG, "SalesforceDeleteDialog.UseCompression.Label")); props.setLook(wlUseCompression); fdlUseCompression = new FormData(); fdlUseCompression.left = new FormAttachment(0, 0); fdlUseCompression.top = new FormAttachment(wTimeOut, margin); fdlUseCompression.right = new FormAttachment(middle, -margin); wlUseCompression.setLayoutData(fdlUseCompression); wUseCompression = new Button(wSettingsGroup, SWT.CHECK); props.setLook(wUseCompression); wUseCompression.setToolTipText( BaseMessages.getString(PKG, "SalesforceDeleteDialog.UseCompression.Tooltip")); fdUseCompression = new FormData(); fdUseCompression.left = new FormAttachment(middle, 0); fdUseCompression.top = new FormAttachment(wTimeOut, margin); wUseCompression.setLayoutData(fdUseCompression); // Rollback all changes on error? wlRollbackAllChangesOnError = new Label(wSettingsGroup, SWT.RIGHT); wlRollbackAllChangesOnError.setText( BaseMessages.getString(PKG, "SalesforceDeleteDialog.RollbackAllChangesOnError.Label")); props.setLook(wlRollbackAllChangesOnError); fdlRollbackAllChangesOnError = new FormData(); fdlRollbackAllChangesOnError.left = new FormAttachment(0, 0); fdlRollbackAllChangesOnError.top = new FormAttachment(wUseCompression, margin); fdlRollbackAllChangesOnError.right = new FormAttachment(middle, -margin); wlRollbackAllChangesOnError.setLayoutData(fdlRollbackAllChangesOnError); wRollbackAllChangesOnError = new Button(wSettingsGroup, SWT.CHECK); props.setLook(wRollbackAllChangesOnError); wRollbackAllChangesOnError.setToolTipText( BaseMessages.getString(PKG, "SalesforceDeleteDialog.RollbackAllChangesOnError.Tooltip")); fdRollbackAllChangesOnError = new FormData(); fdRollbackAllChangesOnError.left = new FormAttachment(middle, 0); fdRollbackAllChangesOnError.top = new FormAttachment(wUseCompression, margin); wRollbackAllChangesOnError.setLayoutData(fdRollbackAllChangesOnError); // BatchSize value wlBatchSize = new Label(wSettingsGroup, SWT.RIGHT); wlBatchSize.setText(BaseMessages.getString(PKG, "SalesforceDeleteDialog.Limit.Label")); props.setLook(wlBatchSize); fdlBatchSize = new FormData(); fdlBatchSize.left = new FormAttachment(0, 0); fdlBatchSize.top = new FormAttachment(wRollbackAllChangesOnError, margin); fdlBatchSize.right = new FormAttachment(middle, -margin); wlBatchSize.setLayoutData(fdlBatchSize); wBatchSize = new TextVar(transMeta, wSettingsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wBatchSize); wBatchSize.addModifyListener(lsMod); fdBatchSize = new FormData(); fdBatchSize.left = new FormAttachment(middle, 0); fdBatchSize.top = new FormAttachment(wRollbackAllChangesOnError, margin); fdBatchSize.right = new FormAttachment(100, 0); wBatchSize.setLayoutData(fdBatchSize); // Module wlModule = new Label(wSettingsGroup, SWT.RIGHT); wlModule.setText(BaseMessages.getString(PKG, "SalesforceDeleteDialog.Module.Label")); props.setLook(wlModule); fdlModule = new FormData(); fdlModule.left = new FormAttachment(0, 0); fdlModule.top = new FormAttachment(wBatchSize, margin); fdlModule.right = new FormAttachment(middle, -margin); wlModule.setLayoutData(fdlModule); wModule = new ComboVar(transMeta, wSettingsGroup, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER); wModule.setEditable(true); props.setLook(wModule); wModule.addModifyListener(lsTableMod); fdModule = new FormData(); fdModule.left = new FormAttachment(middle, 0); fdModule.top = new FormAttachment(wBatchSize, margin); fdModule.right = new FormAttachment(100, -margin); wModule.setLayoutData(fdModule); wModule.addFocusListener( new FocusListener() { public void focusLost(org.eclipse.swt.events.FocusEvent e) { getModulesListError = false; } public void focusGained(org.eclipse.swt.events.FocusEvent e) { // check if the URL and login credentials passed and not just had error if (Utils.isEmpty(wURL.getText()) || Utils.isEmpty(wUserName.getText()) || Utils.isEmpty(wPassword.getText()) || (getModulesListError)) { return; } Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT); shell.setCursor(busy); getModulesList(); shell.setCursor(null); busy.dispose(); } }); // Salesforce Id Field wlDeleteField = new Label(wSettingsGroup, SWT.RIGHT); wlDeleteField.setText(BaseMessages.getString(PKG, "SalesforceDeleteDialog.KeyField.Label")); props.setLook(wlDeleteField); fdlDeleteField = new FormData(); fdlDeleteField.left = new FormAttachment(0, 0); fdlDeleteField.top = new FormAttachment(wModule, margin); fdlDeleteField.right = new FormAttachment(middle, -margin); wlDeleteField.setLayoutData(fdlDeleteField); wDeleteField = new ComboVar(transMeta, wSettingsGroup, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER); wDeleteField.setEditable(true); props.setLook(wDeleteField); wDeleteField.addModifyListener(lsMod); fdDeleteField = new FormData(); fdDeleteField.left = new FormAttachment(middle, 0); fdDeleteField.top = new FormAttachment(wModule, margin); fdDeleteField.right = new FormAttachment(100, -margin); wDeleteField.setLayoutData(fdDeleteField); wDeleteField.addFocusListener( new FocusListener() { public void focusLost(org.eclipse.swt.events.FocusEvent e) {} public void focusGained(org.eclipse.swt.events.FocusEvent e) { getPreviousFields(); } }); fdSettingsGroup = new FormData(); fdSettingsGroup.left = new FormAttachment(0, margin); fdSettingsGroup.top = new FormAttachment(wConnectionGroup, margin); fdSettingsGroup.right = new FormAttachment(100, -margin); wSettingsGroup.setLayoutData(fdSettingsGroup); // /////////////////////////////// // END OF Settings GROUP // // /////////////////////////////// fdGeneralComp = new FormData(); fdGeneralComp.left = new FormAttachment(0, 0); fdGeneralComp.top = new FormAttachment(wStepname, margin); fdGeneralComp.right = new FormAttachment(100, 0); fdGeneralComp.bottom = new FormAttachment(100, 0); wGeneralComp.setLayoutData(fdGeneralComp); wGeneralComp.layout(); wGeneralTab.setControl(wGeneralComp); // THE BUTTONS wOK = new Button(shell, SWT.PUSH); wOK.setText(BaseMessages.getString(PKG, "System.Button.OK")); wCancel = new Button(shell, SWT.PUSH); wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel")); setButtonPositions(new Button[] {wOK, wCancel}, margin, null); fdTabFolder = new FormData(); fdTabFolder.left = new FormAttachment(0, 0); fdTabFolder.top = new FormAttachment(wStepname, margin); fdTabFolder.right = new FormAttachment(100, 0); fdTabFolder.bottom = new FormAttachment(wOK, -margin); wTabFolder.setLayoutData(fdTabFolder); // Add listeners lsOK = new Listener() { public void handleEvent(Event e) { ok(); } }; lsTest = new Listener() { public void handleEvent(Event e) { test(); } }; lsCancel = new Listener() { public void handleEvent(Event e) { cancel(); } }; wOK.addListener(SWT.Selection, lsOK); wTest.addListener(SWT.Selection, lsTest); wCancel.addListener(SWT.Selection, lsCancel); lsDef = new SelectionAdapter() { public void widgetDefaultSelected(SelectionEvent e) { ok(); } }; wStepname.addSelectionListener(lsDef); // Detect X or ALT-F4 or something that kills this window... shell.addShellListener( new ShellAdapter() { public void shellClosed(ShellEvent e) { cancel(); } }); wTabFolder.setSelection(0); // Set the shell size, based upon previous time... setSize(); getData(input); input.setChanged(changed); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } return stepname; }
public String open() { Shell parent = getParent(); Display display = parent.getDisplay(); shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN); props.setLook(shell); setShellImage(shell, input); ModifyListener lsMod = new ModifyListener() { public void modifyText(ModifyEvent e) { input.setChanged(); } }; changed = input.hasChanged(); FormLayout formLayout = new FormLayout(); formLayout.marginWidth = Const.FORM_MARGIN; formLayout.marginHeight = Const.FORM_MARGIN; shell.setLayout(formLayout); shell.setText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.DialogTitle")); int middle = props.getMiddlePct(); int margin = Const.MARGIN; // Stepname line wlStepname = new Label(shell, SWT.RIGHT); wlStepname.setText(BaseMessages.getString(PKG, "System.Label.StepName")); props.setLook(wlStepname); fdlStepname = new FormData(); fdlStepname.left = new FormAttachment(0, 0); fdlStepname.top = new FormAttachment(0, margin); fdlStepname.right = new FormAttachment(middle, -margin); wlStepname.setLayoutData(fdlStepname); wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); wStepname.setText(stepname); props.setLook(wStepname); wStepname.addModifyListener(lsMod); fdStepname = new FormData(); fdStepname.left = new FormAttachment(middle, 0); fdStepname.top = new FormAttachment(0, margin); fdStepname.right = new FormAttachment(100, 0); wStepname.setLayoutData(fdStepname); wTabFolder = new CTabFolder(shell, SWT.BORDER); props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB); // //////////////////////// // START OF FILE TAB /// // //////////////////////// wFileTab = new CTabItem(wTabFolder, SWT.NONE); wFileTab.setText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.File.Tab")); wFileComp = new Composite(wTabFolder, SWT.NONE); props.setLook(wFileComp); FormLayout fileLayout = new FormLayout(); fileLayout.marginWidth = 3; fileLayout.marginHeight = 3; wFileComp.setLayout(fileLayout); // /////////////////////////////// // START OF Origin files GROUP // // /////////////////////////////// wOriginFiles = new Group(wFileComp, SWT.SHADOW_NONE); props.setLook(wOriginFiles); wOriginFiles.setText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.wOriginFiles.Label")); FormLayout OriginFilesgroupLayout = new FormLayout(); OriginFilesgroupLayout.marginWidth = 10; OriginFilesgroupLayout.marginHeight = 10; wOriginFiles.setLayout(OriginFilesgroupLayout); // Is Filename defined in a Field wlFileField = new Label(wOriginFiles, SWT.RIGHT); wlFileField.setText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.FileField.Label")); props.setLook(wlFileField); fdlFileField = new FormData(); fdlFileField.left = new FormAttachment(0, -margin); fdlFileField.top = new FormAttachment(0, margin); fdlFileField.right = new FormAttachment(middle, -2 * margin); wlFileField.setLayoutData(fdlFileField); wFileField = new Button(wOriginFiles, SWT.CHECK); props.setLook(wFileField); wFileField.setToolTipText( BaseMessages.getString(PKG, "GetFilesRowsCountDialog.FileField.Tooltip")); fdFileField = new FormData(); fdFileField.left = new FormAttachment(middle, -margin); fdFileField.top = new FormAttachment(0, margin); wFileField.setLayoutData(fdFileField); SelectionAdapter lfilefield = new SelectionAdapter() { public void widgetSelected(SelectionEvent arg0) { ActiveFileField(); input.setChanged(); } }; wFileField.addSelectionListener(lfilefield); // Filename field wlFilenameField = new Label(wOriginFiles, SWT.RIGHT); wlFilenameField.setText( BaseMessages.getString(PKG, "GetFilesRowsCountDialog.FilenameField.Label")); props.setLook(wlFilenameField); fdlFilenameField = new FormData(); fdlFilenameField.left = new FormAttachment(0, -margin); fdlFilenameField.top = new FormAttachment(wFileField, margin); fdlFilenameField.right = new FormAttachment(middle, -2 * margin); wlFilenameField.setLayoutData(fdlFilenameField); wFilenameField = new CCombo(wOriginFiles, SWT.BORDER | SWT.READ_ONLY); wFilenameField.setEditable(true); props.setLook(wFilenameField); wFilenameField.addModifyListener(lsMod); fdFilenameField = new FormData(); fdFilenameField.left = new FormAttachment(middle, -margin); fdFilenameField.top = new FormAttachment(wFileField, margin); fdFilenameField.right = new FormAttachment(100, -margin); wFilenameField.setLayoutData(fdFilenameField); wFilenameField.addFocusListener( new FocusListener() { public void focusLost(org.eclipse.swt.events.FocusEvent e) {} public void focusGained(org.eclipse.swt.events.FocusEvent e) { Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT); shell.setCursor(busy); setFileField(); shell.setCursor(null); busy.dispose(); } }); fdOriginFiles = new FormData(); fdOriginFiles.left = new FormAttachment(0, margin); fdOriginFiles.top = new FormAttachment(wFilenameList, margin); fdOriginFiles.right = new FormAttachment(100, -margin); wOriginFiles.setLayoutData(fdOriginFiles); // /////////////////////////////////////////////////////////// // / END OF Origin files GROUP // /////////////////////////////////////////////////////////// // Filename line wlFilename = new Label(wFileComp, SWT.RIGHT); wlFilename.setText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.Filename.Label")); props.setLook(wlFilename); fdlFilename = new FormData(); fdlFilename.left = new FormAttachment(0, 0); fdlFilename.top = new FormAttachment(wOriginFiles, margin); fdlFilename.right = new FormAttachment(middle, -margin); wlFilename.setLayoutData(fdlFilename); wbbFilename = new Button(wFileComp, SWT.PUSH | SWT.CENTER); props.setLook(wbbFilename); wbbFilename.setText( BaseMessages.getString(PKG, "GetFilesRowsCountDialog.FilenameBrowse.Button")); wbbFilename.setToolTipText( BaseMessages.getString(PKG, "System.Tooltip.BrowseForFileOrDirAndAdd")); fdbFilename = new FormData(); fdbFilename.right = new FormAttachment(100, 0); fdbFilename.top = new FormAttachment(wOriginFiles, margin); wbbFilename.setLayoutData(fdbFilename); wbaFilename = new Button(wFileComp, SWT.PUSH | SWT.CENTER); props.setLook(wbaFilename); wbaFilename.setText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.FilenameAdd.Button")); wbaFilename.setToolTipText( BaseMessages.getString(PKG, "GetFilesRowsCountDialog.FilenameAdd.Tooltip")); fdbaFilename = new FormData(); fdbaFilename.right = new FormAttachment(wbbFilename, -margin); fdbaFilename.top = new FormAttachment(wOriginFiles, margin); wbaFilename.setLayoutData(fdbaFilename); wFilename = new TextVar(transMeta, wFileComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wFilename); wFilename.addModifyListener(lsMod); fdFilename = new FormData(); fdFilename.left = new FormAttachment(middle, 0); fdFilename.right = new FormAttachment(wbaFilename, -margin); fdFilename.top = new FormAttachment(wOriginFiles, margin); wFilename.setLayoutData(fdFilename); wlFilemask = new Label(wFileComp, SWT.RIGHT); wlFilemask.setText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.RegExp.Label")); props.setLook(wlFilemask); fdlFilemask = new FormData(); fdlFilemask.left = new FormAttachment(0, 0); fdlFilemask.top = new FormAttachment(wFilename, margin); fdlFilemask.right = new FormAttachment(middle, -margin); wlFilemask.setLayoutData(fdlFilemask); wFilemask = new TextVar(transMeta, wFileComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wFilemask); wFilemask.addModifyListener(lsMod); fdFilemask = new FormData(); fdFilemask.left = new FormAttachment(middle, 0); fdFilemask.top = new FormAttachment(wFilename, margin); fdFilemask.right = new FormAttachment(100, 0); wFilemask.setLayoutData(fdFilemask); wlExcludeFilemask = new Label(wFileComp, SWT.RIGHT); wlExcludeFilemask.setText( BaseMessages.getString(PKG, "GetFilesRowsDialog.ExcludeFilemask.Label")); props.setLook(wlExcludeFilemask); fdlExcludeFilemask = new FormData(); fdlExcludeFilemask.left = new FormAttachment(0, 0); fdlExcludeFilemask.top = new FormAttachment(wFilemask, margin); fdlExcludeFilemask.right = new FormAttachment(middle, -margin); wlExcludeFilemask.setLayoutData(fdlExcludeFilemask); wExcludeFilemask = new TextVar(transMeta, wFileComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wExcludeFilemask); wExcludeFilemask.addModifyListener(lsMod); fdExcludeFilemask = new FormData(); fdExcludeFilemask.left = new FormAttachment(middle, 0); fdExcludeFilemask.top = new FormAttachment(wFilemask, margin); fdExcludeFilemask.right = new FormAttachment(wFilename, 0, SWT.RIGHT); wExcludeFilemask.setLayoutData(fdExcludeFilemask); // Filename list line wlFilenameList = new Label(wFileComp, SWT.RIGHT); wlFilenameList.setText( BaseMessages.getString(PKG, "GetFilesRowsCountDialog.FilenameList.Label")); props.setLook(wlFilenameList); fdlFilenameList = new FormData(); fdlFilenameList.left = new FormAttachment(0, 0); fdlFilenameList.top = new FormAttachment(wExcludeFilemask, margin); fdlFilenameList.right = new FormAttachment(middle, -margin); wlFilenameList.setLayoutData(fdlFilenameList); // Buttons to the right of the screen... wbdFilename = new Button(wFileComp, SWT.PUSH | SWT.CENTER); props.setLook(wbdFilename); wbdFilename.setText( BaseMessages.getString(PKG, "GetFilesRowsCountDialog.FilenameRemove.Button")); wbdFilename.setToolTipText( BaseMessages.getString(PKG, "GetFilesRowsCountDialog.FilenameRemove.Tooltip")); fdbdFilename = new FormData(); fdbdFilename.right = new FormAttachment(100, 0); fdbdFilename.top = new FormAttachment(wExcludeFilemask, 40); wbdFilename.setLayoutData(fdbdFilename); wbeFilename = new Button(wFileComp, SWT.PUSH | SWT.CENTER); props.setLook(wbeFilename); wbeFilename.setText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.FilenameEdit.Button")); wbeFilename.setToolTipText( BaseMessages.getString(PKG, "GetFilesRowsCountDialog.FilenameEdit.Tooltip")); fdbeFilename = new FormData(); fdbeFilename.right = new FormAttachment(100, 0); fdbeFilename.top = new FormAttachment(wbdFilename, margin); wbeFilename.setLayoutData(fdbeFilename); wbShowFiles = new Button(wFileComp, SWT.PUSH | SWT.CENTER); props.setLook(wbShowFiles); wbShowFiles.setText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.ShowFiles.Button")); fdbShowFiles = new FormData(); fdbShowFiles.left = new FormAttachment(middle, 0); fdbShowFiles.bottom = new FormAttachment(100, 0); wbShowFiles.setLayoutData(fdbShowFiles); ColumnInfo[] colinfo = new ColumnInfo[5]; colinfo[0] = new ColumnInfo( BaseMessages.getString(PKG, "GetFilesRowsCountDialog.Files.Filename.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false); colinfo[1] = new ColumnInfo( BaseMessages.getString(PKG, "GetFilesRowsCountDialog.Files.Wildcard.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false); colinfo[2] = new ColumnInfo( BaseMessages.getString(PKG, "GetFilesRowsDialog.Files.ExcludeWildcard.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false); colinfo[3] = new ColumnInfo( BaseMessages.getString(PKG, "GetFilesRowsCountDialog.Required.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, GetFilesRowsCountMeta.RequiredFilesDesc); colinfo[4] = new ColumnInfo( BaseMessages.getString(PKG, "GetFilesRowsCountDialog.IncludeSubDirs.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, GetFilesRowsCountMeta.RequiredFilesDesc); colinfo[0].setUsingVariables(true); colinfo[1].setUsingVariables(true); colinfo[1].setToolTip( BaseMessages.getString(PKG, "GetFilesRowsCountDialog.Files.Wildcard.Tooltip")); colinfo[2].setUsingVariables(true); colinfo[2].setToolTip( BaseMessages.getString(PKG, "GetFilesRowsDialog.Files.ExcludeWildcard.Tooltip")); wFilenameList = new TableView( transMeta, wFileComp, SWT.FULL_SELECTION | SWT.SINGLE | SWT.BORDER, colinfo, 2, lsMod, props); props.setLook(wFilenameList); fdFilenameList = new FormData(); fdFilenameList.left = new FormAttachment(middle, 0); fdFilenameList.right = new FormAttachment(wbdFilename, -margin); fdFilenameList.top = new FormAttachment(wExcludeFilemask, margin); fdFilenameList.bottom = new FormAttachment(wbShowFiles, -margin); wFilenameList.setLayoutData(fdFilenameList); fdFileComp = new FormData(); fdFileComp.left = new FormAttachment(0, 0); fdFileComp.top = new FormAttachment(0, 0); fdFileComp.right = new FormAttachment(100, 0); fdFileComp.bottom = new FormAttachment(100, 0); wFileComp.setLayoutData(fdFileComp); wFileComp.layout(); wFileTab.setControl(wFileComp); // /////////////////////////////////////////////////////////// // / END OF FILE TAB // /////////////////////////////////////////////////////////// // //////////////////////// // START OF CONTENT TAB/// // / wContentTab = new CTabItem(wTabFolder, SWT.NONE); wContentTab.setText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.Content.Tab")); FormLayout contentLayout = new FormLayout(); contentLayout.marginWidth = 3; contentLayout.marginHeight = 3; wContentComp = new Composite(wTabFolder, SWT.NONE); props.setLook(wContentComp); wContentComp.setLayout(contentLayout); // ///////////////////////////////// // START OF Files Count Field GROUP // ///////////////////////////////// wFilesCountFieldGroup = new Group(wContentComp, SWT.SHADOW_NONE); props.setLook(wFilesCountFieldGroup); wFilesCountFieldGroup.setText( BaseMessages.getString(PKG, "GetFilesRowsCountDialog.Group.CountFilesFieldGroup.Label")); FormLayout countfilesfieldgroupLayout = new FormLayout(); countfilesfieldgroupLayout.marginWidth = 10; countfilesfieldgroupLayout.marginHeight = 10; wFilesCountFieldGroup.setLayout(countfilesfieldgroupLayout); wlRowsCountField = new Label(wFilesCountFieldGroup, SWT.RIGHT); wlRowsCountField.setText( BaseMessages.getString(PKG, "GetFilesRowsCountDialog.RowsCountField.Label")); props.setLook(wlRowsCountField); fdlRowsCountField = new FormData(); fdlRowsCountField.left = new FormAttachment(wInclFilesCount, margin); fdlRowsCountField.top = new FormAttachment(0, margin); wlRowsCountField.setLayoutData(fdlRowsCountField); wRowsCountField = new TextVar(transMeta, wFilesCountFieldGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wRowsCountField); wRowsCountField.setToolTipText( BaseMessages.getString(PKG, "GetFilesRowsCountDialog.RowsCountField.Tooltip")); wRowsCountField.addModifyListener(lsMod); fdRowsCountField = new FormData(); fdRowsCountField.left = new FormAttachment(wlRowsCountField, margin); fdRowsCountField.top = new FormAttachment(0, margin); fdRowsCountField.right = new FormAttachment(100, 0); wRowsCountField.setLayoutData(fdRowsCountField); fdFilesCountFieldGroup = new FormData(); fdFilesCountFieldGroup.left = new FormAttachment(0, margin); fdFilesCountFieldGroup.top = new FormAttachment(0, margin); fdFilesCountFieldGroup.right = new FormAttachment(100, -margin); wFilesCountFieldGroup.setLayoutData(fdFilesCountFieldGroup); // /////////////////////////////////////////////////////////// // / END OF ADDITIONNAL FIELDS GROUP // /////////////////////////////////////////////////////////// // ///////////////////////////////// // START OF Row separator GROUP // ///////////////////////////////// wRowSeparatorGroup = new Group(wContentComp, SWT.SHADOW_NONE); props.setLook(wRowSeparatorGroup); wRowSeparatorGroup.setText( BaseMessages.getString(PKG, "GetFilesRowsCountDialog.Group.RowSeparator.Label")); FormLayout rowseparatorgroupLayout = new FormLayout(); rowseparatorgroupLayout.marginWidth = 10; rowseparatorgroupLayout.marginHeight = 10; wRowSeparatorGroup.setLayout(rowseparatorgroupLayout); wlRowSeparatorFormat = new Label(wRowSeparatorGroup, SWT.RIGHT); wlRowSeparatorFormat.setText( BaseMessages.getString(PKG, "GetFilesRowsCountDialog.RowSeparatorFormat.Label")); props.setLook(wlRowSeparatorFormat); fdlRowSeparatorFormat = new FormData(); fdlRowSeparatorFormat.left = new FormAttachment(0, 0); fdlRowSeparatorFormat.top = new FormAttachment(wFilesCountFieldGroup, margin); fdlRowSeparatorFormat.right = new FormAttachment(middle, -margin); wlRowSeparatorFormat.setLayoutData(fdlRowSeparatorFormat); wRowSeparatorFormat = new CCombo(wRowSeparatorGroup, SWT.BORDER | SWT.READ_ONLY); props.setLook(wRowSeparatorFormat); wRowSeparatorFormat.add( BaseMessages.getString(PKG, "GetFilesRowsCountDialog.RowSeparatorFormat.CR.Label")); wRowSeparatorFormat.add( BaseMessages.getString(PKG, "GetFilesRowsCountDialog.RowSeparatorFormat.LF.Label")); wRowSeparatorFormat.add( BaseMessages.getString(PKG, "GetFilesRowsCountDialog.RowSeparatorFormat.CRLF.Label")); wRowSeparatorFormat.add( BaseMessages.getString(PKG, "GetFilesRowsCountDialog.RowSeparatorFormat.TAB.Label")); wRowSeparatorFormat.add( BaseMessages.getString(PKG, "GetFilesRowsCountDialog.RowSeparatorFormat.CUSTOM.Label")); wRowSeparatorFormat.select(0); wRowSeparatorFormat.addModifyListener(lsMod); fdRowSeparatorFormat = new FormData(); fdRowSeparatorFormat.left = new FormAttachment(middle, 0); fdRowSeparatorFormat.top = new FormAttachment(wFilesCountFieldGroup, margin); fdRowSeparatorFormat.right = new FormAttachment(100, 0); wRowSeparatorFormat.setLayoutData(fdRowSeparatorFormat); wRowSeparatorFormat.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { ActiveRowSeparator(); } }); wlRowSeparator = new Label(wRowSeparatorGroup, SWT.RIGHT); wlRowSeparator.setText( BaseMessages.getString(PKG, "GetFilesRowsCountDialog.RowSeparator.Label")); props.setLook(wlRowSeparator); fdlRowSeparator = new FormData(); fdlRowSeparator.left = new FormAttachment(wInclFilesCount, margin); fdlRowSeparator.top = new FormAttachment(wRowSeparatorFormat, margin); wlRowSeparator.setLayoutData(fdlRowSeparator); wRowSeparator = new TextVar(transMeta, wRowSeparatorGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wRowSeparator); wRowSeparator.setToolTipText( BaseMessages.getString(PKG, "GetFilesRowsCountDialog.RowSeparator.Tooltip")); wRowSeparator.addModifyListener(lsMod); fdRowSeparator = new FormData(); fdRowSeparator.left = new FormAttachment(wlRowSeparator, margin); fdRowSeparator.top = new FormAttachment(wRowSeparatorFormat, margin); fdRowSeparator.right = new FormAttachment(100, 0); wRowSeparator.setLayoutData(fdRowSeparator); wlSmartCount = new Label(wRowSeparatorGroup, SWT.RIGHT); wlSmartCount.setText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.SmartCount.Label")); props.setLook(wlSmartCount); fdlSmartCount = new FormData(); fdlSmartCount.left = new FormAttachment(0, 0); fdlSmartCount.top = new FormAttachment(wRowSeparator, margin); fdlSmartCount.right = new FormAttachment(middle, -margin); wlSmartCount.setLayoutData(fdlSmartCount); wSmartCount = new Button(wRowSeparatorGroup, SWT.CHECK); props.setLook(wSmartCount); wSmartCount.setToolTipText( BaseMessages.getString(PKG, "GetFilesRowsCountDialog.SmartCount.Tooltip")); fdSmartCount = new FormData(); fdSmartCount.left = new FormAttachment(middle, 0); fdSmartCount.top = new FormAttachment(wRowSeparator, margin); wSmartCount.setLayoutData(fdSmartCount); fdRowSeparatorGroup = new FormData(); fdRowSeparatorGroup.left = new FormAttachment(0, margin); fdRowSeparatorGroup.top = new FormAttachment(wFilesCountFieldGroup, margin); fdRowSeparatorGroup.right = new FormAttachment(100, -margin); wRowSeparatorGroup.setLayoutData(fdRowSeparatorGroup); // /////////////////////////////////////////////////////////// // / END OF ROW SEPARATOR GROUP // /////////////////////////////////////////////////////////// // ///////////////////////////////// // START OF Additional Fields GROUP // ///////////////////////////////// wAdditionalGroup = new Group(wContentComp, SWT.SHADOW_NONE); props.setLook(wAdditionalGroup); wAdditionalGroup.setText( BaseMessages.getString(PKG, "GetFilesRowsCountDialog.Group.AdditionalGroup.Label")); FormLayout additionalgroupLayout = new FormLayout(); additionalgroupLayout.marginWidth = 10; additionalgroupLayout.marginHeight = 10; wAdditionalGroup.setLayout(additionalgroupLayout); wlInclFilesCount = new Label(wAdditionalGroup, SWT.RIGHT); wlInclFilesCount.setText( BaseMessages.getString(PKG, "GetFilesRowsCountDialog.InclCountFiles.Label")); props.setLook(wlInclFilesCount); fdlInclFilesCount = new FormData(); fdlInclFilesCount.left = new FormAttachment(0, 0); fdlInclFilesCount.top = new FormAttachment(wRowSeparatorGroup, margin); fdlInclFilesCount.right = new FormAttachment(middle, -margin); wlInclFilesCount.setLayoutData(fdlInclFilesCount); wInclFilesCount = new Button(wAdditionalGroup, SWT.CHECK); props.setLook(wInclFilesCount); wInclFilesCount.setToolTipText( BaseMessages.getString(PKG, "GetFilesRowsCountDialog.InclCountFiles.Tooltip")); fdFilesCount = new FormData(); fdFilesCount.left = new FormAttachment(middle, 0); fdFilesCount.top = new FormAttachment(wRowSeparatorGroup, margin); wInclFilesCount.setLayoutData(fdFilesCount); wlInclFilesCountField = new Label(wAdditionalGroup, SWT.RIGHT); wlInclFilesCountField.setText( BaseMessages.getString(PKG, "GetFilesRowsCountDialog.InclCountFilesField.Label")); props.setLook(wlInclFilesCountField); fdlInclFilesCountField = new FormData(); fdlInclFilesCountField.left = new FormAttachment(wInclFilesCount, margin); fdlInclFilesCountField.top = new FormAttachment(wRowSeparatorGroup, margin); wlInclFilesCountField.setLayoutData(fdlInclFilesCountField); wInclFilesCountField = new TextVar(transMeta, wAdditionalGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wInclFilesCountField); wInclFilesCountField.addModifyListener(lsMod); fdInclFilesCountField = new FormData(); fdInclFilesCountField.left = new FormAttachment(wlInclFilesCountField, margin); fdInclFilesCountField.top = new FormAttachment(wRowSeparatorGroup, margin); fdInclFilesCountField.right = new FormAttachment(100, 0); wInclFilesCountField.setLayoutData(fdInclFilesCountField); fdAdditionalGroup = new FormData(); fdAdditionalGroup.left = new FormAttachment(0, margin); fdAdditionalGroup.top = new FormAttachment(wRowSeparatorGroup, margin); fdAdditionalGroup.right = new FormAttachment(100, -margin); wAdditionalGroup.setLayoutData(fdAdditionalGroup); // /////////////////////////////////////////////////////////// // / END OF ADDITIONNAL FIELDS GROUP // /////////////////////////////////////////////////////////// // /////////////////////////////// // START OF AddFileResult GROUP // // /////////////////////////////// wAddFileResult = new Group(wContentComp, SWT.SHADOW_NONE); props.setLook(wAddFileResult); wAddFileResult.setText( BaseMessages.getString(PKG, "GetFilesRowsCountDialog.wAddFileResult.Label")); FormLayout AddFileResultgroupLayout = new FormLayout(); AddFileResultgroupLayout.marginWidth = 10; AddFileResultgroupLayout.marginHeight = 10; wAddFileResult.setLayout(AddFileResultgroupLayout); wlAddResult = new Label(wAddFileResult, SWT.RIGHT); wlAddResult.setText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.AddResult.Label")); props.setLook(wlAddResult); fdlAddResult = new FormData(); fdlAddResult.left = new FormAttachment(0, 0); fdlAddResult.top = new FormAttachment(wAdditionalGroup, margin); fdlAddResult.right = new FormAttachment(middle, -margin); wlAddResult.setLayoutData(fdlAddResult); wAddResult = new Button(wAddFileResult, SWT.CHECK); props.setLook(wAddResult); wAddResult.setToolTipText( BaseMessages.getString(PKG, "GetFilesRowsCountDialog.AddResult.Tooltip")); fdAddResult = new FormData(); fdAddResult.left = new FormAttachment(middle, 0); fdAddResult.top = new FormAttachment(wAdditionalGroup, margin); wAddResult.setLayoutData(fdAddResult); fdAddFileResult = new FormData(); fdAddFileResult.left = new FormAttachment(0, margin); fdAddFileResult.top = new FormAttachment(wAdditionalGroup, margin); fdAddFileResult.right = new FormAttachment(100, -margin); wAddFileResult.setLayoutData(fdAddFileResult); // /////////////////////////////////////////////////////////// // / END OF AddFileResult GROUP // //////////////////////////////////// fdContentComp = new FormData(); fdContentComp.left = new FormAttachment(0, 0); fdContentComp.top = new FormAttachment(0, 0); fdContentComp.right = new FormAttachment(100, 0); fdContentComp.bottom = new FormAttachment(100, 0); wContentComp.setLayoutData(fdContentComp); wContentComp.layout(); wContentTab.setControl(wContentComp); // /////////////////////////////////////////////////////////// // / END OF CONTENT TAB // /////////////////////////////////////////////////////////// fdTabFolder = new FormData(); fdTabFolder.left = new FormAttachment(0, 0); fdTabFolder.top = new FormAttachment(wStepname, margin); fdTabFolder.right = new FormAttachment(100, 0); fdTabFolder.bottom = new FormAttachment(100, -50); wTabFolder.setLayoutData(fdTabFolder); wOK = new Button(shell, SWT.PUSH); wOK.setText(BaseMessages.getString(PKG, "System.Button.OK")); wPreview = new Button(shell, SWT.PUSH); wPreview.setText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.Button.PreviewRows")); wCancel = new Button(shell, SWT.PUSH); wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel")); setButtonPositions(new Button[] {wOK, wPreview, wCancel}, margin, wTabFolder); // Add listeners lsOK = new Listener() { public void handleEvent(Event e) { ok(); } }; lsPreview = new Listener() { public void handleEvent(Event e) { preview(); } }; lsCancel = new Listener() { public void handleEvent(Event e) { cancel(); } }; wOK.addListener(SWT.Selection, lsOK); wPreview.addListener(SWT.Selection, lsPreview); wCancel.addListener(SWT.Selection, lsCancel); lsDef = new SelectionAdapter() { public void widgetDefaultSelected(SelectionEvent e) { ok(); } }; wStepname.addSelectionListener(lsDef); wInclFilesCountField.addSelectionListener(lsDef); // Add the file to the list of files... SelectionAdapter selA = new SelectionAdapter() { public void widgetSelected(SelectionEvent arg0) { wFilenameList.add( new String[] { wFilename.getText(), wFilemask.getText(), wExcludeFilemask.getText(), GetFilesRowsCountMeta.RequiredFilesCode[0], GetFilesRowsCountMeta.RequiredFilesCode[0] }); wFilename.setText(""); wFilemask.setText(""); wExcludeFilemask.setText(""); wFilenameList.removeEmptyRows(); wFilenameList.setRowNums(); wFilenameList.optWidth(true); } }; wbaFilename.addSelectionListener(selA); wFilename.addSelectionListener(selA); // Delete files from the list of files... wbdFilename.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent arg0) { int[] idx = wFilenameList.getSelectionIndices(); wFilenameList.remove(idx); wFilenameList.removeEmptyRows(); wFilenameList.setRowNums(); } }); // Edit the selected file & remove from the list... wbeFilename.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent arg0) { int idx = wFilenameList.getSelectionIndex(); if (idx >= 0) { String[] string = wFilenameList.getItem(idx); wFilename.setText(string[0]); wFilemask.setText(string[1]); wExcludeFilemask.setText(string[2]); wFilenameList.remove(idx); } wFilenameList.removeEmptyRows(); wFilenameList.setRowNums(); } }); // Show the files that are selected at this time... wbShowFiles.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { try { GetFilesRowsCountMeta tfii = new GetFilesRowsCountMeta(); getInfo(tfii); FileInputList fileInputList = tfii.getFiles(transMeta); String[] files = fileInputList.getFileStrings(); if (files.length > 0) { EnterSelectionDialog esd = new EnterSelectionDialog( shell, files, BaseMessages.getString( PKG, "GetFilesRowsCountDialog.FilesReadSelection.DialogTitle"), BaseMessages.getString( PKG, "GetFilesRowsCountDialog.FilesReadSelection.DialogMessage")); esd.setViewOnly(); esd.open(); } else { MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR); mb.setMessage( BaseMessages.getString( PKG, "GetFilesRowsCountDialog.NoFileFound.DialogMessage")); mb.setText(BaseMessages.getString(PKG, "System.Dialog.Error.Title")); mb.open(); } } catch (KettleException ex) { new ErrorDialog( shell, BaseMessages.getString( PKG, "GetFilesRowsCountDialog.ErrorParsingData.DialogTitle"), BaseMessages.getString( PKG, "GetFilesRowsCountDialog.ErrorParsingData.DialogMessage"), ex); } } }); // Enable/disable the right fields to allow a row number to be added to each row... wInclFilesCount.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { setIncludeRownum(); } }); // Whenever something changes, set the tooltip to the expanded version of the filename: wFilename.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { wFilename.setToolTipText( ""); // StringUtil.environmentSubstitute( wFilename.getText() ) ); } }); // Listen to the Browse... button wbbFilename.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { if (!Const.isEmpty(wFilemask.getText()) || !Const.isEmpty(wExcludeFilemask.getText())) // A mask: a // directory! { DirectoryDialog dialog = new DirectoryDialog(shell, SWT.OPEN); if (wFilename.getText() != null) { String fpath = ""; // StringUtil.environmentSubstitute(wFilename.getText()); dialog.setFilterPath(fpath); } if (dialog.open() != null) { String str = dialog.getFilterPath(); wFilename.setText(str); } } else { FileDialog dialog = new FileDialog(shell, SWT.OPEN); dialog.setFilterExtensions(new String[] {"*"}); if (wFilename.getText() != null) { String fname = ""; // StringUtil.environmentSubstitute(wFilename.getText()); dialog.setFileName(fname); } dialog.setFilterNames( new String[] {BaseMessages.getString(PKG, "System.FileType.AllFiles")}); if (dialog.open() != null) { String str = dialog.getFilterPath() + System.getProperty("file.separator") + dialog.getFileName(); wFilename.setText(str); } } } }); // Detect X or ALT-F4 or something that kills this window... shell.addShellListener( new ShellAdapter() { public void shellClosed(ShellEvent e) { cancel(); } }); wTabFolder.setSelection(0); // Set the shell size, based upon previous time... setSize(); getData(input); ActiveFileField(); ActiveRowSeparator(); input.setChanged(changed); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } return stepname; }
public String open() { Shell parent = getParent(); Display display = parent.getDisplay(); shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN); props.setLook(shell); setShellImage(shell, input); ModifyListener lsMod = new ModifyListener() { public void modifyText(ModifyEvent e) { input.setChanged(); } }; SelectionListener lsSelection = new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { input.setChanged(); setComboBoxesLookup(); } }; changed = input.hasChanged(); FormLayout formLayout = new FormLayout(); formLayout.marginWidth = Const.FORM_MARGIN; formLayout.marginHeight = Const.FORM_MARGIN; shell.setLayout(formLayout); shell.setText(BaseMessages.getString(PKG, "FuzzyMatchDialog.Shell.Title")); int middle = props.getMiddlePct(); int margin = Const.MARGIN; // Stepname line wlStepname = new Label(shell, SWT.RIGHT); wlStepname.setText(BaseMessages.getString(PKG, "FuzzyMatchDialog.Stepname.Label")); props.setLook(wlStepname); fdlStepname = new FormData(); fdlStepname.left = new FormAttachment(0, 0); fdlStepname.right = new FormAttachment(middle, -margin); fdlStepname.top = new FormAttachment(0, margin); wlStepname.setLayoutData(fdlStepname); wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); wStepname.setText(stepname); props.setLook(wStepname); wStepname.addModifyListener(lsMod); fdStepname = new FormData(); fdStepname.left = new FormAttachment(middle, 0); fdStepname.top = new FormAttachment(0, margin); fdStepname.right = new FormAttachment(100, 0); wStepname.setLayoutData(fdStepname); wTabFolder = new CTabFolder(shell, SWT.BORDER); props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB); // //////////////////////// // START OF General TAB /// // //////////////////////// wGeneralTab = new CTabItem(wTabFolder, SWT.NONE); wGeneralTab.setText(BaseMessages.getString(PKG, "FuzzyMatchDialog.General.Tab")); wGeneralComp = new Composite(wTabFolder, SWT.NONE); props.setLook(wGeneralComp); FormLayout GeneralLayout = new FormLayout(); GeneralLayout.marginWidth = 3; GeneralLayout.marginHeight = 3; wGeneralComp.setLayout(GeneralLayout); // ///////////////////////////////// // START OF Lookup Fields GROUP // ///////////////////////////////// wLookupGroup = new Group(wGeneralComp, SWT.SHADOW_NONE); props.setLook(wLookupGroup); wLookupGroup.setText(BaseMessages.getString(PKG, "FuzzyMatchDialog.Group.Lookup.Label")); FormLayout LookupgroupLayout = new FormLayout(); LookupgroupLayout.marginWidth = 10; LookupgroupLayout.marginHeight = 10; wLookupGroup.setLayout(LookupgroupLayout); // Source step line... wlStep = new Label(wLookupGroup, SWT.RIGHT); wlStep.setText(BaseMessages.getString(PKG, "FuzzyMatchDialog.SourceStep.Label")); props.setLook(wlStep); fdlStep = new FormData(); fdlStep.left = new FormAttachment(0, 0); fdlStep.right = new FormAttachment(middle, -margin); fdlStep.top = new FormAttachment(wStepname, margin); wlStep.setLayoutData(fdlStep); wStep = new CCombo(wLookupGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wStep); List<StepMeta> steps = transMeta.findPreviousSteps(transMeta.findStep(stepname), true); for (StepMeta stepMeta : steps) { wStep.add(stepMeta.getName()); } wStep.addModifyListener(lsMod); wStep.addSelectionListener(lsSelection); fdStep = new FormData(); fdStep.left = new FormAttachment(middle, 0); fdStep.top = new FormAttachment(wStepname, margin); fdStep.right = new FormAttachment(100, 0); wStep.setLayoutData(fdStep); // LookupField wlLookupField = new Label(wLookupGroup, SWT.RIGHT); wlLookupField.setText(BaseMessages.getString(PKG, "FuzzyMatchDialog.wlLookupField.Label")); props.setLook(wlLookupField); fdlLookupField = new FormData(); fdlLookupField.left = new FormAttachment(0, 0); fdlLookupField.top = new FormAttachment(wStep, margin); fdlLookupField.right = new FormAttachment(middle, -2 * margin); wlLookupField.setLayoutData(fdlLookupField); wLookupField = new ComboVar(transMeta, wLookupGroup, SWT.BORDER | SWT.READ_ONLY); wLookupField.setEditable(true); props.setLook(wLookupField); wLookupField.addModifyListener(lsMod); fdLookupField = new FormData(); fdLookupField.left = new FormAttachment(middle, 0); fdLookupField.top = new FormAttachment(wStep, margin); fdLookupField.right = new FormAttachment(100, -margin); wLookupField.setLayoutData(fdLookupField); wLookupField.addFocusListener( new FocusListener() { public void focusLost(org.eclipse.swt.events.FocusEvent e) {} public void focusGained(org.eclipse.swt.events.FocusEvent e) { setLookupField(); } }); fdLookupGroup = new FormData(); fdLookupGroup.left = new FormAttachment(0, margin); fdLookupGroup.top = new FormAttachment(wStepname, margin); fdLookupGroup.right = new FormAttachment(100, -margin); wLookupGroup.setLayoutData(fdLookupGroup); // /////////////////////////////////////////////////////////// // / END OF Lookup GROUP // /////////////////////////////////////////////////////////// // ///////////////////////////////// // START OF MainStream Fields GROUP // ///////////////////////////////// wMainStreamGroup = new Group(wGeneralComp, SWT.SHADOW_NONE); props.setLook(wMainStreamGroup); wMainStreamGroup.setText( BaseMessages.getString(PKG, "FuzzyMatchDialog.Group.MainStreamGroup.Label")); FormLayout MainStreamgroupLayout = new FormLayout(); MainStreamgroupLayout.marginWidth = 10; MainStreamgroupLayout.marginHeight = 10; wMainStreamGroup.setLayout(MainStreamgroupLayout); // MainStreamFieldname field wlMainStreamField = new Label(wMainStreamGroup, SWT.RIGHT); wlMainStreamField.setText( BaseMessages.getString(PKG, "FuzzyMatchDialog.wlMainStreamField.Label")); props.setLook(wlMainStreamField); fdlMainStreamField = new FormData(); fdlMainStreamField.left = new FormAttachment(0, 0); fdlMainStreamField.top = new FormAttachment(wLookupGroup, margin); fdlMainStreamField.right = new FormAttachment(middle, -2 * margin); wlMainStreamField.setLayoutData(fdlMainStreamField); wMainStreamField = new ComboVar(transMeta, wMainStreamGroup, SWT.BORDER | SWT.READ_ONLY); wMainStreamField.setEditable(true); props.setLook(wMainStreamField); wMainStreamField.addModifyListener(lsMod); fdMainStreamField = new FormData(); fdMainStreamField.left = new FormAttachment(middle, 0); fdMainStreamField.top = new FormAttachment(wLookupGroup, margin); fdMainStreamField.right = new FormAttachment(100, -margin); wMainStreamField.setLayoutData(fdMainStreamField); wMainStreamField.addFocusListener( new FocusListener() { public void focusLost(org.eclipse.swt.events.FocusEvent e) {} public void focusGained(org.eclipse.swt.events.FocusEvent e) { setMainStreamField(); } }); fdMainStreamGroup = new FormData(); fdMainStreamGroup.left = new FormAttachment(0, margin); fdMainStreamGroup.top = new FormAttachment(wLookupGroup, margin); fdMainStreamGroup.right = new FormAttachment(100, -margin); wMainStreamGroup.setLayoutData(fdMainStreamGroup); // /////////////////////////////////////////////////////////// // / END OF MainStream GROUP // /////////////////////////////////////////////////////////// // ///////////////////////////////// // START OF Settings Fields GROUP // ///////////////////////////////// wSettingsGroup = new Group(wGeneralComp, SWT.SHADOW_NONE); props.setLook(wSettingsGroup); wSettingsGroup.setText( BaseMessages.getString(PKG, "FuzzyMatchDialog.Group.SettingsGroup.Label")); FormLayout SettingsgroupLayout = new FormLayout(); SettingsgroupLayout.marginWidth = 10; SettingsgroupLayout.marginHeight = 10; wSettingsGroup.setLayout(SettingsgroupLayout); // Algorithm wlAlgorithm = new Label(wSettingsGroup, SWT.RIGHT); wlAlgorithm.setText(BaseMessages.getString(PKG, "FuzzyMatchDialog.Algorithm.Label")); props.setLook(wlAlgorithm); fdlAlgorithm = new FormData(); fdlAlgorithm.left = new FormAttachment(0, 0); fdlAlgorithm.right = new FormAttachment(middle, -margin); fdlAlgorithm.top = new FormAttachment(wMainStreamGroup, margin); wlAlgorithm.setLayoutData(fdlAlgorithm); wAlgorithm = new CCombo(wSettingsGroup, SWT.BORDER | SWT.READ_ONLY); props.setLook(wAlgorithm); wAlgorithm.addModifyListener(lsMod); fdAlgorithm = new FormData(); fdAlgorithm.left = new FormAttachment(middle, 0); fdAlgorithm.top = new FormAttachment(wMainStreamGroup, margin); fdAlgorithm.right = new FormAttachment(100, -margin); wAlgorithm.setLayoutData(fdAlgorithm); wAlgorithm.setItems(FuzzyMatchMeta.algorithmDesc); wAlgorithm.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { activeAlgorithm(); } }); // Is case sensitive wlcaseSensitive = new Label(wSettingsGroup, SWT.RIGHT); wlcaseSensitive.setText(BaseMessages.getString(PKG, "FuzzyMatchDialog.caseSensitive.Label")); props.setLook(wlcaseSensitive); fdlcaseSensitive = new FormData(); fdlcaseSensitive.left = new FormAttachment(0, 0); fdlcaseSensitive.top = new FormAttachment(wAlgorithm, margin); fdlcaseSensitive.right = new FormAttachment(middle, -2 * margin); wlcaseSensitive.setLayoutData(fdlcaseSensitive); wcaseSensitive = new Button(wSettingsGroup, SWT.CHECK); props.setLook(wcaseSensitive); wcaseSensitive.setToolTipText( BaseMessages.getString(PKG, "FuzzyMatchDialog.caseSensitive.Tooltip")); fdcaseSensitive = new FormData(); fdcaseSensitive.left = new FormAttachment(middle, 0); fdcaseSensitive.top = new FormAttachment(wAlgorithm, margin); wcaseSensitive.setLayoutData(fdcaseSensitive); SelectionAdapter lcaseSensitive = new SelectionAdapter() { public void widgetSelected(SelectionEvent arg0) { input.setChanged(); } }; wcaseSensitive.addSelectionListener(lcaseSensitive); // Is get closer value wlgetCloserValue = new Label(wSettingsGroup, SWT.RIGHT); wlgetCloserValue.setText(BaseMessages.getString(PKG, "FuzzyMatchDialog.getCloserValue.Label")); props.setLook(wlgetCloserValue); fdlgetCloserValue = new FormData(); fdlgetCloserValue.left = new FormAttachment(0, 0); fdlgetCloserValue.top = new FormAttachment(wcaseSensitive, margin); fdlgetCloserValue.right = new FormAttachment(middle, -2 * margin); wlgetCloserValue.setLayoutData(fdlgetCloserValue); wgetCloserValue = new Button(wSettingsGroup, SWT.CHECK); props.setLook(wgetCloserValue); wgetCloserValue.setToolTipText( BaseMessages.getString(PKG, "FuzzyMatchDialog.getCloserValue.Tooltip")); fdgetCloserValue = new FormData(); fdgetCloserValue.left = new FormAttachment(middle, 0); fdgetCloserValue.top = new FormAttachment(wcaseSensitive, margin); wgetCloserValue.setLayoutData(fdgetCloserValue); SelectionAdapter lgetCloserValue = new SelectionAdapter() { public void widgetSelected(SelectionEvent arg0) { activegetCloserValue(); input.setChanged(); } }; wgetCloserValue.addSelectionListener(lgetCloserValue); wlminValue = new Label(wSettingsGroup, SWT.RIGHT); wlminValue.setText(BaseMessages.getString(PKG, "FuzzyMatchDialog.minValue.Label")); props.setLook(wlminValue); fdlminValue = new FormData(); fdlminValue.left = new FormAttachment(0, 0); fdlminValue.top = new FormAttachment(wgetCloserValue, margin); fdlminValue.right = new FormAttachment(middle, -margin); wlminValue.setLayoutData(fdlminValue); wminValue = new TextVar(transMeta, wSettingsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wminValue); wminValue.setToolTipText(BaseMessages.getString(PKG, "FuzzyMatchDialog.minValue.Tooltip")); wminValue.addModifyListener(lsMod); fdminValue = new FormData(); fdminValue.left = new FormAttachment(middle, 0); fdminValue.top = new FormAttachment(wgetCloserValue, margin); fdminValue.right = new FormAttachment(100, 0); wminValue.setLayoutData(fdminValue); wlmaxValue = new Label(wSettingsGroup, SWT.RIGHT); wlmaxValue.setText(BaseMessages.getString(PKG, "FuzzyMatchDialog.maxValue.Label")); props.setLook(wlmaxValue); fdlmaxValue = new FormData(); fdlmaxValue.left = new FormAttachment(0, 0); fdlmaxValue.top = new FormAttachment(wminValue, margin); fdlmaxValue.right = new FormAttachment(middle, -margin); wlmaxValue.setLayoutData(fdlmaxValue); wmaxValue = new TextVar(transMeta, wSettingsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wmaxValue); wmaxValue.setToolTipText(BaseMessages.getString(PKG, "FuzzyMatchDialog.maxValue.Tooltip")); wmaxValue.addModifyListener(lsMod); fdmaxValue = new FormData(); fdmaxValue.left = new FormAttachment(middle, 0); fdmaxValue.top = new FormAttachment(wminValue, margin); fdmaxValue.right = new FormAttachment(100, 0); wmaxValue.setLayoutData(fdmaxValue); wlseparator = new Label(wSettingsGroup, SWT.RIGHT); wlseparator.setText(BaseMessages.getString(PKG, "FuzzyMatchDialog.separator.Label")); props.setLook(wlseparator); fdlseparator = new FormData(); fdlseparator.left = new FormAttachment(0, 0); fdlseparator.top = new FormAttachment(wmaxValue, margin); fdlseparator.right = new FormAttachment(middle, -margin); wlseparator.setLayoutData(fdlseparator); wseparator = new TextVar(transMeta, wSettingsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wseparator); wseparator.addModifyListener(lsMod); fdseparator = new FormData(); fdseparator.left = new FormAttachment(middle, 0); fdseparator.top = new FormAttachment(wmaxValue, margin); fdseparator.right = new FormAttachment(100, 0); wseparator.setLayoutData(fdseparator); fdSettingsGroup = new FormData(); fdSettingsGroup.left = new FormAttachment(0, margin); fdSettingsGroup.top = new FormAttachment(wMainStreamGroup, margin); fdSettingsGroup.right = new FormAttachment(100, -margin); wSettingsGroup.setLayoutData(fdSettingsGroup); // /////////////////////////////////////////////////////////// // / END OF Settings GROUP // /////////////////////////////////////////////////////////// fdGeneralComp = new FormData(); fdGeneralComp.left = new FormAttachment(0, 0); fdGeneralComp.top = new FormAttachment(0, 0); fdGeneralComp.right = new FormAttachment(100, 0); fdGeneralComp.bottom = new FormAttachment(100, 0); wGeneralComp.setLayoutData(fdGeneralComp); wGeneralComp.layout(); wGeneralTab.setControl(wGeneralComp); // /////////////////////////////////////////////////////////// // / END OF General TAB // /////////////////////////////////////////////////////////// // THE BUTTONS wOK = new Button(shell, SWT.PUSH); wOK.setText(BaseMessages.getString(PKG, "System.Button.OK")); wCancel = new Button(shell, SWT.PUSH); wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel")); setButtonPositions(new Button[] {wOK, wCancel}, margin, null); // //////////////////////// // START OF Fields TAB /// // //////////////////////// wFieldsTab = new CTabItem(wTabFolder, SWT.NONE); wFieldsTab.setText(BaseMessages.getString(PKG, "FuzzyMatchDialog.Fields.Tab")); wFieldsComp = new Composite(wTabFolder, SWT.NONE); props.setLook(wFieldsComp); FormLayout FieldsLayout = new FormLayout(); FieldsLayout.marginWidth = 3; FieldsLayout.marginHeight = 3; wFieldsComp.setLayout(FieldsLayout); // ///////////////////////////////// // START OF OutputFields Fields GROUP // ///////////////////////////////// wOutputFieldsGroup = new Group(wFieldsComp, SWT.SHADOW_NONE); props.setLook(wOutputFieldsGroup); wOutputFieldsGroup.setText( BaseMessages.getString(PKG, "FuzzyMatchDialog.Group.OutputFieldsGroup.Label")); FormLayout OutputFieldsgroupLayout = new FormLayout(); OutputFieldsgroupLayout.marginWidth = 10; OutputFieldsgroupLayout.marginHeight = 10; wOutputFieldsGroup.setLayout(OutputFieldsgroupLayout); wlmatchField = new Label(wOutputFieldsGroup, SWT.RIGHT); wlmatchField.setText(BaseMessages.getString(PKG, "FuzzyMatchDialog.MatchField.Label")); props.setLook(wlmatchField); fdlmatchField = new FormData(); fdlmatchField.left = new FormAttachment(0, 0); fdlmatchField.top = new FormAttachment(wSettingsGroup, margin); fdlmatchField.right = new FormAttachment(middle, -margin); wlmatchField.setLayoutData(fdlmatchField); wmatchField = new TextVar(transMeta, wOutputFieldsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wmatchField); wmatchField.addModifyListener(lsMod); fdmatchField = new FormData(); fdmatchField.left = new FormAttachment(middle, 0); fdmatchField.top = new FormAttachment(wSettingsGroup, margin); fdmatchField.right = new FormAttachment(100, 0); wmatchField.setLayoutData(fdmatchField); wlvalueField = new Label(wOutputFieldsGroup, SWT.RIGHT); wlvalueField.setText(BaseMessages.getString(PKG, "FuzzyMatchDialog.valueField.Label")); props.setLook(wlvalueField); fdlvalueField = new FormData(); fdlvalueField.left = new FormAttachment(0, 0); fdlvalueField.top = new FormAttachment(wmatchField, margin); fdlvalueField.right = new FormAttachment(middle, -margin); wlvalueField.setLayoutData(fdlvalueField); wvalueField = new TextVar(transMeta, wOutputFieldsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wvalueField); wvalueField.setToolTipText(BaseMessages.getString(PKG, "FuzzyMatchDialog.valueField.Tooltip")); wvalueField.addModifyListener(lsMod); fdvalueField = new FormData(); fdvalueField.left = new FormAttachment(middle, 0); fdvalueField.top = new FormAttachment(wmatchField, margin); fdvalueField.right = new FormAttachment(100, 0); wvalueField.setLayoutData(fdvalueField); fdOutputFieldsGroup = new FormData(); fdOutputFieldsGroup.left = new FormAttachment(0, margin); fdOutputFieldsGroup.top = new FormAttachment(wSettingsGroup, margin); fdOutputFieldsGroup.right = new FormAttachment(100, -margin); wOutputFieldsGroup.setLayoutData(fdOutputFieldsGroup); // /////////////////////////////////////////////////////////// // / END OF OutputFields GROUP // /////////////////////////////////////////////////////////// // THE UPDATE/INSERT TABLE wlReturn = new Label(wFieldsComp, SWT.NONE); wlReturn.setText(BaseMessages.getString(PKG, "FuzzyMatchDialog.ReturnFields.Label")); props.setLook(wlReturn); fdlReturn = new FormData(); fdlReturn.left = new FormAttachment(0, 0); fdlReturn.top = new FormAttachment(wOutputFieldsGroup, margin); wlReturn.setLayoutData(fdlReturn); wGetLU = new Button(wFieldsComp, SWT.PUSH); wGetLU.setText(BaseMessages.getString(PKG, "FuzzyMatchDialog.GetLookupFields.Button")); FormData fdlu = new FormData(); fdlu.top = new FormAttachment(wlReturn, margin); fdlu.right = new FormAttachment(100, 0); wGetLU.setLayoutData(fdlu); int UpInsCols = 2; int UpInsRows = (input.getValue() != null ? input.getValue().length : 1); ciReturn = new ColumnInfo[UpInsCols]; ciReturn[0] = new ColumnInfo( BaseMessages.getString(PKG, "FuzzyMatchDialog.ColumnInfo.FieldReturn"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] {""}, false); ciReturn[1] = new ColumnInfo( BaseMessages.getString(PKG, "FuzzyMatchDialog.ColumnInfo.NewName"), ColumnInfo.COLUMN_TYPE_TEXT, false); wReturn = new TableView( transMeta, wFieldsComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL, ciReturn, UpInsRows, lsMod, props); fdReturn = new FormData(); fdReturn.left = new FormAttachment(0, 0); fdReturn.top = new FormAttachment(wlReturn, margin); fdReturn.right = new FormAttachment(wGetLU, -margin); fdReturn.bottom = new FormAttachment(100, -3 * margin); wReturn.setLayoutData(fdReturn); fdFieldsComp = new FormData(); fdFieldsComp.left = new FormAttachment(0, 0); fdFieldsComp.top = new FormAttachment(0, 0); fdFieldsComp.right = new FormAttachment(100, 0); fdFieldsComp.bottom = new FormAttachment(100, 0); wFieldsComp.setLayoutData(fdFieldsComp); wFieldsComp.layout(); wFieldsTab.setControl(wFieldsComp); // /////////////////////////////////////////////////////////// // / END OF Fields TAB // /////////////////////////////////////////////////////////// fdTabFolder = new FormData(); fdTabFolder.left = new FormAttachment(0, 0); fdTabFolder.top = new FormAttachment(wStepname, margin); fdTabFolder.right = new FormAttachment(100, 0); fdTabFolder.bottom = new FormAttachment(wOK, -margin); wTabFolder.setLayoutData(fdTabFolder); // Add listeners lsOK = new Listener() { public void handleEvent(Event e) { ok(); } }; lsCancel = new Listener() { public void handleEvent(Event e) { cancel(); } }; lsGetLU = new Listener() { public void handleEvent(Event e) { getlookup(); } }; wOK.addListener(SWT.Selection, lsOK); wCancel.addListener(SWT.Selection, lsCancel); wGetLU.addListener(SWT.Selection, lsGetLU); lsDef = new SelectionAdapter() { public void widgetDefaultSelected(SelectionEvent e) { ok(); } }; wStepname.addSelectionListener(lsDef); // Detect X or ALT-F4 or something that kills this window... shell.addShellListener( new ShellAdapter() { public void shellClosed(ShellEvent e) { cancel(); } }); wTabFolder.setSelection(0); // Set the shell size, based upon previous time... setSize(); getData(); setComboBoxesLookup(); activeAlgorithm(); activegetCloserValue(); input.setChanged(changed); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } return stepname; }
public JobEntryInterface open() { Shell parent = getParent(); Display display = parent.getDisplay(); shell = new Shell(parent, props.getJobsDialogStyle()); props.setLook(shell); JobDialog.setShellImage(shell, jobEntry); ModifyListener lsMod = new ModifyListener() { public void modifyText(ModifyEvent e) { jobEntry.setChanged(); } }; changed = jobEntry.hasChanged(); FormLayout formLayout = new FormLayout(); formLayout.marginWidth = Const.FORM_MARGIN; formLayout.marginHeight = Const.FORM_MARGIN; shell.setLayout(formLayout); shell.setText(Messages.getString("JobXMLWellFormed.Title")); int middle = props.getMiddlePct(); int margin = Const.MARGIN; // Filename line wlName = new Label(shell, SWT.RIGHT); wlName.setText(Messages.getString("JobXMLWellFormed.Name.Label")); props.setLook(wlName); fdlName = new FormData(); fdlName.left = new FormAttachment(0, 0); fdlName.right = new FormAttachment(middle, -margin); fdlName.top = new FormAttachment(0, margin); wlName.setLayoutData(fdlName); wName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wName); wName.addModifyListener(lsMod); fdName = new FormData(); fdName.left = new FormAttachment(middle, 0); fdName.top = new FormAttachment(0, margin); fdName.right = new FormAttachment(100, 0); wName.setLayoutData(fdName); wTabFolder = new CTabFolder(shell, SWT.BORDER); props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB); ////////////////////////// // START OF GENERAL TAB /// ////////////////////////// wGeneralTab = new CTabItem(wTabFolder, SWT.NONE); wGeneralTab.setText(Messages.getString("JobXMLWellFormed.Tab.General.Label")); wGeneralComp = new Composite(wTabFolder, SWT.NONE); props.setLook(wGeneralComp); FormLayout generalLayout = new FormLayout(); generalLayout.marginWidth = 3; generalLayout.marginHeight = 3; wGeneralComp.setLayout(generalLayout); // SETTINGS grouping? // //////////////////////// // START OF SETTINGS GROUP // wSettings = new Group(wGeneralComp, SWT.SHADOW_NONE); props.setLook(wSettings); wSettings.setText(Messages.getString("JobXMLWellFormed.Settings.Label")); FormLayout groupLayout = new FormLayout(); groupLayout.marginWidth = 10; groupLayout.marginHeight = 10; wSettings.setLayout(groupLayout); wlIncludeSubfolders = new Label(wSettings, SWT.RIGHT); wlIncludeSubfolders.setText(Messages.getString("JobXMLWellFormed.IncludeSubfolders.Label")); props.setLook(wlIncludeSubfolders); fdlIncludeSubfolders = new FormData(); fdlIncludeSubfolders.left = new FormAttachment(0, 0); fdlIncludeSubfolders.top = new FormAttachment(wName, margin); fdlIncludeSubfolders.right = new FormAttachment(middle, -margin); wlIncludeSubfolders.setLayoutData(fdlIncludeSubfolders); wIncludeSubfolders = new Button(wSettings, SWT.CHECK); props.setLook(wIncludeSubfolders); wIncludeSubfolders.setToolTipText( Messages.getString("JobXMLWellFormed.IncludeSubfolders.Tooltip")); fdIncludeSubfolders = new FormData(); fdIncludeSubfolders.left = new FormAttachment(middle, 0); fdIncludeSubfolders.top = new FormAttachment(wName, margin); fdIncludeSubfolders.right = new FormAttachment(100, 0); wIncludeSubfolders.setLayoutData(fdIncludeSubfolders); wIncludeSubfolders.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { jobEntry.setChanged(); } }); // previous wlPrevious = new Label(wSettings, SWT.RIGHT); wlPrevious.setText(Messages.getString("JobXMLWellFormed.Previous.Label")); props.setLook(wlPrevious); fdlPrevious = new FormData(); fdlPrevious.left = new FormAttachment(0, 0); fdlPrevious.top = new FormAttachment(wIncludeSubfolders, margin); fdlPrevious.right = new FormAttachment(middle, -margin); wlPrevious.setLayoutData(fdlPrevious); wPrevious = new Button(wSettings, SWT.CHECK); props.setLook(wPrevious); wPrevious.setSelection(jobEntry.arg_from_previous); wPrevious.setToolTipText(Messages.getString("JobXMLWellFormed.Previous.Tooltip")); fdPrevious = new FormData(); fdPrevious.left = new FormAttachment(middle, 0); fdPrevious.top = new FormAttachment(wIncludeSubfolders, margin); fdPrevious.right = new FormAttachment(100, 0); wPrevious.setLayoutData(fdPrevious); wPrevious.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { RefreshArgFromPrevious(); } }); fdSettings = new FormData(); fdSettings.left = new FormAttachment(0, margin); fdSettings.top = new FormAttachment(wName, margin); fdSettings.right = new FormAttachment(100, -margin); wSettings.setLayoutData(fdSettings); // /////////////////////////////////////////////////////////// // / END OF SETTINGS GROUP // /////////////////////////////////////////////////////////// // SourceFileFolder line wlSourceFileFolder = new Label(wGeneralComp, SWT.RIGHT); wlSourceFileFolder.setText(Messages.getString("JobXMLWellFormed.SourceFileFolder.Label")); props.setLook(wlSourceFileFolder); fdlSourceFileFolder = new FormData(); fdlSourceFileFolder.left = new FormAttachment(0, 0); fdlSourceFileFolder.top = new FormAttachment(wSettings, 2 * margin); fdlSourceFileFolder.right = new FormAttachment(middle, -margin); wlSourceFileFolder.setLayoutData(fdlSourceFileFolder); // Browse Source folders button ... wbSourceDirectory = new Button(wGeneralComp, SWT.PUSH | SWT.CENTER); props.setLook(wbSourceDirectory); wbSourceDirectory.setText(Messages.getString("JobXMLWellFormed.BrowseFolders.Label")); fdbSourceDirectory = new FormData(); fdbSourceDirectory.right = new FormAttachment(100, 0); fdbSourceDirectory.top = new FormAttachment(wSettings, margin); wbSourceDirectory.setLayoutData(fdbSourceDirectory); wbSourceDirectory.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { DirectoryDialog ddialog = new DirectoryDialog(shell, SWT.OPEN); if (wSourceFileFolder.getText() != null) { ddialog.setFilterPath(jobMeta.environmentSubstitute(wSourceFileFolder.getText())); } // Calling open() will open and run the dialog. // It will return the selected directory, or // null if user cancels String dir = ddialog.open(); if (dir != null) { // Set the text box to the new selection wSourceFileFolder.setText(dir); } } }); // Browse Source files button ... wbSourceFileFolder = new Button(wGeneralComp, SWT.PUSH | SWT.CENTER); props.setLook(wbSourceFileFolder); wbSourceFileFolder.setText(Messages.getString("JobXMLWellFormed.BrowseFiles.Label")); fdbSourceFileFolder = new FormData(); fdbSourceFileFolder.right = new FormAttachment(wbSourceDirectory, -margin); fdbSourceFileFolder.top = new FormAttachment(wSettings, margin); wbSourceFileFolder.setLayoutData(fdbSourceFileFolder); // Browse Destination file add button ... wbaSourceFileFolder = new Button(wGeneralComp, SWT.PUSH | SWT.CENTER); props.setLook(wbaSourceFileFolder); wbaSourceFileFolder.setText(Messages.getString("JobXMLWellFormed.FilenameAdd.Button")); fdbaSourceFileFolder = new FormData(); fdbaSourceFileFolder.right = new FormAttachment(wbSourceFileFolder, -margin); fdbaSourceFileFolder.top = new FormAttachment(wSettings, margin); wbaSourceFileFolder.setLayoutData(fdbaSourceFileFolder); wSourceFileFolder = new TextVar(jobMeta, wGeneralComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER); wSourceFileFolder.setToolTipText( Messages.getString("JobXMLWellFormed.SourceFileFolder.Tooltip")); props.setLook(wSourceFileFolder); wSourceFileFolder.addModifyListener(lsMod); fdSourceFileFolder = new FormData(); fdSourceFileFolder.left = new FormAttachment(middle, 0); fdSourceFileFolder.top = new FormAttachment(wSettings, 2 * margin); fdSourceFileFolder.right = new FormAttachment(wbSourceFileFolder, -55); wSourceFileFolder.setLayoutData(fdSourceFileFolder); // Whenever something changes, set the tooltip to the expanded version: wSourceFileFolder.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { wSourceFileFolder.setToolTipText( jobMeta.environmentSubstitute(wSourceFileFolder.getText())); } }); wbSourceFileFolder.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { FileDialog dialog = new FileDialog(shell, SWT.OPEN); dialog.setFilterExtensions(new String[] {"*.xml;*.XML", "*"}); if (wSourceFileFolder.getText() != null) { dialog.setFileName(jobMeta.environmentSubstitute(wSourceFileFolder.getText())); } dialog.setFilterNames(FILETYPES); if (dialog.open() != null) { wSourceFileFolder.setText( dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName()); } } }); // Buttons to the right of the screen... wbdSourceFileFolder = new Button(wGeneralComp, SWT.PUSH | SWT.CENTER); props.setLook(wbdSourceFileFolder); wbdSourceFileFolder.setText(Messages.getString("JobXMLWellFormed.FilenameDelete.Button")); wbdSourceFileFolder.setToolTipText( Messages.getString("JobXMLWellFormed.FilenameDelete.Tooltip")); fdbdSourceFileFolder = new FormData(); fdbdSourceFileFolder.right = new FormAttachment(100, 0); fdbdSourceFileFolder.top = new FormAttachment(wSourceFileFolder, 40); wbdSourceFileFolder.setLayoutData(fdbdSourceFileFolder); wbeSourceFileFolder = new Button(wGeneralComp, SWT.PUSH | SWT.CENTER); props.setLook(wbeSourceFileFolder); wbeSourceFileFolder.setText(Messages.getString("JobXMLWellFormed.FilenameEdit.Button")); wbeSourceFileFolder.setToolTipText(Messages.getString("JobXMLWellFormed.FilenameEdit.Tooltip")); fdbeSourceFileFolder = new FormData(); fdbeSourceFileFolder.right = new FormAttachment(100, 0); fdbeSourceFileFolder.left = new FormAttachment(wbdSourceFileFolder, 0, SWT.LEFT); fdbeSourceFileFolder.top = new FormAttachment(wbdSourceFileFolder, margin); wbeSourceFileFolder.setLayoutData(fdbeSourceFileFolder); // Wildcard wlWildcard = new Label(wGeneralComp, SWT.RIGHT); wlWildcard.setText(Messages.getString("JobXMLWellFormed.Wildcard.Label")); props.setLook(wlWildcard); fdlWildcard = new FormData(); fdlWildcard.left = new FormAttachment(0, 0); fdlWildcard.top = new FormAttachment(wSourceFileFolder, margin); fdlWildcard.right = new FormAttachment(middle, -margin); wlWildcard.setLayoutData(fdlWildcard); wWildcard = new TextVar(jobMeta, wGeneralComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER); wWildcard.setToolTipText(Messages.getString("JobXMLWellFormed.Wildcard.Tooltip")); props.setLook(wWildcard); wWildcard.addModifyListener(lsMod); fdWildcard = new FormData(); fdWildcard.left = new FormAttachment(middle, 0); fdWildcard.top = new FormAttachment(wSourceFileFolder, margin); fdWildcard.right = new FormAttachment(wbSourceFileFolder, -55); wWildcard.setLayoutData(fdWildcard); wlFields = new Label(wGeneralComp, SWT.NONE); wlFields.setText(Messages.getString("JobXMLWellFormed.Fields.Label")); props.setLook(wlFields); fdlFields = new FormData(); fdlFields.left = new FormAttachment(0, 0); fdlFields.right = new FormAttachment(middle, -margin); fdlFields.top = new FormAttachment(wWildcard, margin); wlFields.setLayoutData(fdlFields); int rows = jobEntry.source_filefolder == null ? 1 : (jobEntry.source_filefolder.length == 0 ? 0 : jobEntry.source_filefolder.length); final int FieldsRows = rows; ColumnInfo[] colinf = new ColumnInfo[] { new ColumnInfo( Messages.getString("JobXMLWellFormed.Fields.SourceFileFolder.Label"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo( Messages.getString("JobXMLWellFormed.Fields.Wildcard.Label"), ColumnInfo.COLUMN_TYPE_TEXT, false), }; colinf[0].setUsingVariables(true); colinf[0].setToolTip(Messages.getString("JobXMLWellFormed.Fields.SourceFileFolder.Tooltip")); colinf[1].setUsingVariables(true); colinf[1].setToolTip(Messages.getString("JobXMLWellFormed.Fields.Wildcard.Tooltip")); wFields = new TableView( jobMeta, wGeneralComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, lsMod, props); fdFields = new FormData(); fdFields.left = new FormAttachment(0, 0); fdFields.top = new FormAttachment(wlFields, margin); fdFields.right = new FormAttachment(100, -75); fdFields.bottom = new FormAttachment(100, -margin); wFields.setLayoutData(fdFields); RefreshArgFromPrevious(); // Add the file to the list of files... SelectionAdapter selA = new SelectionAdapter() { public void widgetSelected(SelectionEvent arg0) { wFields.add(new String[] {wSourceFileFolder.getText(), wWildcard.getText()}); wSourceFileFolder.setText(""); wWildcard.setText(""); wFields.removeEmptyRows(); wFields.setRowNums(); wFields.optWidth(true); } }; wbaSourceFileFolder.addSelectionListener(selA); wSourceFileFolder.addSelectionListener(selA); // Delete files from the list of files... wbdSourceFileFolder.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent arg0) { int idx[] = wFields.getSelectionIndices(); wFields.remove(idx); wFields.removeEmptyRows(); wFields.setRowNums(); } }); // Edit the selected file & remove from the list... wbeSourceFileFolder.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent arg0) { int idx = wFields.getSelectionIndex(); if (idx >= 0) { String string[] = wFields.getItem(idx); wSourceFileFolder.setText(string[0]); wWildcard.setText(string[1]); wFields.remove(idx); } wFields.removeEmptyRows(); wFields.setRowNums(); } }); fdGeneralComp = new FormData(); fdGeneralComp.left = new FormAttachment(0, 0); fdGeneralComp.top = new FormAttachment(0, 0); fdGeneralComp.right = new FormAttachment(100, 0); fdGeneralComp.bottom = new FormAttachment(100, 0); wGeneralComp.setLayoutData(fdGeneralComp); wGeneralComp.layout(); wGeneralTab.setControl(wGeneralComp); props.setLook(wGeneralComp); ///////////////////////////////////////////////////////////// /// END OF GENERAL TAB ///////////////////////////////////////////////////////////// ////////////////////////////////////// // START OF ADVANCED TAB /// ///////////////////////////////////// wAdvancedTab = new CTabItem(wTabFolder, SWT.NONE); wAdvancedTab.setText(Messages.getString("JobXMLWellFormed.Tab.Advanced.Label")); FormLayout contentLayout = new FormLayout(); contentLayout.marginWidth = 3; contentLayout.marginHeight = 3; wAdvancedComp = new Composite(wTabFolder, SWT.NONE); props.setLook(wAdvancedComp); wAdvancedComp.setLayout(contentLayout); // SuccessOngrouping? // //////////////////////// // START OF SUCCESS ON GROUP/// // / wSuccessOn = new Group(wAdvancedComp, SWT.SHADOW_NONE); props.setLook(wSuccessOn); wSuccessOn.setText(Messages.getString("JobXMLWellFormed.SuccessOn.Group.Label")); FormLayout successongroupLayout = new FormLayout(); successongroupLayout.marginWidth = 10; successongroupLayout.marginHeight = 10; wSuccessOn.setLayout(successongroupLayout); // Success Condition wlSuccessCondition = new Label(wSuccessOn, SWT.RIGHT); wlSuccessCondition.setText(Messages.getString("JobXMLWellFormed.SuccessCondition.Label")); props.setLook(wlSuccessCondition); fdlSuccessCondition = new FormData(); fdlSuccessCondition.left = new FormAttachment(0, 0); fdlSuccessCondition.right = new FormAttachment(middle, 0); fdlSuccessCondition.top = new FormAttachment(0, margin); wlSuccessCondition.setLayoutData(fdlSuccessCondition); wSuccessCondition = new CCombo(wSuccessOn, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER); wSuccessCondition.add(Messages.getString("JobXMLWellFormed.SuccessWhenAllWorksFine.Label")); wSuccessCondition.add(Messages.getString("JobXMLWellFormed.SuccessWhenAtLeat.Label")); wSuccessCondition.add( Messages.getString("JobXMLWellFormed.SuccessWhenBadFormedLessThan.Label")); wSuccessCondition.select(0); // +1: starts at -1 props.setLook(wSuccessCondition); fdSuccessCondition = new FormData(); fdSuccessCondition.left = new FormAttachment(middle, 0); fdSuccessCondition.top = new FormAttachment(0, margin); fdSuccessCondition.right = new FormAttachment(100, 0); wSuccessCondition.setLayoutData(fdSuccessCondition); wSuccessCondition.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { activeSuccessCondition(); } }); // Success when number of errors less than wlNrErrorsLessThan = new Label(wSuccessOn, SWT.RIGHT); wlNrErrorsLessThan.setText(Messages.getString("JobXMLWellFormed.NrBadFormedLessThan.Label")); props.setLook(wlNrErrorsLessThan); fdlNrErrorsLessThan = new FormData(); fdlNrErrorsLessThan.left = new FormAttachment(0, 0); fdlNrErrorsLessThan.top = new FormAttachment(wSuccessCondition, margin); fdlNrErrorsLessThan.right = new FormAttachment(middle, -margin); wlNrErrorsLessThan.setLayoutData(fdlNrErrorsLessThan); wNrErrorsLessThan = new TextVar( jobMeta, wSuccessOn, SWT.SINGLE | SWT.LEFT | SWT.BORDER, Messages.getString("JobXMLWellFormed.NrBadFormedLessThan.Tooltip")); props.setLook(wNrErrorsLessThan); wNrErrorsLessThan.addModifyListener(lsMod); fdNrErrorsLessThan = new FormData(); fdNrErrorsLessThan.left = new FormAttachment(middle, 0); fdNrErrorsLessThan.top = new FormAttachment(wSuccessCondition, margin); fdNrErrorsLessThan.right = new FormAttachment(100, -margin); wNrErrorsLessThan.setLayoutData(fdNrErrorsLessThan); fdSuccessOn = new FormData(); fdSuccessOn.left = new FormAttachment(0, margin); fdSuccessOn.top = new FormAttachment(0, margin); fdSuccessOn.right = new FormAttachment(100, -margin); wSuccessOn.setLayoutData(fdSuccessOn); // /////////////////////////////////////////////////////////// // / END OF Success ON GROUP // /////////////////////////////////////////////////////////// // fileresult grouping? // //////////////////////// // START OF LOGGING GROUP/// // / wFileResult = new Group(wAdvancedComp, SWT.SHADOW_NONE); props.setLook(wFileResult); wFileResult.setText(Messages.getString("JobXMLWellFormed.FileResult.Group.Label")); FormLayout fileresultgroupLayout = new FormLayout(); fileresultgroupLayout.marginWidth = 10; fileresultgroupLayout.marginHeight = 10; wFileResult.setLayout(fileresultgroupLayout); // Add Filenames to result filenames? wlAddFilenameToResult = new Label(wFileResult, SWT.RIGHT); wlAddFilenameToResult.setText(Messages.getString("JobXMLWellFormed.AddFilenameToResult.Label")); props.setLook(wlAddFilenameToResult); fdlAddFilenameToResult = new FormData(); fdlAddFilenameToResult.left = new FormAttachment(0, 0); fdlAddFilenameToResult.right = new FormAttachment(middle, 0); fdlAddFilenameToResult.top = new FormAttachment(0, margin); wlAddFilenameToResult.setLayoutData(fdlAddFilenameToResult); wAddFilenameToResult = new CCombo(wFileResult, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER); wAddFilenameToResult.add(Messages.getString("JobXMLWellFormed.AddAllFilenamesToResult.Label")); wAddFilenameToResult.add( Messages.getString("JobXMLWellFormed.AddOnlyWellFormedFilenames.Label")); wAddFilenameToResult.add( Messages.getString("JobXMLWellFormed.AddOnlyBadFormedFilenames.Label")); wAddFilenameToResult.select(0); // +1: starts at -1 props.setLook(wAddFilenameToResult); fdAddFilenameToResult = new FormData(); fdAddFilenameToResult.left = new FormAttachment(middle, 0); fdAddFilenameToResult.top = new FormAttachment(0, margin); fdAddFilenameToResult.right = new FormAttachment(100, 0); wAddFilenameToResult.setLayoutData(fdAddFilenameToResult); wAddFilenameToResult.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) {} }); fdFileResult = new FormData(); fdFileResult.left = new FormAttachment(0, margin); fdFileResult.top = new FormAttachment(wSuccessOn, margin); fdFileResult.right = new FormAttachment(100, -margin); wFileResult.setLayoutData(fdFileResult); // /////////////////////////////////////////////////////////// // / END OF FilesResult GROUP // /////////////////////////////////////////////////////////// fdAdvancedComp = new FormData(); fdAdvancedComp.left = new FormAttachment(0, 0); fdAdvancedComp.top = new FormAttachment(0, 0); fdAdvancedComp.right = new FormAttachment(100, 0); fdAdvancedComp.bottom = new FormAttachment(100, 0); wAdvancedComp.setLayoutData(wAdvancedComp); wAdvancedComp.layout(); wAdvancedTab.setControl(wAdvancedComp); ///////////////////////////////////////////////////////////// /// END OF ADVANCED TAB ///////////////////////////////////////////////////////////// fdTabFolder = new FormData(); fdTabFolder.left = new FormAttachment(0, 0); fdTabFolder.top = new FormAttachment(wName, margin); fdTabFolder.right = new FormAttachment(100, 0); fdTabFolder.bottom = new FormAttachment(100, -50); wTabFolder.setLayoutData(fdTabFolder); wOK = new Button(shell, SWT.PUSH); wOK.setText(Messages.getString("System.Button.OK")); wCancel = new Button(shell, SWT.PUSH); wCancel.setText(Messages.getString("System.Button.Cancel")); BaseStepDialog.positionBottomButtons(shell, new Button[] {wOK, wCancel}, margin, wTabFolder); // Add listeners lsCancel = new Listener() { public void handleEvent(Event e) { cancel(); } }; lsOK = new Listener() { public void handleEvent(Event e) { ok(); } }; wCancel.addListener(SWT.Selection, lsCancel); wOK.addListener(SWT.Selection, lsOK); lsDef = new SelectionAdapter() { public void widgetDefaultSelected(SelectionEvent e) { ok(); } }; wName.addSelectionListener(lsDef); wSourceFileFolder.addSelectionListener(lsDef); // Detect X or ALT-F4 or something that kills this window... shell.addShellListener( new ShellAdapter() { public void shellClosed(ShellEvent e) { cancel(); } }); getData(); activeSuccessCondition(); activeSuccessCondition(); wTabFolder.setSelection(0); BaseStepDialog.setSize(shell); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } return jobEntry; }
public boolean open() { Shell parent = getParent(); shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN); props.setLook(shell); shell.setImage(GUIResource.getInstance().getImageSlave()); lsMod = new ModifyListener() { public void modifyText(ModifyEvent e) { slaveServer.setChanged(); } }; middle = props.getMiddlePct(); margin = Const.MARGIN; FormLayout formLayout = new FormLayout(); formLayout.marginWidth = Const.FORM_MARGIN; formLayout.marginHeight = Const.FORM_MARGIN; shell.setText(BaseMessages.getString(PKG, "SlaveServerDialog.Shell.Title")); shell.setLayout(formLayout); // First, add the buttons... // Buttons wOK = new Button(shell, SWT.PUSH); wOK.setText(BaseMessages.getString(PKG, "System.Button.OK")); wCancel = new Button(shell, SWT.PUSH); wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel")); Button[] buttons = new Button[] {wOK, wCancel}; BaseStepDialog.positionBottomButtons(shell, buttons, margin, null); // The rest stays above the buttons... wTabFolder = new CTabFolder(shell, SWT.BORDER); props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB); addServiceTab(); addProxyTab(); fdTabFolder = new FormData(); fdTabFolder.left = new FormAttachment(0, 0); fdTabFolder.top = new FormAttachment(0, margin); fdTabFolder.right = new FormAttachment(100, 0); fdTabFolder.bottom = new FormAttachment(wOK, -margin); wTabFolder.setLayoutData(fdTabFolder); // Add listeners wOK.addListener( SWT.Selection, new Listener() { public void handleEvent(Event e) { ok(); } }); wCancel.addListener( SWT.Selection, new Listener() { public void handleEvent(Event e) { cancel(); } }); SelectionAdapter selAdapter = new SelectionAdapter() { public void widgetDefaultSelected(SelectionEvent e) { ok(); } }; wUsername.addSelectionListener(selAdapter); wPassword.addSelectionListener(selAdapter); wHostname.addSelectionListener(selAdapter); wPort.addSelectionListener(selAdapter); wWebAppName.addSelectionListener(selAdapter); wProxyHost.addSelectionListener(selAdapter); wProxyPort.addSelectionListener(selAdapter); wNonProxyHosts.addSelectionListener(selAdapter); // Detect X or ALT-F4 or something that kills this window... shell.addShellListener( new ShellAdapter() { public void shellClosed(ShellEvent e) { cancel(); } }); wTabFolder.setSelection(0); getData(); BaseStepDialog.setSize(shell); shell.open(); Display display = parent.getDisplay(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } return ok; }
public void openResultsXML(String fileName) { String outStr; try { DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = (Document) dBuilder.parse(fileName); doc.getDocumentElement().normalize(); if (doc.getElementsByTagName("wuid") != null) { wuid = doc.getElementsByTagName("wuid").item(0).getTextContent(); } if (doc.getElementsByTagName("jobname") != null) { jobname = doc.getElementsByTagName("jobname").item(0).getTextContent(); } if (doc.getElementsByTagName("serverAddress") != null) { serverAddress = doc.getElementsByTagName("serverAddress").item(0).getTextContent(); } // WUID // System.out.println(wuid); // lets create a tab for the wuid CTabItem wuidTab = new CTabItem(folder, SWT.NONE); wuidTab.setText(jobname + " " + wuid); folder.setSelection(folder.indexOf(wuidTab)); System.out.println("BUILDTAB--------" + folder.indexOf(wuidTab)); Composite tabHolder = new Composite(folder, SWT.NONE); tabHolder.setLayout(new GridLayout()); tabHolder.setLayoutData(new GridData(GridData.FILL_BOTH)); final String thisWuid = wuid; final String thisServerAddress = serverAddress; // add link here // Label link = new Label(); Link link = new Link(tabHolder, SWT.NONE); link.setText("<a>View Workunit in the Default Web Browser</a>"); link.addListener( SWT.Selection, new Listener() { public void handleEvent(Event event) { openUrl(thisServerAddress + "/WsWorkunits/WUInfo?Wuid=" + thisWuid); } }); CTabFolder subfolder = new CTabFolder(tabHolder, SWT.CLOSE); subfolder.setSimple(false); subfolder.setBorderVisible(true); subfolder.setLayoutData(new GridData(GridData.FILL_BOTH)); NodeList results = doc.getElementsByTagName("result"); for (int temp = 0; temp < results.getLength(); temp++) { Node result = results.item(temp); NamedNodeMap att = result.getAttributes(); // type String resType = att.getNamedItem("resulttype").getTextContent(); // System.out.println("resType: |" + resType + "|"); // filename String filePath = result.getTextContent(); // System.out.println(filePath); // CTabItem resultTab = new CTabItem(subfolder, SWT.NONE); // resultTab.setText(resType); // so here we use type and decide what tab to open and pass filename // buildTab(filePath,resType,subfolder); if (resType != null && filePath != null) { if (resType.equalsIgnoreCase("ClusterCounts")) { buildClusterCountsTab(filePath, resType, subfolder); } else if (resType.equalsIgnoreCase("SrcProfiles")) { buildSrcProfilesTab(filePath, resType, subfolder); } else if (resType.equalsIgnoreCase("Hygiene_ValidityErrors")) { buildHygieneValidityErrorsTab(filePath, resType, subfolder); } else if (resType.equalsIgnoreCase("ClusterSrc")) { buildClusterSrcTab(filePath, resType, subfolder); } else if (resType.equalsIgnoreCase("SrcOutliers")) { buildSrcOutliersTab(filePath, resType, subfolder); } else if (resType.equalsIgnoreCase("Dataprofiling_AllProfiles")) { buildProfileTab(filePath, resType, subfolder); } else if (resType.equalsIgnoreCase("Dataprofiling_SummaryReport")) { buildSummaryTab(filePath, resType, subfolder); } else if (resType.equalsIgnoreCase("Dataprofiling_OptimizedLayout")) { buildOptimizedLayoutTab(filePath, resType, subfolder); } else { // CleanedData buildTab(filePath, resType, subfolder); } } } wuidTab.setControl(tabHolder); } catch (Exception e) { // Catch exception if any System.err.println("Error: " + e.getMessage()); e.printStackTrace(); } }
@Override public void createPartControl(Composite parent) { GridLayout gl_parent = new GridLayout(1, false); gl_parent.marginHeight = 2; gl_parent.verticalSpacing = 2; gl_parent.horizontalSpacing = 2; gl_parent.marginWidth = 2; parent.setLayout(gl_parent); try { commandResult = MongoDBQuery.serverStatusCommandResult(userDB); } catch (Exception e1) { logger.error("Get status command", e1); } CTabFolder tabFolder = new CTabFolder(parent, SWT.NONE); tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); tabFolder.setBorderVisible(false); tabFolder.setSelectionBackground( TadpoleWidgetUtils.getTabFolderBackgroundColor(), TadpoleWidgetUtils.getTabFolderPercents()); CTabItem tbtmServerStatus = new CTabItem(tabFolder, SWT.NONE); tbtmServerStatus.setText(Messages.get().MongoDBInfosEditor_0); compositeServerStatus = new InstanceInformationComposite(tabFolder, SWT.NONE, userDB, commandResult); tbtmServerStatus.setControl(compositeServerStatus); compositeServerStatus.setLayout(new GridLayout(2, false)); new Label(compositeServerStatus, SWT.NONE); CTabItem tbtmCollectionSummary = new CTabItem(tabFolder, SWT.NONE); tbtmCollectionSummary.setText(Messages.get().MongoDBInfosEditor_1); compositeCollectionSummary = new CollectionInformationComposite(tabFolder, SWT.NONE); tbtmCollectionSummary.setControl(compositeCollectionSummary); GridLayout gl_compositeCollectionSummary = new GridLayout(1, false); gl_compositeCollectionSummary.verticalSpacing = 2; gl_compositeCollectionSummary.horizontalSpacing = 2; gl_compositeCollectionSummary.marginHeight = 2; gl_compositeCollectionSummary.marginWidth = 2; compositeCollectionSummary.setLayout(gl_compositeCollectionSummary); CTabItem tbtmLocaks = new CTabItem(tabFolder, SWT.NONE); tbtmLocaks.setText(Messages.get().MongoDBInfosEditor_2); LockComposite compositeLock = new LockComposite(tabFolder, SWT.NONE, userDB, commandResult); tbtmLocaks.setControl(compositeLock); compositeLock.setLayout(gl_compositeCollectionSummary); CTabItem tbtmReplicaInformation = new CTabItem(tabFolder, SWT.NONE); tbtmReplicaInformation.setText(Messages.get().MongoDBInfosEditor_3); ReplicaSetComposite compositeReplicaSet = new ReplicaSetComposite(tabFolder, SWT.NONE, userDB, commandResult); tbtmReplicaInformation.setControl(compositeReplicaSet); compositeReplicaSet.setLayout(gl_compositeCollectionSummary); CTabItem tbtmShardingInformation = new CTabItem(tabFolder, SWT.NONE); tbtmShardingInformation.setText(Messages.get().MongoDBInfosEditor_4); ShardingComposite compositeSharding = new ShardingComposite(tabFolder, SWT.NONE, userDB); tbtmShardingInformation.setControl(compositeSharding); compositeSharding.setLayout(gl_compositeCollectionSummary); if (defaultPage == PAGES.INSTANCE_INFORMATION) tabFolder.setSelection(0); else if (defaultPage == PAGES.COLLECTION_SUMMERY) tabFolder.setSelection(1); else if (defaultPage == PAGES.DB_LOCKS) tabFolder.setSelection(2); else if (defaultPage == PAGES.REPLACA_SET) tabFolder.setSelection(3); else tabFolder.setSelection(4); initData(); }
public Composite createSashForm(final Composite composite) { if (!tv.isTabViewsEnabled()) { tableComposite = tv.createMainPanel(composite); return tableComposite; } ConfigurationManager configMan = ConfigurationManager.getInstance(); int iNumViews = 0; UIFunctionsSWT uiFunctions = UIFunctionsManagerSWT.getUIFunctionsSWT(); UISWTViewEventListenerWrapper[] pluginViews = null; if (uiFunctions != null) { UISWTInstance pluginUI = uiFunctions.getUISWTInstance(); if (pluginUI != null) { pluginViews = pluginUI.getViewListeners(tv.getTableID()); iNumViews += pluginViews.length; } } if (iNumViews == 0) { tableComposite = tv.createMainPanel(composite); return tableComposite; } FormData formData; final Composite form = new Composite(composite, SWT.NONE); FormLayout flayout = new FormLayout(); flayout.marginHeight = 0; flayout.marginWidth = 0; form.setLayout(flayout); GridData gridData; gridData = new GridData(GridData.FILL_BOTH); form.setLayoutData(gridData); // Create them in reverse order, so we can have the table auto-grow, and // set the tabFolder's height manually final int TABHEIGHT = 20; tabFolder = new CTabFolder(form, SWT.TOP | SWT.BORDER); tabFolder.setMinimizeVisible(true); tabFolder.setTabHeight(TABHEIGHT); final int iFolderHeightAdj = tabFolder.computeSize(SWT.DEFAULT, 0).y; final Sash sash = new Sash(form, SWT.HORIZONTAL); tableComposite = tv.createMainPanel(form); Composite cFixLayout = tableComposite; while (cFixLayout != null && cFixLayout.getParent() != form) { cFixLayout = cFixLayout.getParent(); } if (cFixLayout == null) { cFixLayout = tableComposite; } GridLayout layout = new GridLayout(); layout.numColumns = 1; layout.horizontalSpacing = 0; layout.verticalSpacing = 0; layout.marginHeight = 0; layout.marginWidth = 0; cFixLayout.setLayout(layout); // FormData for Folder formData = new FormData(); formData.left = new FormAttachment(0, 0); formData.right = new FormAttachment(100, 0); formData.bottom = new FormAttachment(100, 0); int iSplitAt = configMan.getIntParameter(tv.getPropertiesPrefix() + ".SplitAt", 3000); // Was stored at whole if (iSplitAt < 100) { iSplitAt *= 100; } double pct = iSplitAt / 10000.0; if (pct < 0.03) { pct = 0.03; } else if (pct > 0.97) { pct = 0.97; } // height will be set on first resize call sash.setData("PCT", new Double(pct)); tabFolder.setLayoutData(formData); final FormData tabFolderData = formData; // FormData for Sash formData = new FormData(); formData.left = new FormAttachment(0, 0); formData.right = new FormAttachment(100, 0); formData.bottom = new FormAttachment(tabFolder); formData.height = 5; sash.setLayoutData(formData); // FormData for table Composite formData = new FormData(); formData.left = new FormAttachment(0, 0); formData.right = new FormAttachment(100, 0); formData.top = new FormAttachment(0, 0); formData.bottom = new FormAttachment(sash); cFixLayout.setLayoutData(formData); // Listeners to size the folder sash.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { final boolean FASTDRAG = true; if (FASTDRAG && e.detail == SWT.DRAG) { return; } if (tabFolder.getMinimized()) { tabFolder.setMinimized(false); refreshSelectedSubView(); ConfigurationManager configMan = ConfigurationManager.getInstance(); configMan.setParameter(tv.getPropertiesPrefix() + ".subViews.minimized", false); } Rectangle area = form.getClientArea(); tabFolderData.height = area.height - e.y - e.height - iFolderHeightAdj; form.layout(); Double l = new Double((double) tabFolder.getBounds().height / form.getBounds().height); sash.setData("PCT", l); if (e.detail != SWT.DRAG) { ConfigurationManager configMan = ConfigurationManager.getInstance(); configMan.setParameter( tv.getPropertiesPrefix() + ".SplitAt", (int) (l.doubleValue() * 10000)); } } }); final CTabFolder2Adapter folderListener = new CTabFolder2Adapter() { public void minimize(CTabFolderEvent event) { tabFolder.setMinimized(true); tabFolderData.height = iFolderHeightAdj; CTabItem[] items = tabFolder.getItems(); for (int i = 0; i < items.length; i++) { CTabItem tabItem = items[i]; tabItem.getControl().setVisible(false); } form.layout(); UISWTViewCore view = getActiveSubView(); if (view != null) { view.triggerEvent(UISWTViewEvent.TYPE_FOCUSLOST, null); } ConfigurationManager configMan = ConfigurationManager.getInstance(); configMan.setParameter(tv.getPropertiesPrefix() + ".subViews.minimized", true); } public void restore(CTabFolderEvent event) { tabFolder.setMinimized(false); CTabItem selection = tabFolder.getSelection(); if (selection != null) { selection.getControl().setVisible(true); } form.notifyListeners(SWT.Resize, null); UISWTViewCore view = getActiveSubView(); if (view != null) { view.triggerEvent(UISWTViewEvent.TYPE_FOCUSGAINED, null); } refreshSelectedSubView(); ConfigurationManager configMan = ConfigurationManager.getInstance(); configMan.setParameter(tv.getPropertiesPrefix() + ".subViews.minimized", false); } }; tabFolder.addCTabFolder2Listener(folderListener); tabFolder.addSelectionListener( new SelectionListener() { public void widgetSelected(SelectionEvent e) { // make sure its above try { ((CTabItem) e.item).getControl().setVisible(true); ((CTabItem) e.item).getControl().moveAbove(null); // TODO: Need to viewDeactivated old one UISWTViewCore view = getActiveSubView(); if (view != null) { view.triggerEvent(UISWTViewEvent.TYPE_FOCUSGAINED, null); } } catch (Exception t) { } } public void widgetDefaultSelected(SelectionEvent e) {} }); tabFolder.addMouseListener( new MouseAdapter() { public void mouseDown(MouseEvent e) { if (tabFolder.getMinimized()) { folderListener.restore(null); // If the user clicked down on the restore button, and we restore // before the CTabFolder does, CTabFolder will minimize us again // There's no way that I know of to determine if the mouse is // on that button! // one of these will tell tabFolder to cancel e.button = 0; tabFolder.notifyListeners(SWT.MouseExit, null); } } }); form.addListener( SWT.Resize, new Listener() { public void handleEvent(Event e) { if (tabFolder.getMinimized()) { return; } Double l = (Double) sash.getData("PCT"); if (l != null) { tabFolderData.height = (int) (form.getBounds().height * l.doubleValue()) - iFolderHeightAdj; form.layout(); } } }); // Call plugin listeners if (pluginViews != null) { for (UISWTViewEventListenerWrapper l : pluginViews) { if (l != null) { try { UISWTViewImpl view = new UISWTViewImpl(tv.getTableID(), l.getViewID(), l, null); addTabView(view); } catch (Exception e) { // skip, plugin probably specifically asked to not be added } } } } if (configMan.getBooleanParameter(tv.getPropertiesPrefix() + ".subViews.minimized", false)) { tabFolder.setMinimized(true); tabFolderData.height = iFolderHeightAdj; } else { tabFolder.setMinimized(false); } tabFolder.setSelection(0); return form; }
/** Create contents of the window */ protected void createContents() { m_shell = new Shell(); m_shell.setImage(SWTResourceManager.getImage(IPAToolAppWnd.class, "/Properties.ico")); final BorderLayout borderLayout = new BorderLayout(0, 0); borderLayout.setVgap(5); m_shell.setLayout(borderLayout); m_shell.setSize(800, 400); m_shell.setMinimumSize(new Point(800, 400)); m_shell.setText("IPATool2"); Composite composite; composite = new Composite(m_shell, SWT.NONE); { TabFolder tabFolder = new TabFolder(composite, SWT.NONE); tabFolder.setBounds(10, 10, 748, 200); { TabItem tbtmTools = new TabItem(tabFolder, SWT.NONE); tbtmTools.setText("Tools"); Composite composite_1 = new Composite(tabFolder, SWT.NONE); tbtmTools.setControl(composite_1); m_txtUpdFolder = new Text(composite_1, SWT.BORDER); m_txtUpdFolder.setText(""); m_txtUpdFolder.setBounds(122, 14, 564, 21); Button btnUpdFolder = new Button(composite_1, SWT.NONE); btnUpdFolder.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { _selectFolder(m_txtUpdFolder); } }); btnUpdFolder.setText("..."); btnUpdFolder.setBounds(692, 12, 38, 25); m_txtExistingFolder = new Text(composite_1, SWT.BORDER); m_txtExistingFolder.setText(""); m_txtExistingFolder.setBounds(122, 45, 564, 21); Button btnExFolder = new Button(composite_1, SWT.NONE); btnExFolder.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { _selectFolder(m_txtExistingFolder); } }); btnExFolder.setText("..."); btnExFolder.setBounds(692, 43, 38, 25); m_txtITunesFolder = new Text(composite_1, SWT.BORDER); m_txtITunesFolder.setText(""); m_txtITunesFolder.setBounds(122, 76, 564, 21); Button btnitunesFolder = new Button(composite_1, SWT.NONE); btnitunesFolder.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { _selectFolder(m_txtITunesFolder); } }); btnitunesFolder.setText("..."); btnitunesFolder.setBounds(692, 74, 38, 25); m_lbliTunes = new Label(composite_1, SWT.NONE); m_lbliTunes.setText("iTunes IPAs Folder:"); m_lbliTunes.setBounds(10, 79, 119, 15); m_lblExFolder = new Label(composite_1, SWT.NONE); m_lblExFolder.setText("Current IPAs Folder:"); m_lblExFolder.setBounds(10, 48, 119, 15); Label lblUpdFolder = new Label(composite_1, SWT.NONE); lblUpdFolder.setFont(SWTResourceManager.getFont("Segoe UI", 9, SWT.BOLD)); lblUpdFolder.setForeground(SWTResourceManager.getColor(SWT.COLOR_RED)); lblUpdFolder.setText(" IPAs Folder:"); lblUpdFolder.setBounds(10, 17, 119, 15); { m_chkRecurseFolders = new Button(composite_1, SWT.CHECK); m_chkRecurseFolders.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) {} }); m_chkRecurseFolders.setLocation(122, 103); m_chkRecurseFolders.setSize(107, 16); m_chkRecurseFolders.setSelection(true); m_chkRecurseFolders.setText("Recurse folders"); } { m_btnRenameIPAs = new Button(composite_1, SWT.NONE); m_btnRenameIPAs.setBackground(SWTResourceManager.getColor(SWT.COLOR_RED)); m_btnRenameIPAs.setLocation(120, 137); m_btnRenameIPAs.setSize(94, 25); m_btnRenameIPAs.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { renameIPAs(); } }); m_btnRenameIPAs.setText("Rename IPAs"); } m_btnUpdateIPAs = new Button(composite_1, SWT.NONE); m_btnUpdateIPAs.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { updateIPAs(); } }); m_btnUpdateIPAs.setBounds(216, 137, 94, 25); m_btnUpdateIPAs.setText("Update IPAs"); m_chkUseAllFolders = new Button(composite_1, SWT.CHECK); m_chkUseAllFolders.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (m_chkUseAllFolders.getSelection()) { m_lblExFolder.setForeground(SWTResourceManager.getColor(SWT.COLOR_RED)); m_lbliTunes.setForeground(SWTResourceManager.getColor(SWT.COLOR_RED)); } else { m_lblExFolder.setForeground(null); m_lbliTunes.setForeground(null); } } }); m_chkUseAllFolders.setBounds(244, 103, 107, 16); m_chkUseAllFolders.setText("Use all folders"); m_btnCleanJPGs = new Button(composite_1, SWT.NONE); m_btnCleanJPGs.setBackground(SWTResourceManager.getColor(SWT.COLOR_RED)); m_btnCleanJPGs.setBounds(310, 137, 94, 25); m_btnCleanJPGs.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { cleanJPEGs(); } }); m_btnCleanJPGs.setText("Clean JPEGs"); } TabItem tbtmCheckIPAs = new TabItem(tabFolder, SWT.NONE); tbtmCheckIPAs.setText("Check"); Composite composite_1 = new Composite(tabFolder, SWT.NONE); tbtmCheckIPAs.setControl(composite_1); m_txtIPhoneFolder = new Text(composite_1, SWT.BORDER); m_txtIPhoneFolder.setText(""); m_txtIPhoneFolder.setBounds(122, 14, 564, 21); Button btnIPhoneFolder = new Button(composite_1, SWT.NONE); btnIPhoneFolder.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { _selectFolder(m_txtIPhoneFolder); } }); btnIPhoneFolder.setText("..."); btnIPhoneFolder.setBounds(692, 12, 38, 25); m_txtIPadFolder = new Text(composite_1, SWT.BORDER); m_txtIPadFolder.setText(""); m_txtIPadFolder.setBounds(122, 45, 564, 21); Button btnIPadFolder = new Button(composite_1, SWT.NONE); btnIPadFolder.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { _selectFolder(m_txtIPadFolder); } }); btnIPadFolder.setText("..."); btnIPadFolder.setBounds(692, 43, 38, 25); m_txtMixedFolder = new Text(composite_1, SWT.BORDER); m_txtMixedFolder.setText(""); m_txtMixedFolder.setBounds(122, 76, 564, 21); Button btnMixedFolder = new Button(composite_1, SWT.NONE); btnMixedFolder.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { _selectFolder(m_txtMixedFolder); } }); btnMixedFolder.setText("..."); btnMixedFolder.setBounds(692, 74, 38, 25); Label lblBothIpasFolder = new Label(composite_1, SWT.NONE); lblBothIpasFolder.setText("mixed Folder:"); lblBothIpasFolder.setBounds(10, 79, 119, 15); Label lblIpadIpasFolder = new Label(composite_1, SWT.NONE); lblIpadIpasFolder.setText("iPad Folder:"); lblIpadIpasFolder.setBounds(10, 48, 119, 15); Label lblIphoneFolder = new Label(composite_1, SWT.NONE); lblIphoneFolder.setText("iPhone Folder:"); lblIphoneFolder.setBounds(10, 17, 119, 15); m_btnCheck = new Button(composite_1, SWT.NONE); m_btnCheck.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { checkIPAs(); } }); m_btnCheck.setText("Check IPAs"); m_btnCheck.setBounds(122, 122, 90, 25); } composite.setLayoutData(BorderLayout.NORTH); final Label lblX = new Label(composite, SWT.NONE); lblX.setBounds(10, 10, 14, 211); final TabFolder m_tabTraces = new TabFolder(m_shell, SWT.NONE); m_tabTraces.setLayoutData(BorderLayout.CENTER); final Composite composite_1 = new Composite(m_shell, SWT.NONE); composite_1.setLayout(new BorderLayout(0, 0)); composite_1.setLayoutData(BorderLayout.CENTER); // ------------------------------------------------------------------------ // ********** TabbedTracer *********************************************** final CTabFolder tabTraces = m_tabbedTracer.createTabFolder(composite_1); tabTraces.setLayoutData(BorderLayout.CENTER); Tracer.setTracer(m_tabbedTracer); }
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); }
/** * Create contents of the dialog. * * @param parent */ @Override protected Control createDialogArea(Composite parent) { setTitle(""); parent.setToolTipText("hghkhj"); Composite area = (Composite) super.createDialogArea(parent); Composite container = new Composite(area, SWT.NONE); container.setLayout(new GridLayout(1, false)); container.setLayoutData(new GridData(GridData.FILL_BOTH)); CTabFolder tabFolder = new CTabFolder(container, SWT.BORDER); tabFolder.setTabHeight(22); tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); tabFolder.setSelectionBackground( Display.getCurrent().getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT)); CTabItem tbtmNewItem = new CTabItem(tabFolder, SWT.NONE); tbtmNewItem.setText("Main"); Composite composite = new Composite(tabFolder, SWT.NONE); tbtmNewItem.setControl(composite); composite.setLayout(new GridLayout(2, false)); Label lblNewLabel = new Label(composite, SWT.NONE); lblNewLabel.setText("Id:"); idText = new Text(composite, SWT.BORDER); idText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); Label lblNewLabel_1 = new Label(composite, SWT.NONE); lblNewLabel_1.setText("Source Ref:"); sourceRefViewer = new ComboViewer(composite, SWT.READ_ONLY); Combo combo = sourceRefViewer.getCombo(); combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); sourceRefViewer.setContentProvider(new ArrayContentProvider()); sourceRefViewer.setLabelProvider(new IDataLabelProvider()); Label lblNewLabel_2 = new Label(composite, SWT.NONE); lblNewLabel_2.setText("Target Ref:"); targetRefViewer = new ComboViewer(composite, SWT.READ_ONLY); Combo combo_1 = targetRefViewer.getCombo(); combo_1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); targetRefViewer.setContentProvider(new ArrayContentProvider()); targetRefViewer.setLabelProvider(new IDataLabelProvider()); Label lblNewLabel_3 = new Label(composite, SWT.NONE); lblNewLabel_3.setText("Transformation:"); transformationText = new Text(composite, SWT.BORDER | SWT.WRAP | SWT.MULTI); transformationText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 2)); CTabItem tbtmNewItem_1 = new CTabItem(tabFolder, SWT.NONE); tbtmNewItem_1.setText("Assignments"); Composite composite_1 = new Composite(tabFolder, SWT.NONE); tbtmNewItem_1.setControl(composite_1); composite_1.setLayout(new GridLayout(1, true)); ToolBar toolBar = new ToolBar(composite_1, SWT.FLAT | SWT.RIGHT); toolBar.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1)); ToolItem addItem = new ToolItem(toolBar, SWT.NONE); addItem.addSelectionListener( new SelectionAdapter() { @SuppressWarnings("unchecked") @Override public void widgetSelected(SelectionEvent e) { Shell newshell = new Shell(getParentShell(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); AssignmentDialog dialog = new AssignmentDialog(newshell); String determinedId = IdUtil.getNextParentedIdInList( (List<BaseElement>) assignmentsViewer.getInput(), "A", idText.getText()); dialog.setDeterminedId(determinedId); if (dialog.open() == Window.OK) { ((List<Assignment>) assignmentsViewer.getInput()).add(dialog.getResult()); try { idHandler.addId(dialog.getResult()); } catch (IdAlreadyExistException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } assignmentsViewer.refresh(true); } } }); addItem.setText("New"); final ToolItem editItem = new ToolItem(toolBar, SWT.NONE); editItem.addSelectionListener( new SelectionAdapter() { @SuppressWarnings("unchecked") @Override public void widgetSelected(SelectionEvent e) { AssignmentDialog dialog = new AssignmentDialog(getShell()); String determinedId = IdUtil.getNextParentedIdInList( (List<BaseElement>) assignmentsViewer.getInput(), "A", idText.getText()); dialog.setDeterminedId(determinedId); IStructuredSelection selection = (IStructuredSelection) assignmentsViewer.getSelection(); if (dialog.open((Assignment) selection.getFirstElement()) == Window.OK) { int index = assignmentsViewer.getTable().getSelectionIndex(); try { idHandler.removeId((BaseElement) selection.getFirstElement()); } catch (IdNotFoundException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } ((List<Assignment>) assignmentsViewer.getInput()).remove(selection.getFirstElement()); ((List<Assignment>) assignmentsViewer.getInput()).add(index, dialog.getResult()); try { idHandler.addId(dialog.getResult()); } catch (IdAlreadyExistException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } assignmentsViewer.refresh(true); // ModelIdProcessor.refreshModelIds(EcoreUtil.getURI(getDiagram())); } } }); editItem.setText("Edit"); editItem.setEnabled(false); final ToolItem deleteItem = new ToolItem(toolBar, SWT.NONE); deleteItem.addSelectionListener( new SelectionAdapter() { @SuppressWarnings("unchecked") @Override public void widgetSelected(SelectionEvent e) { IStructuredSelection selection = (IStructuredSelection) assignmentsViewer.getSelection(); try { idHandler.removeId((BaseElement) selection.getFirstElement()); } catch (IdNotFoundException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } ((List<Assignment>) assignmentsViewer.getInput()).remove(selection.getFirstElement()); assignmentsViewer.refresh(true); // ModelIdProcessor.refreshModelIds(EcoreUtil.getURI(getDiagram())); } }); deleteItem.setText("Delete"); deleteItem.setEnabled(false); final ToolItem upItem = new ToolItem(toolBar, SWT.NONE); upItem.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { IStructuredSelection selection = (IStructuredSelection) assignmentsViewer.getSelection(); Assignment selected = (Assignment) selection.getFirstElement(); List<Assignment> list = (List<Assignment>) assignmentsViewer.getInput(); int index = list.indexOf(selected); list.remove(selected); list.add(index - 1, selected); assignmentsViewer.setSelection(new StructuredSelection(selected)); assignmentsViewer.refresh(true); } }); upItem.setEnabled(false); upItem.setText("Up"); final ToolItem downItem = new ToolItem(toolBar, SWT.NONE); downItem.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { IStructuredSelection selection = (IStructuredSelection) assignmentsViewer.getSelection(); Assignment selected = (Assignment) selection.getFirstElement(); List<Assignment> list = (List<Assignment>) assignmentsViewer.getInput(); int index = list.indexOf(selected); list.remove(selected); list.add(index + 1, selected); assignmentsViewer.setSelection(new StructuredSelection(selected)); assignmentsViewer.refresh(true); } }); downItem.setEnabled(false); downItem.setText("Down"); Composite composite_2 = new Composite(composite_1, SWT.NONE); composite_2.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); // composite_2.setLayout(new GridLayout(1, false)); assignmentsViewer = new TableViewer(composite_2, SWT.BORDER | SWT.FULL_SELECTION); assignmentsViewer.addSelectionChangedListener( new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { if (event.getSelection() == null) { editItem.setEnabled(false); deleteItem.setEnabled(false); upItem.setEnabled(false); downItem.setEnabled(false); } else { editItem.setEnabled(true); deleteItem.setEnabled(true); List<Assignment> list = (List<Assignment>) assignmentsViewer.getInput(); Assignment selected = (Assignment) (((StructuredSelection) event.getSelection()).getFirstElement()); if (list.indexOf(selected) == 0) { upItem.setEnabled(false); downItem.setEnabled(true); } else if (list.indexOf(selected) == list.size() - 1) { upItem.setEnabled(true); downItem.setEnabled(false); } else { upItem.setEnabled(true); downItem.setEnabled(true); } } } }); table = assignmentsViewer.getTable(); table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 0, 1)); table.setLinesVisible(true); table.setHeaderVisible(true); TableViewerColumn tableViewerColumn = new TableViewerColumn(assignmentsViewer, SWT.NONE); TableColumn tblclmnNewColumn = tableViewerColumn.getColumn(); tblclmnNewColumn.setWidth(new Double(table.getSize().x * 0.2).intValue()); tblclmnNewColumn.setResizable(true); tblclmnNewColumn.setText("Id"); TableViewerColumn tableViewerColumn_1 = new TableViewerColumn(assignmentsViewer, SWT.NONE); TableColumn tblclmnNewColumn_1 = tableViewerColumn_1.getColumn(); tblclmnNewColumn_1.setWidth(new Double(table.getSize().x * 0.4).intValue()); tblclmnNewColumn_1.setResizable(true); tblclmnNewColumn_1.setText("From"); TableViewerColumn tableViewerColumn_2 = new TableViewerColumn(assignmentsViewer, SWT.NONE); TableColumn tblclmnNewColumn_2 = tableViewerColumn_2.getColumn(); tblclmnNewColumn_2.setResizable(true); tblclmnNewColumn_2.setWidth(new Double(table.getSize().x * 0.4).intValue()); tblclmnNewColumn_2.setText("To"); TableColumnLayout tableColumnLayout = new TableColumnLayout(); tableColumnLayout.setColumnData(tblclmnNewColumn, new ColumnWeightData(20, 50, true)); tableColumnLayout.setColumnData(tblclmnNewColumn_1, new ColumnWeightData(40, 50, true)); tableColumnLayout.setColumnData(tblclmnNewColumn_2, new ColumnWeightData(40, 50, true)); composite_2.setLayout(tableColumnLayout); assignmentsViewer.setContentProvider(new ArrayContentProvider()); assignmentsViewer.setLabelProvider(new AssignmentLabelProvider()); VariableSupport.decorateTextWithVariableSupport(transformationText); transformationText.setFont(FontUtil.INSTANCE.getExpressionFont()); new Label(composite, SWT.NONE); init(); return area; }
public String open() { Shell parent = getParent(); Display display = parent.getDisplay(); shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX); props.setLook(shell); setShellImage(shell, input); ModifyListener lsMod = new ModifyListener() { public void modifyText(ModifyEvent e) { input.setChanged(); } }; changed = input.hasChanged(); FormLayout formLayout = new FormLayout(); formLayout.marginWidth = Const.FORM_MARGIN; formLayout.marginHeight = Const.FORM_MARGIN; shell.setLayout(formLayout); shell.setText(BaseMessages.getString(PKG, "StepsMetricsDialog.Shell.Title")); int middle = props.getMiddlePct(); int margin = Const.MARGIN; // Stepname line wlStepname = new Label(shell, SWT.RIGHT); wlStepname.setText(BaseMessages.getString(PKG, "StepsMetricsDialog.Stepname.Label")); props.setLook(wlStepname); fdlStepname = new FormData(); fdlStepname.left = new FormAttachment(0, 0); fdlStepname.right = new FormAttachment(middle, -margin); fdlStepname.top = new FormAttachment(0, margin); wlStepname.setLayoutData(fdlStepname); wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); wStepname.setText(stepname); props.setLook(wStepname); wStepname.addModifyListener(lsMod); fdStepname = new FormData(); fdStepname.left = new FormAttachment(middle, 0); fdStepname.top = new FormAttachment(0, margin); fdStepname.right = new FormAttachment(100, 0); wStepname.setLayoutData(fdStepname); wTabFolder = new CTabFolder(shell, SWT.BORDER); props.setLook(wTabFolder, PropsUI.WIDGET_STYLE_TAB); // //////////////////////// // START OF GENERAL TAB/// // / wGeneralTab = new CTabItem(wTabFolder, SWT.NONE); wGeneralTab.setText(BaseMessages.getString(PKG, "StepsMetricsDialog.General")); Composite wGeneralComp = new Composite(wTabFolder, SWT.NONE); props.setLook(wGeneralComp); FormLayout fileLayout = new FormLayout(); fileLayout.marginWidth = 3; fileLayout.marginHeight = 3; wGeneralComp.setLayout(fileLayout); // Get the previous steps... setStepNames(); wOK = new Button(shell, SWT.PUSH); wOK.setText(BaseMessages.getString(PKG, "System.Button.OK")); wGet = new Button(shell, SWT.PUSH); wGet.setText(BaseMessages.getString(PKG, "StepsMetricsDialog.getSteps.Label")); wCancel = new Button(shell, SWT.PUSH); wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel")); setButtonPositions(new Button[] {wOK, wGet, wCancel}, margin, null); // Table with fields wlFields = new Label(wGeneralComp, SWT.NONE); wlFields.setText(BaseMessages.getString(PKG, "StepsMetricsDialog.Fields.Label")); props.setLook(wlFields); fdlFields = new FormData(); fdlFields.left = new FormAttachment(0, 0); fdlFields.top = new FormAttachment(wStepname, margin); wlFields.setLayoutData(fdlFields); final int FieldsCols = 3; final int FieldsRows = input.getStepName().length; ColumnInfo[] colinf = new ColumnInfo[FieldsCols]; colinf[0] = new ColumnInfo( BaseMessages.getString(PKG, "StepsMetricsDialog.Fieldname.Step"), ColumnInfo.COLUMN_TYPE_CCOMBO, previousSteps, false); colinf[1] = new ColumnInfo( BaseMessages.getString(PKG, "StepsMetricsDialog.Fieldname.CopyNr"), ColumnInfo.COLUMN_TYPE_TEXT, false); colinf[2] = new ColumnInfo( BaseMessages.getString(PKG, "StepsMetricsDialog.Required.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, YES_NO_COMBO); colinf[1].setUsingVariables(true); wFields = new TableView( transMeta, wGeneralComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, lsMod, props); fdFields = new FormData(); fdFields.left = new FormAttachment(0, 0); fdFields.top = new FormAttachment(wlFields, margin); fdFields.right = new FormAttachment(100, 0); fdFields.bottom = new FormAttachment(100, -2 * margin); wFields.setLayoutData(fdFields); fdGeneralComp = new FormData(); fdGeneralComp.left = new FormAttachment(0, 0); fdGeneralComp.top = new FormAttachment(0, 0); fdGeneralComp.right = new FormAttachment(100, 0); fdGeneralComp.bottom = new FormAttachment(100, 0); wGeneralComp.setLayoutData(fdGeneralComp); wGeneralComp.layout(); wGeneralTab.setControl(wGeneralComp); // /////////////////////////////////////////////////////////// // / END OF GENERAL TAB // /////////////////////////////////////////////////////////// // //////////////////////// // START OF FIELDS TAB/// // / wFieldsTab = new CTabItem(wTabFolder, SWT.NONE); wFieldsTab.setText(BaseMessages.getString(PKG, "StepsMetricsDialog.Group.Fields")); Composite wFieldsComp = new Composite(wTabFolder, SWT.NONE); props.setLook(wFieldsComp); FormLayout fieldsLayout = new FormLayout(); fieldsLayout.marginWidth = 3; fieldsLayout.marginHeight = 3; wFieldsComp.setLayout(fieldsLayout); // Stepname line wlStepnameField = new Label(wFieldsComp, SWT.RIGHT); wlStepnameField.setText(BaseMessages.getString(PKG, "StepsMetricsDialog.Label.StepnameField")); props.setLook(wlStepnameField); fdlStepnameField = new FormData(); fdlStepnameField.left = new FormAttachment(0, 0); fdlStepnameField.top = new FormAttachment(0, margin); fdlStepnameField.right = new FormAttachment(middle, -margin); wlStepnameField.setLayoutData(fdlStepnameField); wStepnameField = new TextVar(transMeta, wFieldsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER); wStepnameField.setText(""); props.setLook(wStepnameField); wStepnameField.addModifyListener(lsMod); fdStepnameField = new FormData(); fdStepnameField.left = new FormAttachment(middle, 0); fdStepnameField.top = new FormAttachment(0, margin); fdStepnameField.right = new FormAttachment(100, -margin); wStepnameField.setLayoutData(fdStepnameField); // Stepid line wlStepidField = new Label(wFieldsComp, SWT.RIGHT); wlStepidField.setText(BaseMessages.getString(PKG, "StepsMetricsDialog.Label.StepidField")); props.setLook(wlStepidField); fdlStepidField = new FormData(); fdlStepidField.left = new FormAttachment(0, 0); fdlStepidField.top = new FormAttachment(wStepnameField, margin); fdlStepidField.right = new FormAttachment(middle, -margin); wlStepidField.setLayoutData(fdlStepidField); wStepidField = new TextVar(transMeta, wFieldsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER); wStepidField.setText(""); props.setLook(wStepidField); wStepidField.addModifyListener(lsMod); fdStepidField = new FormData(); fdStepidField.left = new FormAttachment(middle, 0); fdStepidField.top = new FormAttachment(wStepnameField, margin); fdStepidField.right = new FormAttachment(100, -margin); wStepidField.setLayoutData(fdStepidField); // Linesinput line wlLinesinputField = new Label(wFieldsComp, SWT.RIGHT); wlLinesinputField.setText( BaseMessages.getString(PKG, "StepsMetricsDialog.Label.LinesinputField")); props.setLook(wlLinesinputField); fdlLinesinputField = new FormData(); fdlLinesinputField.left = new FormAttachment(0, 0); fdlLinesinputField.top = new FormAttachment(wStepidField, margin); fdlLinesinputField.right = new FormAttachment(middle, -margin); wlLinesinputField.setLayoutData(fdlLinesinputField); wLinesinputField = new TextVar(transMeta, wFieldsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER); wLinesinputField.setText(""); props.setLook(wLinesinputField); wLinesinputField.addModifyListener(lsMod); fdLinesinputField = new FormData(); fdLinesinputField.left = new FormAttachment(middle, 0); fdLinesinputField.top = new FormAttachment(wStepidField, margin); fdLinesinputField.right = new FormAttachment(100, -margin); wLinesinputField.setLayoutData(fdLinesinputField); // Linesoutput line wlLinesoutputField = new Label(wFieldsComp, SWT.RIGHT); wlLinesoutputField.setText( BaseMessages.getString(PKG, "StepsMetricsDialog.Label.LinesoutputField")); props.setLook(wlLinesoutputField); fdlLinesoutputField = new FormData(); fdlLinesoutputField.left = new FormAttachment(0, 0); fdlLinesoutputField.top = new FormAttachment(wLinesinputField, margin); fdlLinesoutputField.right = new FormAttachment(middle, -margin); wlLinesoutputField.setLayoutData(fdlLinesoutputField); wLinesoutputField = new TextVar(transMeta, wFieldsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER); wLinesoutputField.setText(""); props.setLook(wLinesoutputField); wLinesoutputField.addModifyListener(lsMod); fdLinesoutputField = new FormData(); fdLinesoutputField.left = new FormAttachment(middle, 0); fdLinesoutputField.top = new FormAttachment(wLinesinputField, margin); fdLinesoutputField.right = new FormAttachment(100, -margin); wLinesoutputField.setLayoutData(fdLinesoutputField); // Linesread line wlLinesreadField = new Label(wFieldsComp, SWT.RIGHT); wlLinesreadField.setText( BaseMessages.getString(PKG, "StepsMetricsDialog.Label.LinesreadField")); props.setLook(wlLinesreadField); fdlLinesreadField = new FormData(); fdlLinesreadField.left = new FormAttachment(0, 0); fdlLinesreadField.top = new FormAttachment(wLinesoutputField, margin); fdlLinesreadField.right = new FormAttachment(middle, -margin); wlLinesreadField.setLayoutData(fdlLinesreadField); wLinesreadField = new TextVar(transMeta, wFieldsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER); wLinesreadField.setText(""); props.setLook(wLinesreadField); wLinesreadField.addModifyListener(lsMod); fdLinesreadField = new FormData(); fdLinesreadField.left = new FormAttachment(middle, 0); fdLinesreadField.top = new FormAttachment(wLinesoutputField, margin); fdLinesreadField.right = new FormAttachment(100, -margin); wLinesreadField.setLayoutData(fdLinesreadField); // Linesupdated line wlLinesupdatedField = new Label(wFieldsComp, SWT.RIGHT); wlLinesupdatedField.setText( BaseMessages.getString(PKG, "StepsMetricsDialog.Label.LinesupdatedField")); props.setLook(wlLinesupdatedField); fdlLinesupdatedField = new FormData(); fdlLinesupdatedField.left = new FormAttachment(0, 0); fdlLinesupdatedField.top = new FormAttachment(wLinesreadField, margin); fdlLinesupdatedField.right = new FormAttachment(middle, -margin); wlLinesupdatedField.setLayoutData(fdlLinesupdatedField); wLinesupdatedField = new TextVar(transMeta, wFieldsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER); wLinesupdatedField.setText(""); props.setLook(wLinesupdatedField); wLinesupdatedField.addModifyListener(lsMod); fdLinesupdatedField = new FormData(); fdLinesupdatedField.left = new FormAttachment(middle, 0); fdLinesupdatedField.top = new FormAttachment(wLinesreadField, margin); fdLinesupdatedField.right = new FormAttachment(100, -margin); wLinesupdatedField.setLayoutData(fdLinesupdatedField); // Lineswritten line wlLineswrittenField = new Label(wFieldsComp, SWT.RIGHT); wlLineswrittenField.setText( BaseMessages.getString(PKG, "StepsMetricsDialog.Label.LineswrittenField")); props.setLook(wlLineswrittenField); fdlLineswrittenField = new FormData(); fdlLineswrittenField.left = new FormAttachment(0, 0); fdlLineswrittenField.top = new FormAttachment(wLinesupdatedField, margin); fdlLineswrittenField.right = new FormAttachment(middle, -margin); wlLineswrittenField.setLayoutData(fdlLineswrittenField); wLineswrittenField = new TextVar(transMeta, wFieldsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER); wLineswrittenField.setText(""); props.setLook(wLineswrittenField); wLineswrittenField.addModifyListener(lsMod); fdLineswrittenField = new FormData(); fdLineswrittenField.left = new FormAttachment(middle, 0); fdLineswrittenField.top = new FormAttachment(wLinesupdatedField, margin); fdLineswrittenField.right = new FormAttachment(100, -margin); wLineswrittenField.setLayoutData(fdLineswrittenField); // Lineserrors line wlLineserrorsField = new Label(wFieldsComp, SWT.RIGHT); wlLineserrorsField.setText( BaseMessages.getString(PKG, "StepsMetricsDialog.Label.LineserrorsField")); props.setLook(wlLineserrorsField); fdlLineserrorsField = new FormData(); fdlLineserrorsField.left = new FormAttachment(0, 0); fdlLineserrorsField.top = new FormAttachment(wLineswrittenField, margin); fdlLineserrorsField.right = new FormAttachment(middle, -margin); wlLineserrorsField.setLayoutData(fdlLineserrorsField); wLineserrorsField = new TextVar(transMeta, wFieldsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER); wLineserrorsField.setText(""); props.setLook(wLineserrorsField); wLineserrorsField.addModifyListener(lsMod); fdLineserrorsField = new FormData(); fdLineserrorsField.left = new FormAttachment(middle, 0); fdLineserrorsField.top = new FormAttachment(wLineswrittenField, margin); fdLineserrorsField.right = new FormAttachment(100, -margin); wLineserrorsField.setLayoutData(fdLineserrorsField); // Seconds line wlSecondsField = new Label(wFieldsComp, SWT.RIGHT); wlSecondsField.setText(BaseMessages.getString(PKG, "StepsMetricsDialog.Label.DurationField")); props.setLook(wlSecondsField); fdlSecondsField = new FormData(); fdlSecondsField.left = new FormAttachment(0, 0); fdlSecondsField.top = new FormAttachment(wLineserrorsField, margin); fdlSecondsField.right = new FormAttachment(middle, -margin); wlSecondsField.setLayoutData(fdlSecondsField); wSecondsField = new TextVar(transMeta, wFieldsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER); wSecondsField.setText(""); props.setLook(wSecondsField); wSecondsField.addModifyListener(lsMod); fdSecondsField = new FormData(); fdSecondsField.left = new FormAttachment(middle, 0); fdSecondsField.top = new FormAttachment(wLineserrorsField, margin); fdSecondsField.right = new FormAttachment(100, -margin); wSecondsField.setLayoutData(fdSecondsField); fdFieldsComp = new FormData(); fdFieldsComp.left = new FormAttachment(0, 0); fdFieldsComp.top = new FormAttachment(0, 0); fdFieldsComp.right = new FormAttachment(100, 0); fdFieldsComp.bottom = new FormAttachment(100, 0); wFieldsComp.setLayoutData(fdFieldsComp); wFieldsComp.layout(); wFieldsTab.setControl(wFieldsComp); // /////////////////////////////////////////////////////////// // / END OF FIELDS TAB // /////////////////////////////////////////////////////////// fdTabFolder = new FormData(); fdTabFolder.left = new FormAttachment(0, 0); fdTabFolder.top = new FormAttachment(wStepname, margin); fdTabFolder.right = new FormAttachment(100, 0); fdTabFolder.bottom = new FormAttachment(100, -50); wTabFolder.setLayoutData(fdTabFolder); // Add listeners lsCancel = new Listener() { public void handleEvent(Event e) { cancel(); } }; lsGet = new Listener() { public void handleEvent(Event e) { get(); } }; lsOK = new Listener() { public void handleEvent(Event e) { ok(); } }; wCancel.addListener(SWT.Selection, lsCancel); wOK.addListener(SWT.Selection, lsOK); wGet.addListener(SWT.Selection, lsGet); lsDef = new SelectionAdapter() { public void widgetDefaultSelected(SelectionEvent e) { ok(); } }; wStepname.addSelectionListener(lsDef); // Detect X or ALT-F4 or something that kills this window... shell.addShellListener( new ShellAdapter() { public void shellClosed(ShellEvent e) { cancel(); } }); wTabFolder.setSelection(0); // Set the shell size, based upon previous time... setSize(); getData(); input.setChanged(changed); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } return stepname; }
/** * Diese Methode erledigt den eigentlichen Aufbau der Seite. Here we create the contents of the * preference page */ @SuppressWarnings("unchecked") @Override protected Control createContents(final Composite parent) { Composite ret = new Composite(parent, SWT.NONE); ret.setLayout(new GridLayout()); ctabs = new CTabFolder(ret, SWT.NONE); ctabs.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true)); ctabs.setLayout(new FillLayout()); setup = Messwert.getSetup(); fields = setup.getMap("Befunde"); // $NON-NLS-1$ names = (String) fields.get("names"); // $NON-NLS-1$ if (!StringTool.isNothing(names)) { for (String f : names.split(Messwert.SETUP_SEPARATOR)) { CTabItem ci = new CTabItem(ctabs, SWT.NONE); ci.setText(f); PrefsPage fp = new PrefsPage(ctabs, fields, f); ci.setControl(fp); } } ctabs.setSelection(0); lastIDX = 0; ctabs.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { if (lastIDX != -1) { flush(lastIDX); lastIDX = ctabs.getSelectionIndex(); } } }); Composite cButtons = new Composite(ret, SWT.NONE); cButtons.setLayout(new FillLayout()); Button bAdd = new Button(cButtons, SWT.PUSH); bAdd.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { InputDialog id = new InputDialog( getShell(), Messages.getString("BefundePrefs.enterNameCaption"), Messages.getString("BefundePrefs.enterNameMessage"), "", null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ if (id.open() == Dialog.OK) { String name = id.getValue(); if (StringTool.isNothing(names)) { names = name; } else { names += Messwert.SETUP_SEPARATOR + name; } fields.put("names", names); // $NON-NLS-1$ CTabItem ci = new CTabItem(ctabs, SWT.NONE); ci.setText(name); PrefsPage fp = new PrefsPage(ctabs, fields, name); ci.setControl(fp); ctabs.setSelection(ci); } } }); bAdd.setText(Messages.getString("BefundePrefs.add")); // $NON-NLS-1$ Button bRemove = new Button(cButtons, SWT.PUSH); bRemove.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { CTabItem ci = ctabs.getSelection(); if (ci != null) { PrefsPage pp = (PrefsPage) ci.getControl(); if (pp.remove()) { names = names.replaceFirst(ci.getText(), ""); // $NON-NLS-1$ names = names.replaceAll( Messwert.SETUP_SEPARATOR + Messwert.SETUP_SEPARATOR, Messwert.SETUP_SEPARATOR); names.replaceFirst(Messwert.SETUP_SEPARATOR + "$", ""); // $NON-NLS-1$ //$NON-NLS-2$ names = names.replaceFirst( "^" + Messwert.SETUP_SEPARATOR, ""); // $NON-NLS-1$ //$NON-NLS-2$ fields.put("names", names); // $NON-NLS-1$ lastIDX = -1; ci.dispose(); ctabs.setSelection(0); } } } }); bRemove.setText(Messages.getString("BefundePrefs.deleteText")); // $NON-NLS-1$ if (!Hub.acl.request(ACLContributor.DELETE_PARAM)) { bRemove.setEnabled(false); } return ret; }
@Override protected Control createDialogArea(final Composite parent) { parent.setLayout(new GridLayout()); // Text final Label label = new Label(parent, SWT.CENTER | SWT.NONE); label.setText(ABOUT); label.setLayoutData(SWTUtil.createFillHorizontallyGridData()); // Folder CTabFolder folder = new CTabFolder(parent, SWT.BORDER); folder.setSimple(false); folder.setLayoutData(SWTUtil.createFillGridData()); // License CTabItem item1 = new CTabItem(folder, SWT.NULL); item1.setText("License"); // $NON-NLS-1$ final Text license = new Text(folder, SWT.NONE | SWT.MULTI | SWT.V_SCROLL | SWT.BORDER); license.setText(LICENSE); license.setEditable(false); license.setLayoutData(SWTUtil.createFillGridData()); item1.setControl(license); // Contributors CTabItem item2 = new CTabItem(folder, SWT.NULL); item2.setText("Contributors"); // $NON-NLS-1$ Composite composite = new Composite(folder, SWT.BORDER); composite.setBackground(license.getBackground()); item2.setControl(composite); composite.setLayout(SWTUtil.createGridLayout(1, false)); final Label contributors = new Label(composite, SWT.NONE); contributors.setText(CONTRIBUTORS); contributors.setBackground(license.getBackground()); contributors.setLayoutData(SWTUtil.createFillGridData()); // Information CTabItem item3 = new CTabItem(folder, SWT.NULL); item3.setText("Links"); // $NON-NLS-1$ Composite composite3 = new Composite(folder, SWT.BORDER); composite3.setBackground(license.getBackground()); item3.setControl(composite3); composite3.setLayout(SWTUtil.createGridLayout(1, false)); createLink( composite3, "Website: <a>arx.deidentifier.org</a>", "Website", "http://arx.deidentifier.org"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ createLink( composite3, "Manual: <a>arx.deidentifier.org/anonymization-tool</a>", "Manual", "http://arx.deidentifier.org/anonymization-tool/"); //$NON-NLS-1$ //$NON-NLS-2$ // //$NON-NLS-3$ createLink( composite3, "API: <a>arx.deidentifier.org/api</a>", "API", "http://arx.deidentifier.org/api"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ createLink( composite3, "Downloads: <a>arx.deidentifier.org/downloads</a>", "Downloads", "http://arx.deidentifier.org/downloads"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ createLink( composite3, "Github: <a>github.com/arx-deidentifier</a>", "Github", "https://github.com/arx-deidentifier"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ return parent; }
public String open() { Shell parent = getParent(); Display display = parent.getDisplay(); shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN); props.setLook(shell); setShellImage(shell, input); ModifyListener lsMod = new ModifyListener() { public void modifyText(ModifyEvent e) { input.setChanged(); } }; changed = input.hasChanged(); FormLayout formLayout = new FormLayout(); formLayout.marginWidth = Const.FORM_MARGIN; formLayout.marginHeight = Const.FORM_MARGIN; shell.setLayout(formLayout); shell.setText(BaseMessages.getString(PKG, "RestDialog.Shell.Title")); // $NON-NLS-1$ int middle = props.getMiddlePct(); int margin = Const.MARGIN; // Stepname line wlStepname = new Label(shell, SWT.RIGHT); wlStepname.setText(BaseMessages.getString(PKG, "RestDialog.Stepname.Label")); // $NON-NLS-1$ props.setLook(wlStepname); fdlStepname = new FormData(); fdlStepname.left = new FormAttachment(0, 0); fdlStepname.right = new FormAttachment(middle, -margin); fdlStepname.top = new FormAttachment(0, margin); wlStepname.setLayoutData(fdlStepname); wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); wStepname.setText(stepname); props.setLook(wStepname); wStepname.addModifyListener(lsMod); fdStepname = new FormData(); fdStepname.left = new FormAttachment(middle, 0); fdStepname.top = new FormAttachment(0, margin); fdStepname.right = new FormAttachment(100, 0); wStepname.setLayoutData(fdStepname); wTabFolder = new CTabFolder(shell, SWT.BORDER); props.setLook(wTabFolder, PropsUI.WIDGET_STYLE_TAB); ////////////////////////// // START OF GENERAL TAB /// ////////////////////////// wGeneralTab = new CTabItem(wTabFolder, SWT.NONE); wGeneralTab.setText(BaseMessages.getString(PKG, "RestDialog.GeneralTab.Title")); wGeneralComp = new Composite(wTabFolder, SWT.NONE); props.setLook(wGeneralComp); FormLayout fileLayout = new FormLayout(); fileLayout.marginWidth = 3; fileLayout.marginHeight = 3; wGeneralComp.setLayout(fileLayout); ////////////////////////// // START Settings GROUP Group gSettings = new Group(wGeneralComp, SWT.SHADOW_ETCHED_IN); gSettings.setText( BaseMessages.getString(PKG, "RestDialog.SettingsGroup.Label")); // $NON-NLS-1$; FormLayout SettingsLayout = new FormLayout(); SettingsLayout.marginWidth = 3; SettingsLayout.marginHeight = 3; gSettings.setLayout(SettingsLayout); props.setLook(gSettings); wlUrl = new Label(gSettings, SWT.RIGHT); wlUrl.setText(BaseMessages.getString(PKG, "RestDialog.URL.Label")); // $NON-NLS-1$ props.setLook(wlUrl); fdlUrl = new FormData(); fdlUrl.left = new FormAttachment(0, 0); fdlUrl.right = new FormAttachment(middle, -margin); fdlUrl.top = new FormAttachment(wGeneralComp, margin * 2); wlUrl.setLayoutData(fdlUrl); wUrl = new TextVar(transMeta, gSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wUrl); wUrl.addModifyListener(lsMod); fdUrl = new FormData(); fdUrl.left = new FormAttachment(middle, 0); fdUrl.top = new FormAttachment(wGeneralComp, margin * 2); fdUrl.right = new FormAttachment(100, 0); wUrl.setLayoutData(fdUrl); // UrlInField line wlUrlInField = new Label(gSettings, SWT.RIGHT); wlUrlInField.setText(BaseMessages.getString(PKG, "RestDialog.UrlInField.Label")); props.setLook(wlUrlInField); fdlUrlInField = new FormData(); fdlUrlInField.left = new FormAttachment(0, 0); fdlUrlInField.top = new FormAttachment(wUrl, margin); fdlUrlInField.right = new FormAttachment(middle, -margin); wlUrlInField.setLayoutData(fdlUrlInField); wUrlInField = new Button(gSettings, SWT.CHECK); props.setLook(wUrlInField); fdUrlInField = new FormData(); fdUrlInField.left = new FormAttachment(middle, 0); fdUrlInField.top = new FormAttachment(wUrl, margin); fdUrlInField.right = new FormAttachment(100, 0); wUrlInField.setLayoutData(fdUrlInField); wUrlInField.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { input.setChanged(); activeUrlInfield(); } }); // UrlField Line wlUrlField = new Label(gSettings, SWT.RIGHT); wlUrlField.setText(BaseMessages.getString(PKG, "RestDialog.UrlField.Label")); // $NON-NLS-1$ props.setLook(wlUrlField); fdlUrlField = new FormData(); fdlUrlField.left = new FormAttachment(0, 0); fdlUrlField.right = new FormAttachment(middle, -margin); fdlUrlField.top = new FormAttachment(wUrlInField, margin); wlUrlField.setLayoutData(fdlUrlField); wUrlField = new ComboVar(transMeta, gSettings, SWT.BORDER | SWT.READ_ONLY); wUrlField.setEditable(true); props.setLook(wUrlField); wUrlField.addModifyListener(lsMod); fdUrlField = new FormData(); fdUrlField.left = new FormAttachment(middle, 0); fdUrlField.top = new FormAttachment(wUrlInField, margin); fdUrlField.right = new FormAttachment(100, -margin); wUrlField.setLayoutData(fdUrlField); wUrlField.addFocusListener( new FocusListener() { public void focusLost(org.eclipse.swt.events.FocusEvent e) {} public void focusGained(org.eclipse.swt.events.FocusEvent e) { Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT); shell.setCursor(busy); setStreamFields(); shell.setCursor(null); busy.dispose(); } }); // Method Line wlMethod = new Label(gSettings, SWT.RIGHT); wlMethod.setText(BaseMessages.getString(PKG, "RestDialog.Method.Label")); // $NON-NLS-1$ props.setLook(wlMethod); fdlMethod = new FormData(); fdlMethod.left = new FormAttachment(0, 0); fdlMethod.right = new FormAttachment(middle, -margin); fdlMethod.top = new FormAttachment(wUrlField, 2 * margin); wlMethod.setLayoutData(fdlMethod); wMethod = new ComboVar(transMeta, gSettings, SWT.BORDER | SWT.READ_ONLY); wMethod.setEditable(true); props.setLook(wMethod); wMethod.addModifyListener(lsMod); fdMethod = new FormData(); fdMethod.left = new FormAttachment(middle, 0); fdMethod.top = new FormAttachment(wUrlField, 2 * margin); fdMethod.right = new FormAttachment(100, -margin); wMethod.setLayoutData(fdMethod); wMethod.setItems(RestMeta.HTTP_METHODS); wMethod.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { setMethod(); } }); // MethodInField line wlMethodInField = new Label(gSettings, SWT.RIGHT); wlMethodInField.setText(BaseMessages.getString(PKG, "RestDialog.MethodInField.Label")); props.setLook(wlMethodInField); fdlMethodInField = new FormData(); fdlMethodInField.left = new FormAttachment(0, 0); fdlMethodInField.top = new FormAttachment(wMethod, margin); fdlMethodInField.right = new FormAttachment(middle, -margin); wlMethodInField.setLayoutData(fdlMethodInField); wMethodInField = new Button(gSettings, SWT.CHECK); props.setLook(wMethodInField); fdMethodInField = new FormData(); fdMethodInField.left = new FormAttachment(middle, 0); fdMethodInField.top = new FormAttachment(wMethod, margin); fdMethodInField.right = new FormAttachment(100, 0); wMethodInField.setLayoutData(fdMethodInField); wMethodInField.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { input.setChanged(); activeMethodInfield(); } }); // MethodField Line wlMethodField = new Label(gSettings, SWT.RIGHT); wlMethodField.setText( BaseMessages.getString(PKG, "RestDialog.MethodField.Label")); // $NON-NLS-1$ props.setLook(wlMethodField); fdlMethodField = new FormData(); fdlMethodField.left = new FormAttachment(0, 0); fdlMethodField.right = new FormAttachment(middle, -margin); fdlMethodField.top = new FormAttachment(wMethodInField, margin); wlMethodField.setLayoutData(fdlMethodField); wMethodField = new ComboVar(transMeta, gSettings, SWT.BORDER | SWT.READ_ONLY); wMethodField.setEditable(true); props.setLook(wMethodField); wMethodField.addModifyListener(lsMod); fdMethodField = new FormData(); fdMethodField.left = new FormAttachment(middle, 0); fdMethodField.top = new FormAttachment(wMethodInField, margin); fdMethodField.right = new FormAttachment(100, -margin); wMethodField.setLayoutData(fdMethodField); wMethodField.addFocusListener( new FocusListener() { public void focusLost(org.eclipse.swt.events.FocusEvent e) {} public void focusGained(org.eclipse.swt.events.FocusEvent e) { Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT); shell.setCursor(busy); setStreamFields(); shell.setCursor(null); busy.dispose(); } }); // Body Line wlBody = new Label(gSettings, SWT.RIGHT); wlBody.setText(BaseMessages.getString(PKG, "RestDialog.Body.Label")); // $NON-NLS-1$ props.setLook(wlBody); fdlBody = new FormData(); fdlBody.left = new FormAttachment(0, 0); fdlBody.right = new FormAttachment(middle, -margin); fdlBody.top = new FormAttachment(wMethodField, 2 * margin); wlBody.setLayoutData(fdlBody); wBody = new ComboVar(transMeta, gSettings, SWT.BORDER | SWT.READ_ONLY); wBody.setEditable(true); props.setLook(wBody); wBody.addModifyListener(lsMod); fdBody = new FormData(); fdBody.left = new FormAttachment(middle, 0); fdBody.top = new FormAttachment(wMethodField, 2 * margin); fdBody.right = new FormAttachment(100, -margin); wBody.setLayoutData(fdBody); wBody.addFocusListener( new FocusListener() { public void focusLost(org.eclipse.swt.events.FocusEvent e) {} public void focusGained(org.eclipse.swt.events.FocusEvent e) { Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT); shell.setCursor(busy); setStreamFields(); shell.setCursor(null); busy.dispose(); } }); // ApplicationType Line wlApplicationType = new Label(gSettings, SWT.RIGHT); wlApplicationType.setText( BaseMessages.getString(PKG, "RestDialog.ApplicationType.Label")); // $NON-NLS-1$ props.setLook(wlApplicationType); fdlApplicationType = new FormData(); fdlApplicationType.left = new FormAttachment(0, 0); fdlApplicationType.right = new FormAttachment(middle, -margin); fdlApplicationType.top = new FormAttachment(wBody, 2 * margin); wlApplicationType.setLayoutData(fdlApplicationType); wApplicationType = new ComboVar(transMeta, gSettings, SWT.BORDER | SWT.READ_ONLY); wApplicationType.setEditable(true); props.setLook(wApplicationType); wApplicationType.addModifyListener(lsMod); fdApplicationType = new FormData(); fdApplicationType.left = new FormAttachment(middle, 0); fdApplicationType.top = new FormAttachment(wBody, 2 * margin); fdApplicationType.right = new FormAttachment(100, -margin); wApplicationType.setLayoutData(fdApplicationType); wApplicationType.setItems(RestMeta.APPLICATION_TYPES); wApplicationType.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { input.setChanged(); } }); FormData fdSettings = new FormData(); fdSettings.left = new FormAttachment(0, 0); fdSettings.right = new FormAttachment(100, 0); fdSettings.top = new FormAttachment(wStepname, margin); gSettings.setLayoutData(fdSettings); // END Output Settings GROUP ////////////////////////// ////////////////////////// // START Output Fields GROUP Group gOutputFields = new Group(wGeneralComp, SWT.SHADOW_ETCHED_IN); gOutputFields.setText( BaseMessages.getString(PKG, "RestDialog.OutputFieldsGroup.Label")); // $NON-NLS-1$; FormLayout OutputFieldsLayout = new FormLayout(); OutputFieldsLayout.marginWidth = 3; OutputFieldsLayout.marginHeight = 3; gOutputFields.setLayout(OutputFieldsLayout); props.setLook(gOutputFields); // Result line... wlResult = new Label(gOutputFields, SWT.RIGHT); wlResult.setText(BaseMessages.getString(PKG, "RestDialog.Result.Label")); // $NON-NLS-1$ props.setLook(wlResult); fdlResult = new FormData(); fdlResult.left = new FormAttachment(0, 0); fdlResult.right = new FormAttachment(middle, -margin); fdlResult.top = new FormAttachment(gSettings, margin); wlResult.setLayoutData(fdlResult); wResult = new TextVar(transMeta, gOutputFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wResult); wResult.addModifyListener(lsMod); fdResult = new FormData(); fdResult.left = new FormAttachment(middle, 0); fdResult.top = new FormAttachment(gSettings, margin * 2); fdResult.right = new FormAttachment(100, -margin); wResult.setLayoutData(fdResult); // Resultcode line... wlResultCode = new Label(gOutputFields, SWT.RIGHT); wlResultCode.setText(BaseMessages.getString(PKG, "RestDialog.ResultCode.Label")); // $NON-NLS-1$ props.setLook(wlResultCode); fdlResultCode = new FormData(); fdlResultCode.left = new FormAttachment(0, 0); fdlResultCode.right = new FormAttachment(middle, -margin); fdlResultCode.top = new FormAttachment(wResult, margin); wlResultCode.setLayoutData(fdlResultCode); wResultCode = new TextVar(transMeta, gOutputFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wResultCode); wResultCode.addModifyListener(lsMod); fdResultCode = new FormData(); fdResultCode.left = new FormAttachment(middle, 0); fdResultCode.top = new FormAttachment(wResult, margin); fdResultCode.right = new FormAttachment(100, -margin); wResultCode.setLayoutData(fdResultCode); // Response time line... wlResponseTime = new Label(gOutputFields, SWT.RIGHT); wlResponseTime.setText( BaseMessages.getString(PKG, "RestDialog.ResponseTime.Label")); // $NON-NLS-1$ props.setLook(wlResponseTime); fdlResponseTime = new FormData(); fdlResponseTime.left = new FormAttachment(0, 0); fdlResponseTime.right = new FormAttachment(middle, -margin); fdlResponseTime.top = new FormAttachment(wResultCode, margin); wlResponseTime.setLayoutData(fdlResponseTime); wResponseTime = new TextVar(transMeta, gOutputFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wResponseTime); wResponseTime.addModifyListener(lsMod); fdResponseTime = new FormData(); fdResponseTime.left = new FormAttachment(middle, 0); fdResponseTime.top = new FormAttachment(wResultCode, margin); fdResponseTime.right = new FormAttachment(100, 0); wResponseTime.setLayoutData(fdResponseTime); FormData fdOutputFields = new FormData(); fdOutputFields.left = new FormAttachment(0, 0); fdOutputFields.right = new FormAttachment(100, 0); fdOutputFields.top = new FormAttachment(gSettings, margin); gOutputFields.setLayoutData(fdOutputFields); // END Output Fields GROUP ////////////////////////// fdGeneralComp = new FormData(); fdGeneralComp.left = new FormAttachment(0, 0); fdGeneralComp.top = new FormAttachment(wStepname, margin); fdGeneralComp.right = new FormAttachment(100, 0); fdGeneralComp.bottom = new FormAttachment(100, 0); wGeneralComp.setLayoutData(fdGeneralComp); wGeneralComp.layout(); wGeneralTab.setControl(wGeneralComp); ///////////////////////////////////////////////////////////// /// END OF GENERAL TAB ///////////////////////////////////////////////////////////// // Auth tab... // wAuthTab = new CTabItem(wTabFolder, SWT.NONE); wAuthTab.setText(BaseMessages.getString(PKG, "RestDialog.Auth.Title")); FormLayout alayout = new FormLayout(); alayout.marginWidth = Const.FORM_MARGIN; alayout.marginHeight = Const.FORM_MARGIN; wAuthComp = new Composite(wTabFolder, SWT.NONE); wAuthComp.setLayout(alayout); props.setLook(wAuthComp); ////////////////////////// // START HTTP AUTH GROUP Group gHttpAuth = new Group(wAuthComp, SWT.SHADOW_ETCHED_IN); gHttpAuth.setText( BaseMessages.getString(PKG, "RestDialog.HttpAuthGroup.Label")); // $NON-NLS-1$; FormLayout httpAuthLayout = new FormLayout(); httpAuthLayout.marginWidth = 3; httpAuthLayout.marginHeight = 3; gHttpAuth.setLayout(httpAuthLayout); props.setLook(gHttpAuth); // HTTP Login wlHttpLogin = new Label(gHttpAuth, SWT.RIGHT); wlHttpLogin.setText(BaseMessages.getString(PKG, "RestDialog.HttpLogin.Label")); // $NON-NLS-1$ props.setLook(wlHttpLogin); FormData fdlHttpLogin = new FormData(); fdlHttpLogin.top = new FormAttachment(0, margin); fdlHttpLogin.left = new FormAttachment(0, 0); fdlHttpLogin.right = new FormAttachment(middle, -margin); wlHttpLogin.setLayoutData(fdlHttpLogin); wHttpLogin = new TextVar(transMeta, gHttpAuth, SWT.SINGLE | SWT.LEFT | SWT.BORDER); wHttpLogin.addModifyListener(lsMod); wHttpLogin.setToolTipText( BaseMessages.getString(PKG, "RestDialog.HttpLogin.Tooltip")); // $NON-NLS-1$ props.setLook(wHttpLogin); FormData fdHttpLogin = new FormData(); fdHttpLogin.top = new FormAttachment(0, margin); fdHttpLogin.left = new FormAttachment(middle, 0); fdHttpLogin.right = new FormAttachment(100, 0); wHttpLogin.setLayoutData(fdHttpLogin); // HTTP Password wlHttpPassword = new Label(gHttpAuth, SWT.RIGHT); wlHttpPassword.setText( BaseMessages.getString(PKG, "RestDialog.HttpPassword.Label")); // $NON-NLS-1$ props.setLook(wlHttpPassword); FormData fdlHttpPassword = new FormData(); fdlHttpPassword.top = new FormAttachment(wHttpLogin, margin); fdlHttpPassword.left = new FormAttachment(0, 0); fdlHttpPassword.right = new FormAttachment(middle, -margin); wlHttpPassword.setLayoutData(fdlHttpPassword); wHttpPassword = new TextVar(transMeta, gHttpAuth, SWT.SINGLE | SWT.LEFT | SWT.BORDER); wHttpPassword.addModifyListener(lsMod); wHttpPassword.setToolTipText( BaseMessages.getString(PKG, "RestDialog.HttpPassword.Tooltip")); // $NON-NLS-1$ wHttpPassword.setEchoChar('*'); props.setLook(wHttpPassword); FormData fdHttpPassword = new FormData(); fdHttpPassword.top = new FormAttachment(wHttpLogin, margin); fdHttpPassword.left = new FormAttachment(middle, 0); fdHttpPassword.right = new FormAttachment(100, 0); wHttpPassword.setLayoutData(fdHttpPassword); // Preemptive line wlPreemptive = new Label(gHttpAuth, SWT.RIGHT); wlPreemptive.setText(BaseMessages.getString(PKG, "RestDialog.Preemptive.Label")); props.setLook(wlPreemptive); fdlPreemptive = new FormData(); fdlPreemptive.left = new FormAttachment(0, 0); fdlPreemptive.top = new FormAttachment(wHttpPassword, margin); fdlPreemptive.right = new FormAttachment(middle, -margin); wlPreemptive.setLayoutData(fdlPreemptive); wPreemptive = new Button(gHttpAuth, SWT.CHECK); props.setLook(wPreemptive); fdPreemptive = new FormData(); fdPreemptive.left = new FormAttachment(middle, 0); fdPreemptive.top = new FormAttachment(wHttpPassword, margin); fdPreemptive.right = new FormAttachment(100, 0); wPreemptive.setLayoutData(fdPreemptive); wPreemptive.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { input.setChanged(); } }); FormData fdHttpAuth = new FormData(); fdHttpAuth.left = new FormAttachment(0, 0); fdHttpAuth.right = new FormAttachment(100, 0); fdHttpAuth.top = new FormAttachment(gOutputFields, margin); gHttpAuth.setLayoutData(fdHttpAuth); // END HTTP AUTH GROUP ////////////////////////// ////////////////////////// // START PROXY GROUP Group gProxy = new Group(wAuthComp, SWT.SHADOW_ETCHED_IN); gProxy.setText(BaseMessages.getString(PKG, "RestDialog.ProxyGroup.Label")); // $NON-NLS-1$; FormLayout proxyLayout = new FormLayout(); proxyLayout.marginWidth = 3; proxyLayout.marginHeight = 3; gProxy.setLayout(proxyLayout); props.setLook(gProxy); // HTTP Login wlProxyHost = new Label(gProxy, SWT.RIGHT); wlProxyHost.setText(BaseMessages.getString(PKG, "RestDialog.ProxyHost.Label")); // $NON-NLS-1$ props.setLook(wlProxyHost); FormData fdlProxyHost = new FormData(); fdlProxyHost.top = new FormAttachment(0, margin); fdlProxyHost.left = new FormAttachment(0, 0); fdlProxyHost.right = new FormAttachment(middle, -margin); wlProxyHost.setLayoutData(fdlProxyHost); wProxyHost = new TextVar(transMeta, gProxy, SWT.SINGLE | SWT.LEFT | SWT.BORDER); wProxyHost.addModifyListener(lsMod); wProxyHost.setToolTipText( BaseMessages.getString(PKG, "RestDialog.ProxyHost.Tooltip")); // $NON-NLS-1$ props.setLook(wProxyHost); FormData fdProxyHost = new FormData(); fdProxyHost.top = new FormAttachment(0, margin); fdProxyHost.left = new FormAttachment(middle, 0); fdProxyHost.right = new FormAttachment(100, 0); wProxyHost.setLayoutData(fdProxyHost); // HTTP Password wlProxyPort = new Label(gProxy, SWT.RIGHT); wlProxyPort.setText(BaseMessages.getString(PKG, "RestDialog.ProxyPort.Label")); // $NON-NLS-1$ props.setLook(wlProxyPort); FormData fdlProxyPort = new FormData(); fdlProxyPort.top = new FormAttachment(wProxyHost, margin); fdlProxyPort.left = new FormAttachment(0, 0); fdlProxyPort.right = new FormAttachment(middle, -margin); wlProxyPort.setLayoutData(fdlProxyPort); wProxyPort = new TextVar(transMeta, gProxy, SWT.SINGLE | SWT.LEFT | SWT.BORDER); wProxyPort.addModifyListener(lsMod); wProxyPort.setToolTipText( BaseMessages.getString(PKG, "RestDialog.ProxyPort.Tooltip")); // $NON-NLS-1$ props.setLook(wProxyPort); FormData fdProxyPort = new FormData(); fdProxyPort.top = new FormAttachment(wProxyHost, margin); fdProxyPort.left = new FormAttachment(middle, 0); fdProxyPort.right = new FormAttachment(100, 0); wProxyPort.setLayoutData(fdProxyPort); FormData fdProxy = new FormData(); fdProxy.left = new FormAttachment(0, 0); fdProxy.right = new FormAttachment(100, 0); fdProxy.top = new FormAttachment(gHttpAuth, margin); gProxy.setLayoutData(fdProxy); // END HTTP AUTH GROUP ////////////////////////// fdAuthComp = new FormData(); fdAuthComp.left = new FormAttachment(0, 0); fdAuthComp.top = new FormAttachment(wStepname, margin); fdAuthComp.right = new FormAttachment(100, 0); fdAuthComp.bottom = new FormAttachment(100, 0); wAuthComp.setLayoutData(fdAuthComp); wAuthComp.layout(); wAuthTab.setControl(wAuthComp); //////// END of Auth Tab // SSL tab... // wSSLTab = new CTabItem(wTabFolder, SWT.NONE); wSSLTab.setText(BaseMessages.getString(PKG, "RestDialog.SSL.Title")); FormLayout ssll = new FormLayout(); ssll.marginWidth = Const.FORM_MARGIN; ssll.marginHeight = Const.FORM_MARGIN; wSSLComp = new Composite(wTabFolder, SWT.NONE); wSSLComp.setLayout(ssll); props.setLook(wSSLComp); ////////////////////////// // START SSLTrustStore GROUP Group gSSLTrustStore = new Group(wSSLComp, SWT.SHADOW_ETCHED_IN); gSSLTrustStore.setText( BaseMessages.getString(PKG, "RestDialog.SSLTrustStoreGroup.Label")); // $NON-NLS-1$; FormLayout SSLTrustStoreLayout = new FormLayout(); SSLTrustStoreLayout.marginWidth = 3; SSLTrustStoreLayout.marginHeight = 3; gSSLTrustStore.setLayout(SSLTrustStoreLayout); props.setLook(gSSLTrustStore); // TrustStoreFile line wlTrustStoreFile = new Label(gSSLTrustStore, SWT.RIGHT); wlTrustStoreFile.setText(BaseMessages.getString(PKG, "RestDialog.TrustStoreFile.Label")); props.setLook(wlTrustStoreFile); fdlTrustStoreFile = new FormData(); fdlTrustStoreFile.left = new FormAttachment(0, 0); fdlTrustStoreFile.top = new FormAttachment(0, margin); fdlTrustStoreFile.right = new FormAttachment(middle, -margin); wlTrustStoreFile.setLayoutData(fdlTrustStoreFile); wbTrustStoreFile = new Button(gSSLTrustStore, SWT.PUSH | SWT.CENTER); props.setLook(wbTrustStoreFile); wbTrustStoreFile.setText(BaseMessages.getString(PKG, "System.Button.Browse")); fdbTrustStoreFile = new FormData(); fdbTrustStoreFile.right = new FormAttachment(100, 0); fdbTrustStoreFile.top = new FormAttachment(0, 0); wbTrustStoreFile.setLayoutData(fdbTrustStoreFile); wbTrustStoreFile.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { FileDialog dialog = new FileDialog(shell, SWT.SAVE); dialog.setFilterExtensions(new String[] {"*.*"}); if (wTrustStoreFile.getText() != null) { dialog.setFileName(transMeta.environmentSubstitute(wTrustStoreFile.getText())); } dialog.setFilterNames( new String[] {BaseMessages.getString(PKG, "System.FileType.AllFiles")}); if (dialog.open() != null) { wTrustStoreFile.setText( dialog.getFilterPath() + System.getProperty("file.separator") + dialog.getFileName()); } } }); wTrustStoreFile = new TextVar(transMeta, gSSLTrustStore, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wTrustStoreFile); wTrustStoreFile.addModifyListener(lsMod); fdTrustStoreFile = new FormData(); fdTrustStoreFile.left = new FormAttachment(middle, 0); fdTrustStoreFile.top = new FormAttachment(0, margin); fdTrustStoreFile.right = new FormAttachment(wbTrustStoreFile, -margin); wTrustStoreFile.setLayoutData(fdTrustStoreFile); // TrustStorePassword line wlTrustStorePassword = new Label(gSSLTrustStore, SWT.RIGHT); wlTrustStorePassword.setText( BaseMessages.getString(PKG, "RestDialog.TrustStorePassword.Label")); props.setLook(wlTrustStorePassword); fdlTrustStorePassword = new FormData(); fdlTrustStorePassword.left = new FormAttachment(0, 0); fdlTrustStorePassword.top = new FormAttachment(wbTrustStoreFile, margin); fdlTrustStorePassword.right = new FormAttachment(middle, -margin); wlTrustStorePassword.setLayoutData(fdlTrustStorePassword); wTrustStorePassword = new TextVar(transMeta, gSSLTrustStore, SWT.SINGLE | SWT.LEFT | SWT.BORDER | SWT.PASSWORD); props.setLook(wTrustStorePassword); wTrustStorePassword.setEchoChar('*'); wTrustStorePassword.addModifyListener(lsMod); fdTrustStorePassword = new FormData(); fdTrustStorePassword.left = new FormAttachment(middle, 0); fdTrustStorePassword.top = new FormAttachment(wbTrustStoreFile, margin); fdTrustStorePassword.right = new FormAttachment(100, 0); wTrustStorePassword.setLayoutData(fdTrustStorePassword); FormData fdSSLTrustStore = new FormData(); fdSSLTrustStore.left = new FormAttachment(0, 0); fdSSLTrustStore.right = new FormAttachment(100, 0); fdSSLTrustStore.top = new FormAttachment(gHttpAuth, margin); gSSLTrustStore.setLayoutData(fdSSLTrustStore); // END HTTP AUTH GROUP ////////////////////////// fdSSLComp = new FormData(); fdSSLComp.left = new FormAttachment(0, 0); fdSSLComp.top = new FormAttachment(wStepname, margin); fdSSLComp.right = new FormAttachment(100, 0); fdSSLComp.bottom = new FormAttachment(100, 0); wSSLComp.setLayoutData(fdSSLComp); wSSLComp.layout(); wSSLTab.setControl(wSSLComp); //////// END of SSL Tab // Additional tab... // wAdditionalTab = new CTabItem(wTabFolder, SWT.NONE); wAdditionalTab.setText(BaseMessages.getString(PKG, "RestDialog.Headers.Title")); FormLayout addLayout = new FormLayout(); addLayout.marginWidth = Const.FORM_MARGIN; addLayout.marginHeight = Const.FORM_MARGIN; wAdditionalComp = new Composite(wTabFolder, SWT.NONE); wAdditionalComp.setLayout(addLayout); props.setLook(wAdditionalComp); wlFields = new Label(wAdditionalComp, SWT.NONE); wlFields.setText(BaseMessages.getString(PKG, "RestDialog.Headers.Label")); // $NON-NLS-1$ props.setLook(wlFields); fdlFields = new FormData(); fdlFields.left = new FormAttachment(0, 0); fdlFields.top = new FormAttachment(wStepname, margin); wlFields.setLayoutData(fdlFields); wGetHeaders = new Button(wAdditionalComp, SWT.PUSH); wGetHeaders.setText(BaseMessages.getString(PKG, "RestDialog.GetHeaders.Button")); // $NON-NLS-1$ FormData fdGetHeaders = new FormData(); fdGetHeaders.top = new FormAttachment(wlFields, margin); fdGetHeaders.right = new FormAttachment(100, 0); wGetHeaders.setLayoutData(fdGetHeaders); final int FieldsRows = input.getHeaderName().length; colinf = new ColumnInfo[] { new ColumnInfo( BaseMessages.getString(PKG, "RestDialog.ColumnInfo.Field"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] {""}, false), //$NON-NLS-1$ new ColumnInfo( BaseMessages.getString(PKG, "RestDialog.ColumnInfo.Name"), ColumnInfo.COLUMN_TYPE_TEXT, false) //$NON-NLS-1$ }; colinf[1].setUsingVariables(true); wFields = new TableView( transMeta, wAdditionalComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, lsMod, props); fdFields = new FormData(); fdFields.left = new FormAttachment(0, 0); fdFields.top = new FormAttachment(wlFields, margin); fdFields.right = new FormAttachment(wGetHeaders, -margin); fdFields.bottom = new FormAttachment(100, -margin); wFields.setLayoutData(fdFields); fdAdditionalComp = new FormData(); fdAdditionalComp.left = new FormAttachment(0, 0); fdAdditionalComp.top = new FormAttachment(wStepname, margin); fdAdditionalComp.right = new FormAttachment(100, -margin); fdAdditionalComp.bottom = new FormAttachment(100, 0); wAdditionalComp.setLayoutData(fdAdditionalComp); wAdditionalComp.layout(); wAdditionalTab.setControl(wAdditionalComp); //////// END of Additional Tab // Parameters tab... // wParametersTab = new CTabItem(wTabFolder, SWT.NONE); wParametersTab.setText(BaseMessages.getString(PKG, "RestDialog.Parameters.Title")); FormLayout playout = new FormLayout(); playout.marginWidth = Const.FORM_MARGIN; playout.marginHeight = Const.FORM_MARGIN; wParametersComp = new Composite(wTabFolder, SWT.NONE); wParametersComp.setLayout(playout); props.setLook(wParametersComp); wlParameters = new Label(wParametersComp, SWT.NONE); wlParameters.setText(BaseMessages.getString(PKG, "RestDialog.Parameters.Label")); // $NON-NLS-1$ props.setLook(wlParameters); fdlParameters = new FormData(); fdlParameters.left = new FormAttachment(0, 0); fdlParameters.top = new FormAttachment(wStepname, margin); wlParameters.setLayoutData(fdlParameters); wGet = new Button(wParametersComp, SWT.PUSH); wGet.setText(BaseMessages.getString(PKG, "RestDialog.GetParameters.Button")); // $NON-NLS-1$ FormData fdGet = new FormData(); fdGet.top = new FormAttachment(wlParameters, margin); fdGet.right = new FormAttachment(100, 0); wGet.setLayoutData(fdGet); final int ParametersRows = input.getParameterField().length; colinfoparams = new ColumnInfo[] { new ColumnInfo( BaseMessages.getString(PKG, "RestDialog.ColumnInfo.ParameterField"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] {""}, false), new ColumnInfo( BaseMessages.getString(PKG, "RestDialog.ColumnInfo.ParameterName"), ColumnInfo.COLUMN_TYPE_TEXT, false), //$NON-NLS-1$ }; wParameters = new TableView( transMeta, wParametersComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinfoparams, ParametersRows, lsMod, props); fdParameters = new FormData(); fdParameters.left = new FormAttachment(0, 0); fdParameters.top = new FormAttachment(wlParameters, margin); fdParameters.right = new FormAttachment(wGet, -margin); fdParameters.bottom = new FormAttachment(100, -margin); wParameters.setLayoutData(fdParameters); fdParametersComp = new FormData(); fdParametersComp.left = new FormAttachment(0, 0); fdParametersComp.top = new FormAttachment(wStepname, margin); fdParametersComp.right = new FormAttachment(100, 0); fdParametersComp.bottom = new FormAttachment(100, 0); wParametersComp.setLayoutData(fdParametersComp); wParametersComp.layout(); wParametersTab.setControl(wParametersComp); //////// END of Parameters Tab fdTabFolder = new FormData(); fdTabFolder.left = new FormAttachment(0, 0); fdTabFolder.top = new FormAttachment(wStepname, margin); fdTabFolder.right = new FormAttachment(100, 0); fdTabFolder.bottom = new FormAttachment(100, -50); wTabFolder.setLayoutData(fdTabFolder); // // Search the fields in the background // final Runnable runnable = new Runnable() { public void run() { StepMeta stepMeta = transMeta.findStep(stepname); if (stepMeta != null) { try { RowMetaInterface row = transMeta.getPrevStepFields(stepMeta); // Remember these fields... for (int i = 0; i < row.size(); i++) { inputFields.put(row.getValueMeta(i).getName(), Integer.valueOf(i)); } setComboBoxes(); } catch (KettleException e) { log.logError( toString(), BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Message")); } } } }; new Thread(runnable).start(); // THE BUTTONS wOK = new Button(shell, SWT.PUSH); wOK.setText(BaseMessages.getString(PKG, "System.Button.OK")); // $NON-NLS-1$ wCancel = new Button(shell, SWT.PUSH); wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel")); // $NON-NLS-1$ setButtonPositions(new Button[] {wOK, wCancel}, margin, wTabFolder); // Add listeners lsOK = new Listener() { public void handleEvent(Event e) { ok(); } }; lsCancel = new Listener() { public void handleEvent(Event e) { cancel(); } }; lsGet = new Listener() { public void handleEvent(Event e) { getParametersFields(); } }; Listener lsGetHeaders = new Listener() { public void handleEvent(Event e) { getHeaders(); } }; wOK.addListener(SWT.Selection, lsOK); wGet.addListener(SWT.Selection, lsGet); wGetHeaders.addListener(SWT.Selection, lsGetHeaders); wCancel.addListener(SWT.Selection, lsCancel); lsDef = new SelectionAdapter() { public void widgetDefaultSelected(SelectionEvent e) { ok(); } }; wStepname.addSelectionListener(lsDef); wUrl.addSelectionListener(lsDef); wResult.addSelectionListener(lsDef); wResultCode.addSelectionListener(lsDef); wResponseTime.addSelectionListener(lsDef); // Detect X or ALT-F4 or something that kills this window... shell.addShellListener( new ShellAdapter() { public void shellClosed(ShellEvent e) { cancel(); } }); lsResize = new Listener() { public void handleEvent(Event event) { Point size = shell.getSize(); wFields.setSize(size.x - 10, size.y - 50); wFields.table.setSize(size.x - 10, size.y - 50); wFields.redraw(); } }; shell.addListener(SWT.Resize, lsResize); // Set the shell size, based upon previous time... setSize(); wTabFolder.setSelection(0); getData(); activeUrlInfield(); activeMethodInfield(); setMethod(); input.setChanged(changed); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } return stepname; }
@Override protected void createClient(Section section, FormToolkit toolkit) { section.setLayout(FormLayoutFactory.createClearGridLayout(false, 1)); GridData data = new GridData(GridData.FILL_BOTH); section.setLayoutData(data); section.setText(PDEUIMessages.ArgumentsSection_title); section.setDescription(PDEUIMessages.ArgumentsSection_desc); Composite client = toolkit.createComposite(section); client.setLayout(FormLayoutFactory.createSectionClientGridLayout(false, 1)); client.setLayoutData(new GridData(GridData.FILL_BOTH)); fTabFolder = new CTabFolder(client, SWT.FLAT | SWT.TOP); toolkit.adapt(fTabFolder, true, true); GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); fTabFolder.setLayoutData(gd); gd.heightHint = 2; toolkit.getColors().initializeSectionToolBarColors(); Color selectedColor = toolkit.getColors().getColor(IFormColors.TB_BG); fTabFolder.setSelectionBackground( new Color[] {selectedColor, toolkit.getColors().getBackground()}, new int[] {100}, true); fTabFolder.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (fProgramArgs.isDirty()) fProgramArgs.commit(); if (fVMArgs.isDirty()) fVMArgs.commit(); refresh(); fArchCombo.select(fLastArch[fLastTab]); } }); createTabs(); Composite archParent = toolkit.createComposite(client); archParent.setLayout(FormLayoutFactory.createSectionClientGridLayout(false, 2)); archParent.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); toolkit.createLabel(archParent, PDEUIMessages.ArgumentsSection_architecture); fArchCombo = new ComboViewerPart(); fArchCombo.createControl(archParent, toolkit, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY); fArchCombo.getControl().setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false)); fArchCombo.setItems(TAB_ARCHLABELS); Control archComboControl = fArchCombo.getControl(); if (archComboControl instanceof Combo) ((Combo) archComboControl).select(fLastArch[fLastTab]); else ((CCombo) archComboControl).select(fLastArch[fLastTab]); fArchCombo.addSelectionChangedListener( new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { if (fProgramArgs.isDirty()) fProgramArgs.commit(); if (fVMArgs.isDirty()) fVMArgs.commit(); // remember the change in combo for currently selected platform Control fArchComboControl = fArchCombo.getControl(); if (fArchComboControl instanceof Combo) fLastArch[fLastTab] = ((Combo) fArchComboControl).getSelectionIndex(); else fLastArch[fLastTab] = ((CCombo) fArchComboControl).getSelectionIndex(); refresh(); } }); IActionBars actionBars = getPage().getPDEEditor().getEditorSite().getActionBars(); fProgramArgs = new FormEntry( client, toolkit, PDEUIMessages.ArgumentsSection_program, SWT.MULTI | SWT.WRAP); fProgramArgs.getText().setLayoutData(new GridData(GridData.FILL_BOTH)); fProgramArgs.setFormEntryListener( new FormEntryAdapter(this, actionBars) { @Override public void textValueChanged(FormEntry entry) { IArgumentsInfo info = getLauncherArguments(); info.setProgramArguments(entry.getValue().trim(), fLastTab, fLastArch[fLastTab]); updateArgumentPreview(info); } }); fProgramArgs.setEditable(isEditable()); fVMArgs = new FormEntry(client, toolkit, PDEUIMessages.ArgumentsSection_vm, SWT.MULTI | SWT.WRAP); fVMArgs.getText().setLayoutData(new GridData(GridData.FILL_BOTH)); fVMArgs.setFormEntryListener( new FormEntryAdapter(this, actionBars) { @Override public void textValueChanged(FormEntry entry) { IArgumentsInfo info = getLauncherArguments(); info.setVMArguments(entry.getValue().trim(), fLastTab, fLastArch[fLastTab]); updateArgumentPreview(info); } }); fVMArgs.setEditable(isEditable()); fPreviewArgs = new FormEntry( client, toolkit, PDEUIMessages.ArgumentsSection_preview, SWT.MULTI | SWT.WRAP); fPreviewArgs.getText().setLayoutData(new GridData(GridData.FILL_BOTH)); fPreviewArgs.setEditable(false); toolkit.paintBordersFor(client); section.setClient(client); // Register to be notified when the model changes getModel().addModelChangedListener(this); }
public String open() { Shell parent = getParent(); Display display = parent.getDisplay(); shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX); props.setLook(shell); setShellImage(shell, m_currentMeta); // used to listen to a text field (m_wStepname) ModifyListener lsMod = new ModifyListener() { public void modifyText(ModifyEvent e) { m_currentMeta.setChanged(); } }; changed = m_currentMeta.hasChanged(); FormLayout formLayout = new FormLayout(); formLayout.marginWidth = Const.FORM_MARGIN; formLayout.marginHeight = Const.FORM_MARGIN; shell.setLayout(formLayout); shell.setText(BaseMessages.getString(PKG, "HBaseRowDecoderDialog.Shell.Title")); int middle = props.getMiddlePct(); int margin = Const.MARGIN; // Stepname line m_stepnameLabel = new Label(shell, SWT.RIGHT); m_stepnameLabel.setText(BaseMessages.getString(PKG, "HBaseRowDecoderDialog.StepName.Label")); props.setLook(m_stepnameLabel); FormData fd = new FormData(); fd.left = new FormAttachment(0, 0); fd.right = new FormAttachment(middle, -margin); fd.top = new FormAttachment(0, margin); m_stepnameLabel.setLayoutData(fd); m_stepnameText = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); m_stepnameText.setText(stepname); props.setLook(m_stepnameText); m_stepnameText.addModifyListener(lsMod); // format the text field fd = new FormData(); fd.left = new FormAttachment(middle, 0); fd.top = new FormAttachment(0, margin); fd.right = new FormAttachment(100, 0); m_stepnameText.setLayoutData(fd); m_wTabFolder = new CTabFolder(shell, SWT.BORDER); props.setLook(m_wTabFolder, Props.WIDGET_STYLE_TAB); m_wTabFolder.setSimple(false); // Start of the config tab m_wConfigTab = new CTabItem(m_wTabFolder, SWT.NONE); m_wConfigTab.setText(BaseMessages.getString(PKG, "HBaseRowDecoderDialog.ConfigTab.TabTitle")); Composite wConfigComp = new Composite(m_wTabFolder, SWT.NONE); props.setLook(wConfigComp); FormLayout configLayout = new FormLayout(); configLayout.marginWidth = 3; configLayout.marginHeight = 3; wConfigComp.setLayout(configLayout); // incoming key field line Label inKeyLab = new Label(wConfigComp, SWT.RIGHT); inKeyLab.setText(BaseMessages.getString(PKG, "HBaseRowDecoderDialog.KeyField.Label")); props.setLook(inKeyLab); fd = new FormData(); fd.left = new FormAttachment(0, 0); fd.top = new FormAttachment(0, margin); fd.right = new FormAttachment(middle, -margin); inKeyLab.setLayoutData(fd); m_incomingKeyCombo = new CCombo(wConfigComp, SWT.BORDER); props.setLook(m_incomingKeyCombo); fd = new FormData(); fd.left = new FormAttachment(middle, 0); fd.top = new FormAttachment(0, margin); fd.right = new FormAttachment(100, 0); m_incomingKeyCombo.setLayoutData(fd); m_incomingKeyCombo.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { m_currentMeta.setChanged(); m_incomingKeyCombo.setToolTipText( transMeta.environmentSubstitute(m_incomingKeyCombo.getText())); } }); // incoming result line Label inResultLab = new Label(wConfigComp, SWT.RIGHT); inResultLab.setText(BaseMessages.getString(PKG, "HBaseRowDecoderDialog.ResultField.Label")); props.setLook(inResultLab); fd = new FormData(); fd.left = new FormAttachment(0, 0); fd.top = new FormAttachment(m_incomingKeyCombo, margin); fd.right = new FormAttachment(middle, -margin); inResultLab.setLayoutData(fd); m_incomingResultCombo = new CCombo(wConfigComp, SWT.BORDER); props.setLook(m_incomingResultCombo); fd = new FormData(); fd.left = new FormAttachment(middle, 0); fd.top = new FormAttachment(m_incomingKeyCombo, margin); fd.right = new FormAttachment(100, 0); m_incomingResultCombo.setLayoutData(fd); m_incomingResultCombo.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { m_currentMeta.setChanged(); m_incomingResultCombo.setToolTipText( transMeta.environmentSubstitute(m_incomingResultCombo.getText())); } }); populateFieldsCombo(); wConfigComp.layout(); m_wConfigTab.setControl(wConfigComp); // --- mapping editor tab m_editorTab = new CTabItem(m_wTabFolder, SWT.NONE); m_editorTab.setText( BaseMessages.getString(PKG, "HBaseRowDecoderDialog.MappingEditorTab.TabTitle")); m_mappingEditor = new MappingEditor( shell, m_wTabFolder, null, null, SWT.FULL_SELECTION | SWT.MULTI, false, props, transMeta); fd = new FormData(); fd.top = new FormAttachment(0, 0); fd.left = new FormAttachment(0, 0); fd.bottom = new FormAttachment(100, -margin * 2); fd.right = new FormAttachment(100, 0); m_mappingEditor.setLayoutData(fd); m_mappingEditor.layout(); m_editorTab.setControl(m_mappingEditor); fd = new FormData(); fd.left = new FormAttachment(0, 0); fd.top = new FormAttachment(m_stepnameText, margin); fd.right = new FormAttachment(100, 0); fd.bottom = new FormAttachment(100, -50); m_wTabFolder.setLayoutData(fd); // Buttons inherited from BaseStepDialog wOK = new Button(shell, SWT.PUSH); wOK.setText(BaseMessages.getString(PKG, "System.Button.OK")); wCancel = new Button(shell, SWT.PUSH); wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel")); setButtonPositions(new Button[] {wOK, wCancel}, margin, m_wTabFolder); // Add listeners lsCancel = new Listener() { public void handleEvent(Event e) { cancel(); } }; lsOK = new Listener() { public void handleEvent(Event e) { ok(); } }; wCancel.addListener(SWT.Selection, lsCancel); wOK.addListener(SWT.Selection, lsOK); lsDef = new SelectionAdapter() { @Override public void widgetDefaultSelected(SelectionEvent e) { ok(); } }; m_stepnameText.addSelectionListener(lsDef); // Detect X or ALT-F4 or something that kills this window... shell.addShellListener( new ShellAdapter() { @Override public void shellClosed(ShellEvent e) { cancel(); } }); m_wTabFolder.setSelection(0); setSize(); getData(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } return stepname; }
private void createUI() { String newFile = ""; System.out.println("create saltResults GUI"); // fileName = System.getProperty("fileName"); // fileName = System.getProperties().getProperty("fileName"); // System.out.println("fileName" + fileName); parentShell = ((Spoon) SpoonFactory.getInstance()).getShell(); Display display = parentShell.getDisplay(); // dpt.createContents(parentShell); comp = new Composite(((Spoon) SpoonFactory.getInstance()).getShell(), SWT.BORDER); comp.setLayout(new GridLayout()); comp.setLayoutData(new GridData(GridData.FILL_BOTH)); Composite btnComp = new Composite(comp, SWT.NONE); GridLayout btnLayout = new GridLayout(); btnLayout.numColumns = 2; btnComp.setLayout(btnLayout); lbl = new Label(comp, SWT.CENTER | SWT.TOP); Label lbl = new Label(comp, SWT.CENTER | SWT.TOP); GridData ldata = new GridData(SWT.CENTER, SWT.TOP, true, false); lbl.setLayoutData(ldata); lbl.setText("Preview data returned from SALt"); Button fileButton = new Button(btnComp, SWT.PUSH | SWT.SINGLE | SWT.TOP); fileButton.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, false)); fileButton.setText("OPEN Data Profile FILE"); // Listener for the file open button (fileButton) Listener fileOpenListener = new Listener() { public void handleEvent(Event e) { String newFile = buildFileDialog(); if (newFile != "") { fileName = newFile; // TODO: create new tab for file // openFile(fileName); buildProfileTab(fileName); // int len = folder.getChildren().length; int len = folder.getItemCount(); System.out.println("Number of tabs: " + len); folder.setSelection(len - 1); } } }; fileButton.addListener(SWT.Selection, fileOpenListener); Button fileButtonSummary = new Button(btnComp, SWT.PUSH | SWT.SINGLE | SWT.TOP); fileButtonSummary.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, false)); fileButtonSummary.setText("OPEN Data Summary FILE"); // Listener for the file open button (fileButton) Listener fileSummaryOpenListener = new Listener() { public void handleEvent(Event e) { String newFile = buildFileDialog(); if (newFile != "") { fileName = newFile; // TODO: create new tab for file // openFile(fileName); buildSummaryTab(fileName); // int len = folder.getChildren().length; int len = folder.getItemCount(); System.out.println("Number of tabs: " + len); folder.setSelection(len - 1); } } }; fileButtonSummary.addListener(SWT.Selection, fileSummaryOpenListener); folder = new CTabFolder(comp, SWT.CLOSE); folder.setSimple(false); folder.setBorderVisible(true); folder.setLayoutData(new GridData(GridData.FILL_BOTH)); }