public void buildHygieneValidityErrorsTab( String thefilename, String resType, CTabFolder subfolder) { System.out.println("buildHygieneValidityErrorsTab"); DataHygieneTable table = new DataHygieneTable(thefilename); table.createContents(subfolder); subfolder.setSelection(subfolder.getItemCount() - 1); }
public void setActive(boolean b) { // the function is called 3 times when leaving this perspective this odd // logic is here so it doesn't reload the data when leaving this perspective if (b) { if (!this.isActive) { System.out.println("create eclResults setActive"); if (System.getProperties().getProperty("resultsFile") != null && !System.getProperties().getProperty("resultsFile").equals("")) { String xmlFile = System.getProperties().getProperty("resultsFile"); ArrayList<String> resultFiles = parseData("resultsFile"); for (int i = 0; i < resultFiles.size(); i++) { openResultsXML(resultFiles.get(i)); } // openResultsXML(xmlFile); System.getProperties().setProperty("resultsFile", ""); } int len = folder.getItemCount(); folder.setSelection(len - 1); this.isActive = true; } else { this.isActive = false; } } else { System.out.println("create eclResults setActive -- deactivate"); } }
/* * The key listeners we add workaround a bug int Text that don't repaint * properly when they have background images. */ protected void createChatControl(Widget item) throws Exception { CTabItem tabItem = new CTabItem(tabFolder, SWT.NONE); tabItem.setText("Chat with " + ((TreeItem) item).getText()); SashForm textForm = new SashForm(tabFolder, SWT.VERTICAL); final Text text1 = new Text(textForm, SWT.MULTI); text1.setData("id", "output"); text1.setText(OUTPUT_TEXT); text1.addKeyListener( new KeyAdapter() { public void keyPressed(KeyEvent arg0) { text1.redraw(); } }); final Text text2 = new Text(textForm, SWT.MULTI); text2.setData("id", "input"); text2.setText(INPUT_TEXT); text2.addKeyListener( new KeyAdapter() { public void keyPressed(KeyEvent arg0) { text2.redraw(); } }); tabItem.setControl(textForm); textForm.setWeights(new int[] {80, 20}); getCSSEngine().applyStyles(textForm, false); tabFolder.setSelection(tabItem); }
public void buildSrcProfilesTab(String thefilename, String resType, CTabFolder subfolder) { System.out.println("buildSrcProfilesTab"); SourceProfilesTable table = new SourceProfilesTable(thefilename); table.createContents(subfolder); subfolder.setSelection(subfolder.getItemCount() - 1); // buildTab(thefilename,resType,subfolder); }
@Override public void update(final ModelEvent event) { if (event.part == ModelPart.SELECTED_ATTRIBUTE) { for (final CTabItem item : folder.getItems()) { if (item.getText().equals(event.data)) { folder.setSelection(item); break; } } } else if (event.part == ModelPart.MODEL) { model = (Model) event.data; } else if (event.part == ModelPart.INPUT) { reset(); folder.setRedraw(false); for (int i = 0; i < model.getInputConfig().getInput().getHandle().getNumColumns(); i++) { final String col = model.getInputConfig().getInput().getHandle().getAttributeName(i); final IView l = new ViewAttributeDefinition(folder, col, controller); l.update(new ModelEvent(this, ModelPart.MODEL, model)); l.update(new ModelEvent(this, ModelPart.INPUT, event.data)); names.put(i, col); views.add(l); } folder.setRedraw(true); folder.redraw(); } }
public void buildSummaryTab(String thefilename, String resType, CTabFolder subfolder) { System.out.println("buildSummaryTab"); CTabItem tabSumm = new CTabItem(subfolder, SWT.NONE); tabSumm.setText("Data Summary"); DataSummaryTable dst = new DataSummaryTable(thefilename); Composite prof = dst.createContents(subfolder); tabSumm.setControl(prof); subfolder.setSelection(subfolder.getItemCount() - 1); }
public void buildOptimizedLayoutTab(String thefilename, String resType, CTabFolder subfolder) { System.out.println("buildOptimizedLayoutTab"); OptimizedLayoutMain olm = new OptimizedLayoutMain(thefilename); CTabItem tabOL = new CTabItem(subfolder, SWT.NONE); tabOL.setText("Optimized Layout"); Text t = olm.createContents(subfolder); tabOL.setControl(t); subfolder.setSelection(subfolder.getItemCount() - 1); }
private void createTabs() { for (int i = 0; i < TAB_LABELS.length; i++) { CTabItem item = new CTabItem(fTabFolder, SWT.NULL); item.setText(TAB_LABELS[i]); item.setImage( PDEPlugin.getDefault().getLabelProvider().get(PDEPluginImages.DESC_OPERATING_SYSTEM_OBJ)); } fLastTab = 0; fTabFolder.setSelection(fLastTab); }
public void buildProfileTab(String filename, String resType, CTabFolder subfolder) { System.out.println("buildProfileTab"); CTabItem tabDP = new CTabItem(subfolder, SWT.NONE); tabDP.setText("Data Profile"); DataProfileTable dpt = new DataProfileTable(filename); dpt.setFileName(filename); Composite prof = dpt.createContents(subfolder); tabDP.setControl(prof); subfolder.setSelection(subfolder.getItemCount() - 1); }
public void buildProfileTab(String filename) { CTabItem tabDP = new CTabItem(folder, SWT.NONE); tabDP.setText("Data Profile"); DataProfileTable dpt = new DataProfileTable(filename); dpt.setFileName(filename); Composite prof = dpt.createContents(folder); tabDP.setControl(prof); folder.setSelection(folder.getItemCount() - 1); }
/** * @param word Root word * @param filename Filename */ public void openWiki(final WikiWord word, final String filename) { CTabItem item = new CTabItem(tabFolder, SWT.CLOSE); WikiViewer viewer = new WikiViewer(tabFolder); viewer.setWiki(word, filename); viewer.addModificationListener(new WikiViewerModificationListener()); item.setText(viewer.getTitle()); item.setControl(viewer); tabItemMap.put(viewer, item); tabFolder.setSelection(item); ActionManager.getPrintAction().setEnabled(true); ActionManager.getNewWikiWordAction().setEnabled(true); }
/* (non-Javadoc) * @see org.eclipse.ui.IPresentationPreview#createControl(org.eclipse.swt.widgets.Composite, org.eclipse.ui.themes.ITheme) */ public void createControl(Composite parent, ITheme currentTheme) { this.theme = currentTheme; folder = new CTabFolder(parent, SWT.BORDER); folder.setUnselectedCloseVisible(false); folder.setEnabled(false); folder.setMaximizeVisible(true); folder.setMinimizeVisible(true); viewForm = new ViewForm(folder, SWT.NONE); viewForm.marginHeight = 0; viewForm.marginWidth = 0; viewForm.verticalSpacing = 0; viewForm.setBorderVisible(false); toolBar = new ToolBar(viewForm, SWT.FLAT | SWT.WRAP); ToolItem toolItem = new ToolItem(toolBar, SWT.PUSH); Image hoverImage = WorkbenchImages.getImage(IWorkbenchGraphicConstants.IMG_LCL_VIEW_MENU); toolItem.setImage(hoverImage); viewForm.setTopRight(toolBar); viewMessage = new CLabel(viewForm, SWT.NONE); viewMessage.setText("Etu?"); // $NON-NLS-1$ viewForm.setTopLeft(viewMessage); CTabItem item = new CTabItem(folder, SWT.CLOSE); item.setText("Lorem"); // $NON-NLS-1$ Label text = new Label(viewForm, SWT.NONE); viewForm.setContent(text); text.setText("Lorem ipsum dolor sit amet"); // $NON-NLS-1$ text.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE)); item = new CTabItem(folder, SWT.CLOSE); item.setText("Ipsum"); // $NON-NLS-1$ item.setControl(viewForm); item.setImage(WorkbenchImages.getImage(ISharedImages.IMG_TOOL_COPY)); folder.setSelection(item); item = new CTabItem(folder, SWT.CLOSE); item.setText("Dolor"); // $NON-NLS-1$ item = new CTabItem(folder, SWT.CLOSE); item.setText("Sit"); // $NON-NLS-1$ currentTheme.addPropertyChangeListener(fontAndColorListener); setColorsAndFonts(); setTabPosition(); setTabStyle(); }
public static void init(ActionContext actionContext) { // 获取所有笔记 List<DataObject> notes = DataObjectUtil.query( "xworker.app.assistor.note.dataobjects.Note", new HashMap<String, Object>(), actionContext); for (DataObject note : notes) { updateItem(note, actionContext); } CTabFolder tabFolder = (CTabFolder) actionContext.get("tabFolder"); if (tabFolder.getItemCount() > 0) { tabFolder.setSelection(0); } }
public void buildTab(String filename, String resType, CTabFolder subfolder) { System.out.println("buildTab"); CTabItem tab2 = new CTabItem(subfolder, SWT.NONE); tab2.setText(resType); Table table = new Table(subfolder, SWT.VIRTUAL | SWT.BORDER); table.setLinesVisible(true); table.setHeaderVisible(true); table.clearAll(); GridData data = new GridData(SWT.FILL, SWT.FILL, true, true); data.heightHint = 200; table.setLayoutData(data); openFile(filename, table); tab2.setControl(table); System.out.println("BUILDSUBTAB--------" + subfolder.indexOf(tab2)); subfolder.setSelection(subfolder.indexOf(tab2)); }
/** ftang Comment method "handleErrorOutput". */ protected void handleErrorOutput( Composite outputComposite, CTabFolder tabFolder, CTabItem outputTabItem, Exception... e) { // Dispose all existing controls. if (!outputComposite.isDisposed()) { Control[] children = outputComposite.getChildren(); for (Control control : children) { if (!control.isDisposed()) { control.dispose(); } } } Font font = new Font(Display.getDefault(), "courier", 8, SWT.NONE); // $NON-NLS-1$ StyledText text = new StyledText(outputComposite, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.READ_ONLY); GridData gridData = new GridData(GridData.FILL_BOTH); text.setLayoutData(gridData); outputComposite.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE)); Exception exception = getException(); if (e != null && e.length == 1) { exception = e[0]; } String errorInfo = exception.getMessage() + "\n"; // $NON-NLS-1$ errorInfo = errorInfo + Messages.getString("FileStep2.previewFailure") + "\n"; //$NON-NLS-1$ //$NON-NLS-2$ StackTraceElement[] stackTrace = exception.getStackTrace(); for (StackTraceElement stackTraceElement : stackTrace) { errorInfo = errorInfo + stackTraceElement.toString() + "\n"; // $NON-NLS-1$ } text.setText(errorInfo); text.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED)); text.setFont(font); tabFolder.setSelection(outputTabItem); outputComposite.layout(true); }
/** Copy information from the meta-data input to the dialog fields. */ public void getData() { wStepname.selectAll(); wFieldname.setText(Const.NVL(mappingMeta.getFieldName(), "")); wExecuteForEachRow.setSelection(mappingMeta.getExecuteForEachRow()); // Add the parameters tab addParametersTab(mappingParameters); wTabFolder.setSelection(0); // Now add the input stream tabs: where is our data coming from? for (int i = 0; i < inputMappings.size(); i++) { addInputMappingDefinitionTab(inputMappings.get(i), i); } // Now add the output stream tabs: where is our data going to? for (int i = 0; i < outputMappings.size(); i++) { addOutputMappingDefinitionTab(outputMappings.get(i), i); } }
public OpenFile2( Shell shell, String programTitle, CTabFolder tabFolder, CommandCenter commandCenter, Display display) throws Exception { FileDialog fd = new FileDialog(shell, SWT.OPEN); fd.setText("Open"); fd.setFilterPath("./input/"); String[] filterExt = {"*.txt", "*.doc", "*.rtf", "*.*"}; fd.setFilterExtensions(filterExt); String selected = fd.open(); if (selected != null) { String fileName = selected; shell.setText(programTitle + " - " + fileName); ReadFile readFile = new ReadFile(fileName); MSA structure = new MSA(fileName); structure = readFile.getStructure(); System.out.println(structure.getName()); for (CTabItem tabItem : tabFolder.getItems()) { if (tabItem.getText().equals(structure.getName())) { throw new SameObjectException(); } } Worksheet worksheet = new Worksheet(structure, tabFolder, commandCenter, shell, display); tabFolder.setSelection(worksheet); } else { System.out.println("Open File canceled by ESC key"); } }
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; }
public void display() throws Exception { /* * Create the display and shell. */ display = new Display(); final Shell shell = new Shell(display); GridLayout layout = new GridLayout(); layout.marginWidth = 0; layout.marginHeight = 0; layout.verticalSpacing = 3; shell.setLayout(layout); /* * Create a toolbar */ { ToolBar toolbar = new ToolBar(shell, SWT.FLAT | SWT.RIGHT | SWT.NO_FOCUS); toolbar.setForeground(display.getSystemColor(SWT.COLOR_RED)); toolbar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL)); ToolItem item = new ToolItem(toolbar, SWT.PUSH); item.setText("File"); item = new ToolItem(toolbar, SWT.PUSH); item.setText("Edit"); item = new ToolItem(toolbar, SWT.PUSH); item.setText("Help"); } if (styleSheetStream == null) { // Create Styles themes createThemesStyleComposite(shell); } /* * Create a sash form. */ SashForm form = new SashForm(shell, SWT.NONE); form.setLayoutData(new GridData(GridData.FILL_BOTH)); /* * Create the buddylist tree. */ { tree = new Tree(form, SWT.SINGLE); tree.addSelectionListener( new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { if (((TreeItem) e.item).getParentItem() != null) { try { createChatControl(e.item); } catch (Exception ex) { ex.printStackTrace(); } } } public void widgetSelected(SelectionEvent e) {} }); for (int i = 0; i < GROUPS.length; i++) { String g = GROUPS[i]; TreeItem parentItem = new TreeItem(tree, SWT.NONE); parentItem.setText(g); for (int j = 0; j < NAMES.length; j++) { String n = NAMES[j]; TreeItem item = new TreeItem(parentItem, SWT.NONE); item.setText(n); } parentItem.setExpanded(true); } } /* * Add the tabfolder */ { tabFolder = new CTabFolder(form, SWT.CLOSE); tabFolder.setUnselectedCloseVisible(true); tabFolder.setUnselectedImageVisible(true); form.setWeights(new int[] {30, 70}); // open a couple chats createChatControl(tree.getItem(0).getItems()[0]); createChatControl(tree.getItem(0).getItems()[1]); tabFolder.setSelection(tabFolder.getItem(0)); } /* * Create a statusbar */ { CLabel statusbar = new CLabel(shell, SWT.NONE); GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); statusbar.setLayoutData(gd); statusbar.setText("Samantha Daryn is online"); } /* * StyleHelper is used to parse and apply styles. */ engine = getCSSEngine(); if (styleSheetStream != null) { engine.parseStyleSheet(styleSheetStream); engine.applyStyles(shell, true); } /* * Now we open the shell. */ shell.setSize(new Point(600, 600)); shell.open(); shell.setText("CSS Instant Messaging"); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
private Composite createForm( Composite parent, EMFDataBindingContext context, WritableValue master) { CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); CTabItem item = new CTabItem(folder, SWT.NONE); item.setText(Messages.ModelTooling_Common_TabDefault); parent = createScrollableContainer(folder); item.setControl(parent.getParent()); { viewer = new TableViewer(parent); ObservableListContentProvider cp = new ObservableListContentProvider(); viewer.setContentProvider(cp); GridData gd = new GridData(GridData.FILL_BOTH); viewer.getControl().setLayoutData(gd); viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); GridLayout gl = new GridLayout(); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; gl.marginHeight = 0; buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Up); b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (!viewer.getSelection().isEmpty()) { IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); if (s.size() == 1) { Object obj = s.getFirstElement(); MHandledItem container = (MHandledItem) getMaster().getValue(); int idx = container.getParameters().indexOf(obj) - 1; if (idx >= 0) { Command cmd = MoveCommand.create( getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS, obj, idx); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); viewer.setSelection(new StructuredSelection(obj)); } } } } } }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Down); b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_down)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (!viewer.getSelection().isEmpty()) { IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); if (s.size() == 1) { Object obj = s.getFirstElement(); MHandledItem container = (MHandledItem) getMaster().getValue(); int idx = container.getParameters().indexOf(obj) + 1; if (idx < container.getParameters().size()) { Command cmd = MoveCommand.create( getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS, obj, idx); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); viewer.setSelection(new StructuredSelection(obj)); } } } } } }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_AddEllipsis); b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { handleAdd(); } }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Remove); b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (!viewer.getSelection().isEmpty()) { List<?> handlers = ((IStructuredSelection) viewer.getSelection()).toList(); Command cmd = RemoveCommand.create( getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS, handlers); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } } } }); } folder.setSelection(0); return folder; }
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; }
protected void createBottomTable(Composite parent) { SashForm sash = new SashForm(parent, SWT.HORIZONTAL); // folder CTabFolder folder = new CTabFolder(sash, SWT.BORDER); // latest latest = new SecurityDetailsViewer(sash, SWT.BORDER, getClient()); latest.getControl().pack(); int width = latest.getControl().getBounds().width; sash.setWeights(new int[] {parent.getParent().getParent().getBounds().width - width, width}); // tab 1: chart CTabItem item = new CTabItem(folder, SWT.NONE); item.setText(Messages.SecurityTabChart); Composite chartComposite = new Composite(folder, SWT.NONE); GridLayoutFactory.fillDefaults().numColumns(2).spacing(0, 0).applyTo(chartComposite); item.setControl(chartComposite); chart = new TimelineChart(chartComposite); chart.getTitle().setText("..."); // $NON-NLS-1$ GridDataFactory.fillDefaults().grab(true, true).applyTo(chart); Composite buttons = new Composite(chartComposite, SWT.NONE); buttons.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE)); GridDataFactory.fillDefaults().grab(false, true).applyTo(buttons); RowLayoutFactory.fillDefaults().type(SWT.VERTICAL).spacing(2).fill(true).applyTo(buttons); addButton(buttons, Messages.SecurityTabChart1M, Calendar.MONTH, -1); addButton(buttons, Messages.SecurityTabChart2M, Calendar.MONTH, -2); addButton(buttons, Messages.SecurityTabChart6M, Calendar.MONTH, -6); addButton(buttons, Messages.SecurityTabChart1Y, Calendar.YEAR, -1); addButton(buttons, Messages.SecurityTabChart2Y, Calendar.YEAR, -2); addButton(buttons, Messages.SecurityTabChart3Y, Calendar.YEAR, -3); addButton(buttons, Messages.SecurityTabChart5Y, Calendar.YEAR, -5); addButton(buttons, Messages.SecurityTabChart10Y, Calendar.YEAR, -10); Button button = new Button(buttons, SWT.FLAT); button.setText(Messages.SecurityTabChartAll); button.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { chartPeriod = null; Security security = (Security) prices.getData(Security.class.toString()); updateChart(security); } }); // tab 2: historical quotes item = new CTabItem(folder, SWT.NONE); item.setText(Messages.SecurityTabHistoricalQuotes); item.setControl(createPricesTable(folder)); // tab 3: transactions item = new CTabItem(folder, SWT.NONE); item.setText(Messages.SecurityTabTransactions); item.setControl(createTransactionTable(folder)); folder.setSelection(0); }
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(); } }; 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; }
private Composite createForm( Composite parent, final EMFDataBindingContext context, WritableValue master, boolean isImport) { CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM); CTabItem item = new CTabItem(folder, SWT.NONE); item.setText(Messages.ModelTooling_Common_TabDefault); parent = createScrollableContainer(folder); item.setControl(parent.getParent()); if (getEditor().isShowXMIId() || getEditor().isLiveModel()) { ControlFactory.createXMIId(parent, this); } IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); if (isImport) { ControlFactory.createFindImport(parent, Messages, this, context); folder.setSelection(0); return folder; } ControlFactory.createTextField( parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value( getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)); ControlFactory.createTextField( parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value( getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE)); ControlFactory.createSelectedElement( parent, this, context, Messages.PerspectiveStackEditor_SelectedElement); // ------------------------------------------------------------ { Label l = new Label(parent, SWT.NONE); l.setText(Messages.PerspectiveStackEditor_Perspectives); l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); final TableViewer viewer = new TableViewer(parent); viewer.setContentProvider(new ObservableListContentProvider()); viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); GridData gd = new GridData(GridData.FILL_BOTH); viewer.getControl().setLayoutData(gd); IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); viewer.setInput(prop.observeDetail(getMaster())); Composite buttonComp = new Composite(parent, SWT.NONE); buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); GridLayout gl = new GridLayout(); gl.marginLeft = 0; gl.marginRight = 0; gl.marginWidth = 0; gl.marginHeight = 0; buttonComp.setLayout(gl); Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Up); b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_up)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (!viewer.getSelection().isEmpty()) { IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); if (s.size() == 1) { Object obj = s.getFirstElement(); MElementContainer<?> container = (MElementContainer<?>) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) - 1; if (idx >= 0) { if (Util.moveElementByIndex( getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx)) { viewer.setSelection(new StructuredSelection(obj)); } } } } } }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Down); b.setImage(createImage(ResourceProvider.IMG_Obj16_arrow_down)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (!viewer.getSelection().isEmpty()) { IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); if (s.size() == 1) { Object obj = s.getFirstElement(); MElementContainer<?> container = (MElementContainer<?>) getMaster().getValue(); int idx = container.getChildren().indexOf(obj) + 1; if (idx < container.getChildren().size()) { if (Util.moveElementByIndex( getEditingDomain(), (MUIElement) obj, getEditor().isLiveModel(), idx)) { viewer.setSelection(new StructuredSelection(obj)); } } } } } }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setImage(createImage(ResourceProvider.IMG_Obj16_table_add)); b.setText(Messages.ModelTooling_Common_AddEllipsis); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { handleAddPerspective(); } }); b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); b.setText(Messages.ModelTooling_Common_Remove); b.setImage(createImage(ResourceProvider.IMG_Obj16_table_delete)); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); b.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (!viewer.getSelection().isEmpty()) { List<?> elements = ((IStructuredSelection) viewer.getSelection()).toList(); Command cmd = RemoveCommand.create( getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, elements); if (cmd.canExecute()) { getEditingDomain().getCommandStack().execute(cmd); } } } }); } ControlFactory.createCheckBox( parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value( getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); ControlFactory.createCheckBox( parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); item = new CTabItem(folder, SWT.NONE); item.setText(Messages.ModelTooling_Common_TabSupplementary); parent = createScrollableContainer(folder); item.setControl(parent.getParent()); ControlFactory.createStringListWidget( parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); ControlFactory.createMapProperties( parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT); if (project == null) { createUITreeInspection(folder); } folder.setSelection(0); return folder; }
private void createCImageArea(CTabFolder tabFolder, final EditorImageSet editorImage) { CTabItem cimageItem = new CTabItem(tabFolder, SWT.FILL); cimageItem.setText("图像"); tabFolder.setSelection(cimageItem); // line Composite container = new Composite(tabFolder, SWT.FILL); GridLayout gridLayout = new GridLayout(); gridLayout.numColumns = 3; container.setLayout(gridLayout); cimageItem.setControl(container); Label label = new Label(container, SWT.NONE); label.setText("物理编号"); indexSpinner = new Spinner(container, SWT.BORDER); indexSpinner.setMinimum(0); indexSpinner.setMaximum(editorImage.getImageCount()); indexSpinner.addModifyListener(new IndexListener(editorImage)); image = new Label(container, SWT.NONE); // line final Label countLabel = new Label(container, SWT.NONE); countLabel.setText("图片总数:" + editorImage.getImageCount()); Button importButton = new Button(container, SWT.NONE); importButton.setText("导入"); importButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent se) { if (imageDialog == null) { imageDialog = new FileDialog(getSite().getShell(), SWT.OPEN | SWT.MULTI); String[] types = new String[IMAGE_FILE_TYPES.length]; for (int i = 0; i < IMAGE_FILE_TYPES.length; i++) { types[i] = "*." + IMAGE_FILE_TYPES[i]; } imageDialog.setFilterExtensions(types); } imageDialog.open(); String[] fileNames = imageDialog.getFileNames(); // 返回所有选择的文件名,不包括路径 if (fileNames != null && fileNames.length > 0) { String path = imageDialog.getFilterPath(); // 返回选择的路径 File parent = new File(path); int index = editorImage.getImageCount(); try { for (int i = 0; i < fileNames.length; i++) { File file = new File(parent, fileNames[i]); editorImage.addBufferedImage(file); } } catch (Exception e) { CrossGateEditor.getLog().error(getClass().getName(), e); } indexSpinner.setMaximum(editorImage.getImageCount()); indexSpinner.setSelection(index); countLabel.setText("图片总数:" + editorImage.getImageCount()); indexSpinner.setSize(80, indexSpinner.getBounds().height); countLabel.setSize(100, indexSpinner.getBounds().height); } } }); label = new Label(container, SWT.NONE); // fill // line imageWidth = new Label(container, SWT.NONE); imageWidth.setText("图片宽度: "); label = new Label(container, SWT.NONE); // fill label = new Label(container, SWT.NONE); // fill imageHeight = new Label(container, SWT.NONE); imageHeight.setText("图片高度: "); label = new Label(container, SWT.NONE); // fill label = new Label(container, SWT.NONE); // fill label = new Label(container, SWT.NONE); label.setText("占东面积:"); useEast = new Text(container, SWT.BORDER); useEast.addModifyListener(this); label = new Label(container, SWT.NONE); // fill label = new Label(container, SWT.NONE); label.setText("占南面积:"); useSouth = new Text(container, SWT.BORDER); useSouth.addModifyListener(this); label = new Label(container, SWT.NONE); // fill label = new Label(container, SWT.NONE); label.setText("X偏移:"); offsetX = new Text(container, SWT.BORDER); offsetX.addModifyListener(this); label = new Label(container, SWT.NONE); // fill label = new Label(container, SWT.NONE); label.setText("Y偏移:"); offsetY = new Text(container, SWT.BORDER); offsetY.addModifyListener(this); label = new Label(container, SWT.NONE); // fill label = new Label(container, SWT.NONE); label.setText("全局索引:"); globalId = new Text(container, SWT.BORDER); globalId.addModifyListener(this); label = new Label(container, SWT.NONE); // fill isObstacle = new Button(container, SWT.CHECK); isObstacle.setText("是否阻挡"); isObstacle.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { setDirty(true); } }); color = new Label(container, SWT.NONE); color.setText("调色板: "); label = new Label(container, SWT.NONE); // fill Button exportButton = new Button(container, SWT.NONE); exportButton.setText("导出bin"); exportButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent se) { try { editorImage.output(new File(CrossGateEditor.getClientFilePath())); } catch (Exception e) { CrossGateEditor.getLog().error(getClass().getName(), e); MessageDialog.openError( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "错误", e.getMessage()); } } }); exportButton.setEnabled(!editorImage.readOnly()); Button exportImageButton = new Button(container, SWT.NONE); exportImageButton.setText("导出图片"); exportImageButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent se) { ExportImageDialog dialog = new ExportImageDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), IMAGE_FILE_TYPES); if (dialog.open() != Dialog.OK) { return; } File path = new File(dialog.getPath()); String type = dialog.getSuffix(); int count = dialog.getCount(), imageCount = editorImage.getImageCount(); try { if (!path.exists()) { path.mkdirs(); } for (int i = 0; i < count; i++) { int index = indexSpinner.getSelection(); if (index + i < imageCount) { ImageDictionary imageDictionary = editorImage.select(index + i); File file = new File( path, imageDictionary.getVersion() + "_" + imageDictionary.getResourceId() + "." + type); if (!file.exists()) { file.createNewFile(); } ImageIO.write(imageDictionary.bufferedImage(), type, file); } else { break; } } MessageDialog.openInformation( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "完成", "导出成功。"); } catch (IOException e) { CrossGateEditor.getLog().error(getClass().getName(), e); MessageDialog.openError( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "错误", "越界:" + e.getMessage()); } } }); // show(editorImage, 0); }
public void setActivePage(Composite container, int pageIndex) { ((CTabFolder) container).setSelection(pageIndex); }
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; }
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; }
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; }