use of org.talend.designer.mapper.ui.visualmap.table.DataMapTableView in project tdi-studio-se by Talend.
the class TableEntriesManager method retrieveTableItem.
TableItem retrieveTableItem(ITableEntry dataMapTableEntry) {
DataMapTableView dataMapTableView = this.mapperManager.retrieveAbstractDataMapTableView(dataMapTableEntry.getParent());
TableItem[] tableItems = new TableItem[0];
if (dataMapTableEntry instanceof IColumnEntry) {
tableItems = dataMapTableView.getTableViewerCreatorForColumns().getTable().getItems();
} else if (dataMapTableEntry instanceof FilterTableEntry) {
tableItems = dataMapTableView.getTableViewerCreatorForFilters().getTable().getItems();
} else if (dataMapTableEntry instanceof GlobalMapEntry) {
tableItems = dataMapTableView.getTableViewerCreatorForGlobalMap().getTable().getItems();
} else if (dataMapTableEntry instanceof ExpressionFilterEntry) {
return null;
} else {
//$NON-NLS-1$
throw new IllegalArgumentException(Messages.getString("TableEntriesManager.exceptionMessage.caseNotFound"));
}
TableItem tableItem = null;
for (int i = 0; i < tableItems.length; i++) {
if (tableItems[i].getData() == dataMapTableEntry) {
tableItem = tableItems[i];
break;
}
}
getTableEntryProperties(dataMapTableEntry).setTableItem(tableItem);
return tableItem;
}
use of org.talend.designer.mapper.ui.visualmap.table.DataMapTableView in project tdi-studio-se by Talend.
the class TableManager method removeTable.
/**
* DOC amaumont Comment method "removeTable".
*
* @param data
*/
Object removeTable(IDataMapTable data) {
getMatchedList(data).remove(data);
DataMapTableView view = abstractDataMapTableToView.remove(data);
swtTableToView.remove(view.getTableViewerCreatorForColumns().getTable());
swtTableToView.remove(view.getExpressionFilterText());
swtTableToView.remove(view.getColumnNameFilterText());
if (view.getTableViewerCreatorForFilters() != null) {
swtTableToView.remove(view.getTableViewerCreatorForFilters().getTable());
}
return view;
}
use of org.talend.designer.mapper.ui.visualmap.table.DataMapTableView in project tdi-studio-se by Talend.
the class MapperManager method retrieveTableViewerCreator.
public TableViewerCreator retrieveTableViewerCreator(ITableEntry dataMapTableEntry) {
DataMapTableView view = retrieveDataMapTableView(dataMapTableEntry);
TableViewerCreator tableViewerCreator = null;
if (view != null) {
if (dataMapTableEntry instanceof AbstractInOutTableEntry || dataMapTableEntry instanceof VarTableEntry) {
tableViewerCreator = view.getTableViewerCreatorForColumns();
} else if (dataMapTableEntry instanceof FilterTableEntry) {
tableViewerCreator = view.getTableViewerCreatorForFilters();
}
}
return tableViewerCreator;
}
use of org.talend.designer.mapper.ui.visualmap.table.DataMapTableView in project tdi-studio-se by Talend.
the class MapperManager method removeRejectOutput.
public void removeRejectOutput() {
List<DataMapTableView> outputsTablesView = uiManager.getOutputsTablesView();
Iterator<DataMapTableView> iterator = outputsTablesView.iterator();
DataMapTableView outputTable = null;
DataMapTableView toRemove = null;
while (iterator.hasNext()) {
outputTable = iterator.next();
if (outputTable.getDataMapTable() instanceof OutputTable && ((OutputTable) outputTable.getDataMapTable()).isErrorRejectTable()) {
toRemove = outputTable;
iterator.remove();
break;
}
}
if (toRemove != null) {
uiManager.removeOutputTableView(toRemove);
uiManager.updateToolbarButtonsStates(Zone.OUTPUTS);
IProcess process = getAbstractMapComponent().getProcess();
process.removeUniqueConnectionName(toRemove.getDataMapTable().getName());
}
}
use of org.talend.designer.mapper.ui.visualmap.table.DataMapTableView in project tdi-studio-se by Talend.
the class MapperManager method replaceLocation.
/**
*
* DOC amaumont Comment method "replaceLocation".
*
* @param previousLocation
* @param newLocation
* @param dataMapExpressionParser
* @param table
* @param entry
* @return true if expression of entry has changed
*/
private boolean replaceLocation(final TableEntryLocation previousLocation, final TableEntryLocation newLocation, DataMapExpressionParser dataMapExpressionParser, IDataMapTable table, ITableEntry entry) {
if (entry.getExpression() == null || entry.getExpression().trim().length() == 0) {
return false;
}
boolean expressionHasChanged = false;
String currentExpression = entry.getExpression();
TableEntryLocation[] tableEntryLocations = dataMapExpressionParser.parseTableEntryLocations(currentExpression);
// loop on all locations of current expression
for (TableEntryLocation currentLocation : tableEntryLocations) {
if (currentLocation.equals(previousLocation)) {
currentExpression = dataMapExpressionParser.replaceLocation(currentExpression, previousLocation, newLocation);
expressionHasChanged = true;
}
}
if (expressionHasChanged) {
entry.setExpression(currentExpression);
DataMapTableView dataMapTableView = retrieveAbstractDataMapTableView(table);
TableViewerCreator tableViewerCreator = null;
if (entry instanceof IColumnEntry || entry instanceof FilterTableEntry) {
if (entry instanceof IColumnEntry) {
tableViewerCreator = dataMapTableView.getTableViewerCreatorForColumns();
} else if (entry instanceof FilterTableEntry) {
tableViewerCreator = dataMapTableView.getTableViewerCreatorForFilters();
}
tableViewerCreator.getTableViewer().refresh(entry);
} else if (entry instanceof ExpressionFilterEntry) {
dataMapTableView.getExpressionFilterText().setText(currentExpression);
}
uiManager.parseExpression(currentExpression, entry, false, true, false);
return true;
}
return false;
}
Aggregations