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"); } }
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); }
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); }
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); }
private void updateEmptyClassIfNeeded() { CSSClasses tags = CSSClasses.getStyleClasses(tabFolder); boolean haveToSetEmpty = tabFolder.getItemCount() == 0; if (haveToSetEmpty && !tags.contains("empty")) { updateTags.schedule(); updateItems(); } else if (!haveToSetEmpty && !tags.contains("nonEmpty")) { updateTags.schedule(); updateItems(); } }
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 testCreateView() { final MWindow window = createWindowWithOneView(); wb = new E4Workbench(window, appContext); Widget topWidget = (Widget) window.getWidget(); assertTrue(topWidget instanceof Shell); Shell shell = (Shell) topWidget; assertEquals("MyWindow", shell.getText()); Control[] controls = shell.getChildren(); assertEquals(1, controls.length); SashForm sash = (SashForm) controls[0]; Control[] sashChildren = sash.getChildren(); assertEquals(1, sashChildren.length); CTabFolder folder = (CTabFolder) sashChildren[0]; assertEquals(1, folder.getItemCount()); Control c = folder.getItem(0).getControl(); assertTrue(c instanceof Composite); Control[] viewPart = ((Composite) c).getChildren(); assertEquals(1, viewPart.length); assertTrue(viewPart[0] instanceof Tree); }
@Override protected void draw(int part, int state, Rectangle bounds, GC gc) { updateEmptyClassIfNeeded(); if (part == PART_BODY && !isPreviewingTab()) { /* * 7: Editor area - Minimize / maximize look brocken * https://github.com/jeeeyul/eclipse-themes/issues/issue/7 * * Calculated tab height of empty tab seens to cause this problems. */ if (tabFolder.getItemCount() == 0) { if (lastKnownTabHeight < 0) { lastKnownTabHeight = tabFolder.getFont().getFontData()[0].getHeight() + 19; } tabFolder.setTabHeight(lastKnownTabHeight); } else { tabFolder.setTabHeight(-1); lastKnownTabHeight = tabFolder.getTabHeight(); } } super.draw(part, state, bounds, gc); }
public int getPageCount(Composite container) { CTabFolder tabFolder = (CTabFolder) container; return tabFolder.getItemCount(); }
public void buildClusterCountsTab(String thefilename, String resType, CTabFolder subfolder) { System.out.println("buildClusterCountsTab"); ClusterCountsTable table = new ClusterCountsTable(thefilename); table.createContents(subfolder); subfolder.setSelection(subfolder.getItemCount() - 1); }
private void addMappingDefinitionTab( final MappingIODefinition definition, int index, final String tabTitle, final String tabTooltip, String inputStepLabel, String outputStepLabel, String descriptionLabel, String sourceColumnLabel, String targetColumnLabel, final boolean input) { final CTabItem wTab; if (index >= wTabFolder.getItemCount()) { wTab = new CTabItem(wTabFolder, SWT.CLOSE); } else { wTab = new CTabItem(wTabFolder, SWT.CLOSE, index); } setMappingDefinitionTabNameAndToolTip(wTab, tabTitle, tabTooltip, definition, input); Composite wInputComposite = new Composite(wTabFolder, SWT.NONE); props.setLook(wInputComposite); FormLayout tabLayout = new FormLayout(); tabLayout.marginWidth = Const.FORM_MARGIN; tabLayout.marginHeight = Const.FORM_MARGIN; wInputComposite.setLayout(tabLayout); // What's the stepname to read from? (empty is OK too) // Button wbInputStep = new Button(wInputComposite, SWT.PUSH); props.setLook(wbInputStep); wbInputStep.setText(Messages.getString("MappingFieldRunnerDialog.button.SourceStepName")); FormData fdbInputStep = new FormData(); fdbInputStep.top = new FormAttachment(0, 0); fdbInputStep.right = new FormAttachment(100, 0); // First one in the // left top corner wbInputStep.setLayoutData(fdbInputStep); Label wlInputStep = new Label(wInputComposite, SWT.RIGHT); props.setLook(wlInputStep); wlInputStep.setText(inputStepLabel); // $NON-NLS-1$ FormData fdlInputStep = new FormData(); fdlInputStep.top = new FormAttachment(wbInputStep, 0, SWT.CENTER); fdlInputStep.left = new FormAttachment(0, 0); // First one in the left // top corner fdlInputStep.right = new FormAttachment(middle, -margin); wlInputStep.setLayoutData(fdlInputStep); final Text wInputStep = new Text(wInputComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wInputStep); wInputStep.setText(Const.NVL(definition.getInputStepname(), "")); wInputStep.addModifyListener(lsMod); FormData fdInputStep = new FormData(); fdInputStep.top = new FormAttachment(wbInputStep, 0, SWT.CENTER); fdInputStep.left = new FormAttachment(middle, 0); // To the right of // the label fdInputStep.right = new FormAttachment(wbInputStep, -margin); wInputStep.setLayoutData(fdInputStep); wInputStep.addFocusListener( new FocusAdapter() { @Override public void focusLost(FocusEvent event) { definition.setInputStepname(wInputStep.getText()); setMappingDefinitionTabNameAndToolTip(wTab, tabTitle, tabTooltip, definition, input); } }); wbInputStep.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { String stepName = selectTransformationStepname(input, input); if (stepName != null) { wInputStep.setText(stepName); definition.setInputStepname(stepName); setMappingDefinitionTabNameAndToolTip(wTab, tabTitle, tabTooltip, definition, input); } } }); // What's the step name to read from? (empty is OK too) // Button wbOutputStep = new Button(wInputComposite, SWT.PUSH); props.setLook(wbOutputStep); wbOutputStep.setText(Messages.getString("MappingFieldRunnerDialog.button.SourceStepName")); FormData fdbOutputStep = new FormData(); fdbOutputStep.top = new FormAttachment(wbInputStep, margin); fdbOutputStep.right = new FormAttachment(100, 0); wbOutputStep.setLayoutData(fdbOutputStep); Label wlOutputStep = new Label(wInputComposite, SWT.RIGHT); props.setLook(wlOutputStep); wlOutputStep.setText(outputStepLabel); // $NON-NLS-1$ FormData fdlOutputStep = new FormData(); fdlOutputStep.top = new FormAttachment(wbOutputStep, 0, SWT.CENTER); fdlOutputStep.left = new FormAttachment(0, 0); fdlOutputStep.right = new FormAttachment(middle, -margin); wlOutputStep.setLayoutData(fdlOutputStep); final Text wOutputStep = new Text(wInputComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wOutputStep); wOutputStep.setText(Const.NVL(definition.getOutputStepname(), "")); wOutputStep.addModifyListener(lsMod); FormData fdOutputStep = new FormData(); fdOutputStep.top = new FormAttachment(wbOutputStep, 0, SWT.CENTER); fdOutputStep.left = new FormAttachment(middle, 0); // To the right of // the label fdOutputStep.right = new FormAttachment(wbOutputStep, -margin); wOutputStep.setLayoutData(fdOutputStep); // Add a checkbox to indicate the main step to read from, the main data // path... // Label wlMainPath = new Label(wInputComposite, SWT.RIGHT); props.setLook(wlMainPath); wlMainPath.setText( Messages.getString("MappingFieldRunnerDialog.input.MainDataPath")); // $NON-NLS-1$ FormData fdlMainPath = new FormData(); fdlMainPath.top = new FormAttachment(wbOutputStep, margin); fdlMainPath.left = new FormAttachment(0, 0); fdlMainPath.right = new FormAttachment(middle, -margin); wlMainPath.setLayoutData(fdlMainPath); Button wMainPath = new Button(wInputComposite, SWT.CHECK); props.setLook(wMainPath); FormData fdMainPath = new FormData(); fdMainPath.top = new FormAttachment(wbOutputStep, margin); fdMainPath.left = new FormAttachment(middle, 0); // fdMainPath.right = new FormAttachment(100, 0); // who cares, it's a // checkbox wMainPath.setLayoutData(fdMainPath); wMainPath.setSelection(definition.isMainDataPath()); wMainPath.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { definition.setMainDataPath(!definition.isMainDataPath()); // flip // the // switch } }); // Add a checkbox to indicate that all output mappings need to rename // the values back... // Label wlRenameOutput = new Label(wInputComposite, SWT.RIGHT); props.setLook(wlRenameOutput); wlRenameOutput.setText( Messages.getString("MappingFieldRunnerDialog.input.RenamingOnOutput")); // $NON-NLS-1$ FormData fdlRenameOutput = new FormData(); fdlRenameOutput.top = new FormAttachment(wMainPath, margin); fdlRenameOutput.left = new FormAttachment(0, 0); fdlRenameOutput.right = new FormAttachment(middle, -margin); wlRenameOutput.setLayoutData(fdlRenameOutput); Button wRenameOutput = new Button(wInputComposite, SWT.CHECK); props.setLook(wRenameOutput); FormData fdRenameOutput = new FormData(); fdRenameOutput.top = new FormAttachment(wMainPath, margin); fdRenameOutput.left = new FormAttachment(middle, 0); // fdRenameOutput.right = new FormAttachment(100, 0); // who cares, it's // a check box wRenameOutput.setLayoutData(fdRenameOutput); wRenameOutput.setSelection(definition.isRenamingOnOutput()); wRenameOutput.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { definition.setRenamingOnOutput(!definition.isRenamingOnOutput()); // flip // the // switch } }); // Allow for a small description // Label wlDescription = new Label(wInputComposite, SWT.RIGHT); props.setLook(wlDescription); wlDescription.setText(descriptionLabel); // $NON-NLS-1$ FormData fdlDescription = new FormData(); fdlDescription.top = new FormAttachment(wRenameOutput, margin); fdlDescription.left = new FormAttachment(0, 0); // First one in the left // top corner fdlDescription.right = new FormAttachment(middle, -margin); wlDescription.setLayoutData(fdlDescription); final Text wDescription = new Text(wInputComposite, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); props.setLook(wDescription); wDescription.setText(Const.NVL(definition.getDescription(), "")); wDescription.addModifyListener(lsMod); FormData fdDescription = new FormData(); fdDescription.top = new FormAttachment(wRenameOutput, margin); fdDescription.bottom = new FormAttachment(wRenameOutput, 100 + margin); fdDescription.left = new FormAttachment(middle, 0); // To the right of // the label fdDescription.right = new FormAttachment(wbOutputStep, -margin); wDescription.setLayoutData(fdDescription); wDescription.addFocusListener( new FocusAdapter() { @Override public void focusLost(FocusEvent event) { definition.setDescription(wDescription.getText()); } }); // Now add a table view with the 2 columns to specify: input and output // fields for the source and target steps. // final Button wbEnterMapping = new Button(wInputComposite, SWT.PUSH); props.setLook(wbEnterMapping); wbEnterMapping.setText(Messages.getString("MappingFieldRunnerDialog.button.EnterMapping")); FormData fdbEnterMapping = new FormData(); fdbEnterMapping.top = new FormAttachment(wDescription, margin * 2); fdbEnterMapping.right = new FormAttachment(100, 0); // First one in the // left top corner wbEnterMapping.setLayoutData(fdbEnterMapping); ColumnInfo[] colinfo = new ColumnInfo[] { new ColumnInfo( sourceColumnLabel, ColumnInfo.COLUMN_TYPE_TEXT, false, false), // $NON-NLS-1$ new ColumnInfo( targetColumnLabel, ColumnInfo.COLUMN_TYPE_TEXT, false, false), // $NON-NLS-1$ }; final TableView wFieldMappings = new TableView( transMeta, wInputComposite, SWT.FULL_SELECTION | SWT.SINGLE | SWT.BORDER, colinfo, 1, lsMod, props); props.setLook(wFieldMappings); FormData fdMappings = new FormData(); fdMappings.left = new FormAttachment(0, 0); fdMappings.right = new FormAttachment(wbEnterMapping, -margin); fdMappings.top = new FormAttachment(wDescription, margin * 2); fdMappings.bottom = new FormAttachment(100, -20); wFieldMappings.setLayoutData(fdMappings); for (MappingValueRename valueRename : definition.getValueRenames()) { TableItem tableItem = new TableItem(wFieldMappings.table, SWT.NONE); tableItem.setText(1, valueRename.getSourceValueName()); tableItem.setText(2, valueRename.getTargetValueName()); } wFieldMappings.removeEmptyRows(); wFieldMappings.setRowNums(); wFieldMappings.optWidth(true); wbEnterMapping.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent arg0) { try { RowMetaInterface sourceRowMeta = getFieldsFromStep(wInputStep.getText(), true, input); RowMetaInterface targetRowMeta = getFieldsFromStep(wOutputStep.getText(), false, input); String sourceFields[] = sourceRowMeta.getFieldNames(); String targetFields[] = targetRowMeta.getFieldNames(); EnterMappingDialog dialog = new EnterMappingDialog(shell, sourceFields, targetFields); List<SourceToTargetMapping> mappings = dialog.open(); if (mappings != null) { // first clear the dialog... wFieldMappings.clearAll(false); // definition.getValueRenames().clear(); // Now add the new values... for (int i = 0; i < mappings.size(); i++) { SourceToTargetMapping mapping = mappings.get(i); TableItem item = new TableItem(wFieldMappings.table, SWT.NONE); item.setText(1, mapping.getSourceString(sourceFields)); item.setText(2, mapping.getTargetString(targetFields)); String source = input ? item.getText(1) : item.getText(2); String target = input ? item.getText(2) : item.getText(1); definition.getValueRenames().add(new MappingValueRename(source, target)); } wFieldMappings.removeEmptyRows(); wFieldMappings.setRowNums(); wFieldMappings.optWidth(true); } } catch (KettleException e) { new ErrorDialog( shell, Messages.getString("System.Dialog.Error.Title"), Messages.getString( "MappingFieldRunnerDialog.Exception.ErrorGettingMappingSourceAndTargetFields", e.toString()), e); } } }); wOutputStep.addFocusListener( new FocusAdapter() { @Override public void focusLost(FocusEvent event) { definition.setOutputStepname(wOutputStep.getText()); try { enableMappingButton( wbEnterMapping, input, wInputStep.getText(), wOutputStep.getText()); } catch (KettleException e) { // Show the missing/wrong step name error // new ErrorDialog(shell, "Error", "Unexpected error", e); } } }); wbOutputStep.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { String stepName = selectTransformationStepname(!input, input); if (stepName != null) { wOutputStep.setText(stepName); definition.setOutputStepname(stepName); try { enableMappingButton( wbEnterMapping, input, wInputStep.getText(), wOutputStep.getText()); } catch (KettleException e) { // Show the missing/wrong stepname error new ErrorDialog(shell, "Error", "Unexpected error", e); } } } }); FormData fdParametersComposite = new FormData(); fdParametersComposite.left = new FormAttachment(0, 0); fdParametersComposite.top = new FormAttachment(0, 0); fdParametersComposite.right = new FormAttachment(100, 0); fdParametersComposite.bottom = new FormAttachment(100, 0); wInputComposite.setLayoutData(fdParametersComposite); wInputComposite.layout(); wTab.setControl(wInputComposite); final ApplyChanges applyChanges = new MappingDefinitionTab( definition, wInputStep, wOutputStep, wMainPath, wDescription, wFieldMappings); changeList.add(applyChanges); // OK, suppose for some weird reason the user wants to remove an input // or output tab... wTabFolder.addCTabFolder2Listener( new CTabFolder2Adapter() { @Override public void close(CTabFolderEvent event) { if (event.item.equals(wTab)) { // The user has the audacity to try and close this mapping // definition tab. // We really should warn him that this is a bad idea... MessageBox box = new MessageBox(shell, SWT.YES | SWT.NO); box.setText( Messages.getString( "MappingFieldRunnerDialog.CloseDefinitionTabAreYouSure.Title")); box.setMessage( Messages.getString( "MappingFieldRunnerDialog.CloseDefinitionTabAreYouSure.Message")); int answer = box.open(); if (answer != SWT.YES) { event.doit = false; } else { // Remove it from our list to make sure it's gone... if (input) inputMappings.remove(definition); else outputMappings.remove(definition); // remove it from the changeList too... // Otherwise the dialog leaks memory. // changeList.remove(applyChanges); } } } }); wTabFolder.setSelection(wTab); }