use of org.talend.designer.abstractmap.model.table.IDataMapTable in project tdi-studio-se by Talend.
the class ExpressionProposalProvider method getProposals.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.fieldassist.IContentProposalProvider#getProposals(java.lang.String, int)
*/
public IContentProposal[] getProposals(String contents, int position) {
List<IContentProposal> proposals = new ArrayList<IContentProposal>();
TableEntryLocation sourceEntryLocation = new TableEntryLocation();
// Proposals based on process context
for (IDataMapTable table : this.tables) {
// proposals.add(new TableContentProposal(table, this.currentLanguage));
List<IColumnEntry> dataMapTableEntries = table.getColumnEntries();
for (IColumnEntry entrySource : dataMapTableEntries) {
sourceEntryLocation.tableName = entrySource.getParentName();
sourceEntryLocation.columnName = entrySource.getName();
if (mapperManager.getUiManager().checkSourceLocationIsValid(entrySource, currentModifiedEntry)) {
proposals.add(new EntryContentProposal(entrySource, this.currentLanguage));
}
}
}
for (IContentProposalProvider contentProposalProvider : otherContentProposalProviders) {
proposals.addAll(Arrays.asList(contentProposalProvider.getProposals(contents, position)));
}
IContentProposal[] res = new IContentProposal[proposals.size()];
res = proposals.toArray(res);
return res;
}
use of org.talend.designer.abstractmap.model.table.IDataMapTable in project tdi-studio-se by Talend.
the class MapperManager method removeTablePair.
/**
*
* Remove the <code>DataMapTableView</code>-<code>DataMapTable</code> pair.
*
* @param view
*/
public void removeTablePair(DataMapTableView view) {
IDataMapTable dataTable = tableManager.getData(view);
List<IColumnEntry> dataMapTableEntries = dataTable.getColumnEntries();
if (isAdvancedMap() && dataTable instanceof AbstractInOutTable) {
tableEntriesManager.removeAll(Arrays.asList(((AbstractInOutTable) dataTable).getExpressionFilter()));
}
tableEntriesManager.removeAll(dataMapTableEntries);
if (dataTable instanceof OutputTable) {
List<FilterTableEntry> constraintEntries = ((OutputTable) dataTable).getFilterEntries();
tableEntriesManager.removeAll(constraintEntries);
}
tableManager.removeTable(view);
}
use of org.talend.designer.abstractmap.model.table.IDataMapTable in project tdi-studio-se by Talend.
the class MapperManager method addNewFilterEntry.
public FilterTableEntry addNewFilterEntry(DataMapTableView dataMapTableView, String name, Integer index) {
IDataMapTable abstractDataMapTable = dataMapTableView.getDataMapTable();
FilterTableEntry constraintEntry = new FilterTableEntry(abstractDataMapTable, name, null);
tableEntriesManager.addTableEntry(constraintEntry, index);
return constraintEntry;
}
use of org.talend.designer.abstractmap.model.table.IDataMapTable in project tdi-studio-se by Talend.
the class MapperManager method addNewGlobalMapEntry.
/**
*
* @param dataMapTableView
* @param index
* @param type TODO
* @param metadataColumn, can be null if added in VarsTable
*/
public GlobalMapEntry addNewGlobalMapEntry(DataMapTableView dataMapTableView, ITableEntry tableEntrySource, Integer index) {
IDataMapTable abstractDataMapTable = dataMapTableView.getDataMapTable();
GlobalMapEntry dataMapTableEntry = null;
if (dataMapTableView.getZone() == Zone.INPUTS) {
dataMapTableEntry = new GlobalMapEntry(abstractDataMapTable, "\"" + dataMapTableView.findUniqueName("myKey") + "\"", //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
null);
} else {
//$NON-NLS-1$
throw new IllegalArgumentException(Messages.getString("MapperManager.exceptionMessage.useOtherSignature"));
}
AddGlobalMapEntryCommand command = new AddGlobalMapEntryCommand(tableEntriesManager, dataMapTableEntry, index);
executeCommand(command);
return dataMapTableEntry;
}
use of org.talend.designer.abstractmap.model.table.IDataMapTable in project tdi-studio-se by Talend.
the class MapperManager method removeSelectedOutput.
public void removeSelectedOutput() {
DataMapTableView currentSelectedDataMapTableView = uiManager.getCurrentSelectedOutputTableView();
String append = "";
OutputTable outputTable = ((OutputTable) currentSelectedDataMapTableView.getDataMapTable());
List<DataMapTableView> relatedOutputsTableView = null;
if (outputTable.getIsJoinTableOf() == null) {
relatedOutputsTableView = uiManager.getRelatedOutputsTableView(currentSelectedDataMapTableView);
if (relatedOutputsTableView != null && !relatedOutputsTableView.isEmpty()) {
append = " and it's join table ";
for (DataMapTableView tableView : relatedOutputsTableView) {
IDataMapTable retrieveAbstractDataMapTable = this.retrieveAbstractDataMapTable(tableView);
if (retrieveAbstractDataMapTable != null) {
append = append + "'" + retrieveAbstractDataMapTable.getName() + " ' ,";
}
}
append = append.substring(0, append.length() - 1);
}
}
if (currentSelectedDataMapTableView != null) {
String tableName = currentSelectedDataMapTableView.getDataMapTable().getName();
if (MessageDialog.openConfirm(currentSelectedDataMapTableView.getShell(), //$NON-NLS-1$
Messages.getString("MapperManager.removeOutputTableTitle"), Messages.getString("MapperManager.removeOutputTableTitleMessage") + tableName + " '" + append + "?")) {
//$NON-NLS-1$ //$NON-NLS-2$
IProcess process = getAbstractMapComponent().getProcess();
uiManager.removeOutputTableView(currentSelectedDataMapTableView);
// remove join table
if (outputTable.getIsJoinTableOf() == null && relatedOutputsTableView != null) {
for (DataMapTableView view : relatedOutputsTableView) {
uiManager.removeOutputTableView(view);
process.removeUniqueConnectionName(view.getDataMapTable().getName());
}
}
uiManager.updateToolbarButtonsStates(Zone.OUTPUTS);
process.removeUniqueConnectionName(currentSelectedDataMapTableView.getDataMapTable().getName());
}
}
}
Aggregations