private void getTableName() { DatabaseMeta inf = null; // New class: SelectTableDialog int connr = wConnection.getSelectionIndex(); if (connr >= 0) inf = transMeta.getDatabase(connr); if (inf != null) { log.logDebug( toString(), Messages.getString("UpdateDialog.Log.LookingAtConnection") + inf.toString()); // $NON-NLS-1$ DatabaseExplorerDialog std = new DatabaseExplorerDialog(shell, SWT.NONE, inf, transMeta.getDatabases()); std.setSelectedSchema(wSchema.getText()); std.setSelectedTable(wTable.getText()); std.setSplitSchemaAndTable(true); if (std.open() != null) { wSchema.setText(Const.NVL(std.getSchemaName(), "")); wTable.setText(Const.NVL(std.getTableName(), "")); } } else { MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR); mb.setMessage( Messages.getString("UpdateDialog.InvalidConnection.DialogMessage")); // $NON-NLS-1$ mb.setText(Messages.getString("UpdateDialog.InvalidConnection.DialogTitle")); // $NON-NLS-1$ mb.open(); } }
public FormulaMetaFunction(Node calcnode) { fieldName = XMLHandler.getTagValue(calcnode, "field_name"); formula = XMLHandler.getTagValue(calcnode, "formula_string"); valueType = Value.getType(XMLHandler.getTagValue(calcnode, "value_type")); valueLength = Const.toInt(XMLHandler.getTagValue(calcnode, "value_length"), -1); valuePrecision = Const.toInt(XMLHandler.getTagValue(calcnode, "value_precision"), -1); removedFromResult = "Y".equalsIgnoreCase(XMLHandler.getTagValue(calcnode, "remove")); }
private void refreshMappings() { // Refresh the results... wResult.removeAll(); for (int i = 0; i < mappings.size(); i++) { SourceToTargetMapping mapping = (SourceToTargetMapping) mappings.get(i); String mappingString = sourceList[mapping.getSourcePosition()] + " --> " + targetList[mapping.getTargetPosition()]; wResult.add(mappingString); } wSource.removeAll(); // Refresh the sources for (int a = 0; a < sourceList.length; a++) { boolean found = false; if (wSourceHide.getSelection()) { for (int b = 0; b < mappings.size() && !found; b++) { SourceToTargetMapping mapping = (SourceToTargetMapping) mappings.get(b); if (mapping.getSourcePosition() == Const.indexOfString(sourceList[a], sourceList)) { found = true; } } } if (!found) { wSource.add(sourceList[a]); } } wTarget.removeAll(); // Refresh the targets for (int a = 0; a < targetList.length; a++) { boolean found = false; if (wTargetHide.getSelection()) { for (int b = 0; b < mappings.size() && !found; b++) { SourceToTargetMapping mapping = (SourceToTargetMapping) mappings.get(b); if (mapping.getTargetPosition() == Const.indexOfString(targetList[a], targetList)) { found = true; } } } if (!found) { wTarget.add(targetList[a]); } } }
private void add() { if (wSource.getSelectionCount() == 1 && wTarget.getSelectionCount() == 1) { String sourceString = wSource.getSelection()[0]; String targetString = wTarget.getSelection()[0]; int srcIndex = Const.indexOfString(sourceString, sourceList); int tgtIndex = Const.indexOfString(targetString, targetList); if (srcIndex >= 0 && tgtIndex >= 0) { // New mapping: add it to the list... SourceToTargetMapping mapping = new SourceToTargetMapping(srcIndex, tgtIndex); mappings.add(mapping); refreshMappings(); } } }
private void guess() { // Guess the target for all the sources... for (int i = 0; i < sourceList.length; i++) { int idx = Const.indexOfString(sourceList[i], wSource.getItems()); if (idx >= 0) { wSource.select(idx); if (findTarget()) { add(); } } } }
private void getInfo(UpdateMeta inf) { // Table ktable = wKey.table; int nrkeys = wKey.nrNonEmpty(); int nrfields = wReturn.nrNonEmpty(); inf.allocate(nrkeys, nrfields); inf.setCommitSize(Const.toInt(wCommit.getText(), 0)); log.logDebug( toString(), Messages.getString("UpdateDialog.Log.FoundKeys", nrkeys + "")); // $NON-NLS-1$ //$NON-NLS-2$ for (int i = 0; i < nrkeys; i++) { TableItem item = wKey.getNonEmpty(i); inf.getKeyLookup()[i] = item.getText(1); inf.getKeyCondition()[i] = item.getText(2); inf.getKeyStream()[i] = item.getText(3); inf.getKeyStream2()[i] = item.getText(4); } // Table ftable = wReturn.table; log.logDebug( toString(), Messages.getString( "UpdateDialog.Log.FoundFields", nrfields + "")); // $NON-NLS-1$ //$NON-NLS-2$ for (int i = 0; i < nrfields; i++) { TableItem item = wReturn.getNonEmpty(i); inf.getUpdateLookup()[i] = item.getText(1); inf.getUpdateStream()[i] = item.getText(2); } inf.setSchemaName(wSchema.getText()); inf.setTableName(wTable.getText()); inf.setDatabaseMeta(transMeta.findDatabase(wConnection.getText())); inf.setErrorIgnored(wErrorIgnored.getSelection()); inf.setIgnoreFlagField(wIgnoreFlagField.getText()); stepname = wStepname.getText(); // return value }