public void init( INode node, IElementParameter schemaParam, IMetadataTable currentOutputMetadata, IMetadataTable newOutputMetadata) { this.node = node; this.schemaParam = schemaParam; if (schemaParam == null) { if (newOutputMetadata.getAttachedConnector() != null) { currentConnector = newOutputMetadata.getAttachedConnector(); } else { if (node.isELTComponent()) { currentConnector = EConnectionType.TABLE.getName(); } else { currentConnector = EConnectionType.FLOW_MAIN.getName(); } } for (IElementParameter param : node.getElementParameters()) { if (param.getFieldType().equals(EParameterFieldType.SCHEMA_TYPE) && param.getContext().equals(currentConnector)) { this.schemaParam = param; } } } else { currentConnector = this.schemaParam.getContext(); } this.inputNode = null; this.currentInputMetadata = null; this.newInputMetadata = null; oldInputMetadata = null; this.currentOutputMetadata = currentOutputMetadata; if (this.currentOutputMetadata == null) { this.currentOutputMetadata = node.getMetadataFromConnector(currentConnector); } if (currentOutputMetadata == null && newOutputMetadata != null) { currentOutputMetadata = newOutputMetadata.clone(true); } oldOutputMetadata = this.currentOutputMetadata.clone(true); this.newOutputMetadata = newOutputMetadata.clone(true); this.newOutputMetadata.setReadOnly(this.currentOutputMetadata.isReadOnly()); initializeContainer(); setLabel(Messages.getString("ChangeMetadataCommand.changeMetadataValues")); // $NON-NLS-1$ }
public ChangeMetadataCommand( INode node, IElementParameter schemaParam, INode inputNode, IMetadataTable currentInputMetadata, IMetadataTable newInputMetadata, IMetadataTable currentOutputMetadata, IMetadataTable newOutputMetadata) { this.node = node; this.inputNode = inputNode; this.schemaParam = schemaParam; if (schemaParam == null) { currentConnector = EConnectionType.FLOW_MAIN.getName(); for (IElementParameter param : node.getElementParameters()) { if ((param.getFieldType().equals(EParameterFieldType.SCHEMA_TYPE) || param.getFieldType().equals(EParameterFieldType.DCSCHEMA)) && param.getContext().equals(currentConnector)) { this.schemaParam = param; } } } else { currentConnector = this.schemaParam.getContext(); } this.currentInputMetadata = currentInputMetadata; if (currentInputMetadata != null) { oldInputMetadata = currentInputMetadata.clone(); } else { oldInputMetadata = null; } this.newInputMetadata = newInputMetadata; this.currentOutputMetadata = currentOutputMetadata; if (this.currentOutputMetadata == null) { this.currentOutputMetadata = node.getMetadataFromConnector(currentConnector); } oldOutputMetadata = this.currentOutputMetadata.clone(); this.newOutputMetadata = newOutputMetadata; initializeContainer(); setLabel(Messages.getString("ChangeMetadataCommand.changeMetadataValues")); // $NON-NLS-1$ }
@Override public void addComponents(boolean forceRedraw) { if (conSchema()) { disposeChildren(); curRowSize = 0; List<? extends IElementParameter> listParam = ((Connection) elem).getSource().getElementParameters(); generator.initController(this); for (IElementParameter cur : listParam) { if ((cur.getFieldType() == EParameterFieldType.SCHEMA_TYPE) && (cur.getContext().equals(((Connection) elem).getConnectorName()))) { AbstractElementPropertySectionController contorller = generator.getController(EParameterFieldType.SCHEMA_TYPE, this); contorller.createControl(composite, cur, 0, 0, 0, null); } } FormData data = new FormData(); data.left = new FormAttachment(0, ITabbedPropertyConstants.HSPACE); data.right = new FormAttachment(100, -ITabbedPropertyConstants.HSPACE); data.top = new FormAttachment(0, curRowSize + ITabbedPropertyConstants.VSPACE); data.width = 300; // to correct bug of table growing indefinitly IMetadataTable outputMetaTable = ((Connection) elem).getMetadataTable(); if (outputMetaTable != null) { // Composite compositeEditorView = new Composite(composite, SWT.BORDER); // compositeEditorView.setLayoutData(data); metadataTableEditor = new MetadataTableEditor( outputMetaTable, "Schema from " //$NON-NLS-1$ + ((Connection) elem).getSource().getElementName() + " output "); //$NON-NLS-1$ metadataTableEditorView = new MetadataTableEditorView( composite, SWT.NONE, metadataTableEditor, true, false, true, false); MetadataDialog.initializeMetadataTableView( metadataTableEditorView, ((Connection) elem).getSource(), outputMetaTable); metadataTableEditorView.initGraphicComponents(); metadataTableEditorView.getExtendedTableViewer().setCommandStack(getCommandStack()); CustomTableManager.addCustomManagementToTable(metadataTableEditorView, true); Composite compositeEditorView = metadataTableEditorView.getMainComposite(); compositeEditorView.setLayoutData(data); // compositeEditorView.getParent().layout(); Table table = metadataTableEditorView.getTable(); int currentHeightEditor = table.getHeaderHeight() + outputMetaTable.getListColumns().size() * table.getItemHeight() + table.getItemHeight() + 50; curRowSize = currentHeightEditor + ITabbedPropertyConstants.VSPACE + curRowSize; } super.addComponents(forceRedraw, false); } else if (conIf()) { super.addComponents(forceRedraw); } else { disposeChildren(); } }