use of org.talend.designer.dbmap.ui.visualmap.zone.scrollable.TablesZoneView in project tdi-studio-se by Talend.
the class MapperManager method addInputAliasTable.
/**
* DOC amaumont Comment method "addAlias".
*/
public void addInputAliasTable() {
AliasDialog aliasDialog = new AliasDialog(this, tableManager.getPhysicalInputTableNames(), tableManager.getAliases(), tableManager.getVisibleTables());
if (!aliasDialog.open()) {
return;
}
List<IOConnection> incomingConnections = getComponent().getMapperMain().getIoInputConnections();
IOConnection connectionFound = null;
for (IOConnection connection : incomingConnections) {
if (connection.getName().equalsIgnoreCase(aliasDialog.getTableName())) {
connectionFound = connection;
break;
}
}
List<DataMapTableView> inputsTablesView = getUiManager().getInputsTablesView();
int sizeOutputsView = inputsTablesView.size();
Control lastChild = null;
if (sizeOutputsView - 1 >= 0) {
lastChild = inputsTablesView.get(sizeOutputsView - 1);
}
String alias = aliasDialog.getAlias();
//$NON-NLS-1$
boolean isPhysicalTable = alias.equals("") || alias.equalsIgnoreCase(aliasDialog.getTableName());
String aliasOrTableName = isPhysicalTable ? aliasDialog.getTableName() : alias;
IMetadataTable metadataTable = isPhysicalTable ? connectionFound.getTable() : connectionFound.getTable().clone();
boolean isInvisiblePhysicalTable = aliasDialog.isSameAsPhysicalTable(aliasOrTableName) && !aliasDialog.isSameAsVisibleTableName(aliasOrTableName);
InputTable inputTable = new InputTable(this, metadataTable, aliasOrTableName);
if (isInvisiblePhysicalTable) {
inputTable.setAlias(null);
} else {
inputTable.setAlias(aliasOrTableName);
}
inputTable.setTableName(aliasDialog.getTableName());
inputTable.initFromExternalData(null);
TablesZoneView tablesZoneViewInputs = uiManager.getTablesZoneViewInputs();
DataMapTableView dataMapTableView = uiManager.createNewInputTableView(lastChild, inputTable, tablesZoneViewInputs);
tablesZoneViewInputs.setSize(tablesZoneViewInputs.computeSize(SWT.DEFAULT, SWT.DEFAULT));
tablesZoneViewInputs.layout(true, true);
uiManager.moveInputScrollBarZoneToMax();
uiManager.refreshBackground(true, false);
tablesZoneViewInputs.layout();
uiManager.selectDataMapTableView(dataMapTableView, true, false);
uiManager.updateDropDownJoinTypeForInputs();
uiManager.parseAllExpressionsForAllTables();
uiManager.refreshSqlExpression();
getProblemsManager().checkProblemsForAllEntriesOfAllTables(true);
}
Aggregations