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();
for (IDataMapTable table : this.tables) {
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 the globalMap
if (table instanceof InputTable) {
InputTable inputTable = (InputTable) table;
List<GlobalMapEntry> globalMapEntries = inputTable.getGlobalMapEntries();
for (GlobalMapEntry entry : globalMapEntries) {
proposals.add(new EntryContentProposal(entry, 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 ExpressionProposalProvider method getVariables.
public List<Variable> getVariables() {
List<Variable> variables = new ArrayList<Variable>();
for (IDataMapTable table : this.tables) {
List<IColumnEntry> dataMapTableEntries = table.getColumnEntries();
for (IColumnEntry entrySource : dataMapTableEntries) {
String variable = null;
if (table instanceof VarsTable) {
variable = entrySource.getExpression();
} else {
variable = LanguageProvider.getCurrentLanguage().getLocation(entrySource.getParentName(), entrySource.getName());
}
String talendType = null;
boolean nullable = true;
if (entrySource instanceof AbstractInOutTableEntry) {
talendType = ((AbstractInOutTableEntry) entrySource).getMetadataColumn().getTalendType();
nullable = ((AbstractInOutTableEntry) entrySource).getMetadataColumn().isNullable();
} else if (entrySource instanceof VarTableEntry) {
talendType = ((VarTableEntry) entrySource).getType();
nullable = ((VarTableEntry) entrySource).isNullable();
}
if (talendType != null) {
if (LanguageManager.getCurrentLanguage() == ECodeLanguage.JAVA) {
boolean exist = false;
for (Variable v : variables) {
if (variable != null && v.getName() != null && v.getName().trim().equals(variable.trim())) {
exist = true;
break;
}
}
if (!exist) {
variables.add(new Variable(variable, JavaTypesManager.getDefaultValueFromJavaIdType(talendType, nullable).toString(), talendType, nullable));
}
} else {
//$NON-NLS-1$
variables.add(new Variable(variable, "", talendType, nullable));
}
}
}
}
return variables;
}
use of org.talend.designer.abstractmap.model.table.IDataMapTable in project tdi-studio-se by Talend.
the class OutputDataMapTableView method getMapSettingValueAccess.
@Override
protected IBeanPropertyAccessors<GlobalMapEntry, Object> getMapSettingValueAccess(final CellEditor cellEditor) {
return new IBeanPropertyAccessors<GlobalMapEntry, Object>() {
public Object get(GlobalMapEntry bean) {
IDataMapTable parent = bean.getParent();
OutputTable outputTable = (OutputTable) parent;
if (cellEditor instanceof ComboBoxCellEditor) {
ComboBoxCellEditor functComboBox = (ComboBoxCellEditor) cellEditor;
functComboBox.setItems(new String[] { "true", "false" });
if (OUTPUT_REJECT.equals(bean.getName())) {
return String.valueOf(outputTable.isReject());
} else if (LOOK_UP_INNER_JOIN_REJECT.equals(bean.getName())) {
return String.valueOf(outputTable.isRejectInnerJoin());
} else if (SCHEMA_TYPE.equals(bean.getName())) {
functComboBox.setItems(new String[] { BUILT_IN, REPOSITORY });
return outputTable.isRepository() ? REPOSITORY : BUILT_IN;
}
} else if (cellEditor instanceof CustomDialogCellEditor) {
CustomDialogCellEditor customDialogCellEditor = (CustomDialogCellEditor) cellEditor;
if (OUTPUT_REJECT.equals(bean.getName())) {
customDialogCellEditor.setType(CellValueType.BOOL);
return String.valueOf(outputTable.isReject());
} else if (LOOK_UP_INNER_JOIN_REJECT.equals(bean.getName())) {
customDialogCellEditor.setType(CellValueType.BOOL);
return String.valueOf(outputTable.isRejectInnerJoin());
} else if (SCHEMA_TYPE.equals(bean.getName())) {
customDialogCellEditor.setType(CellValueType.SCHEMA_TYPE);
enableDiaplayViewer(outputTable.isRepository());
return outputTable.isRepository() ? REPOSITORY : BUILT_IN;
} else if (SCHEMA_ID.equals(bean.getName())) {
customDialogCellEditor.setType(CellValueType.SCHEMA_ID);
return getSchemaDisplayName(outputTable.getId());
}
}
return "";
}
public void set(GlobalMapEntry bean, Object value) {
if (value == null) {
return;
}
IDataMapTable parent = bean.getParent();
OutputTable outputTable = (OutputTable) parent;
if (OUTPUT_REJECT.equals(bean.getName())) {
outputTable.setReject(Boolean.valueOf(value.toString()));
} else if (LOOK_UP_INNER_JOIN_REJECT.equals(bean.getName())) {
outputTable.setRejectInnerJoin(Boolean.valueOf(value.toString()));
} else if (SCHEMA_TYPE.equals(bean.getName())) {
outputTable.setRepository(REPOSITORY.equals(value));
showSchemaIDSetting(REPOSITORY.equals(value));
enableDiaplayViewer(REPOSITORY.equals(value));
} else if (SCHEMA_ID.equals(bean.getName())) {
outputTable.setId(String.valueOf(value));
}
refreshCondensedImage(outputTable, bean.getName());
}
};
}
use of org.talend.designer.abstractmap.model.table.IDataMapTable in project tdi-studio-se by Talend.
the class MapperUI method getMinimizedButtonState.
/**
* DOC amaumont Comment method "getCommonMinimizedStateOfTables".
*
* @param tables
* @return new Boolean(true) if button state should be to minimize, else new Boolean(false)
*/
private Boolean getMinimizedButtonState(List<? extends AbstractDataMapTable> tables) {
boolean allTablesAreMinimized = true;
boolean allTablesAreNotMinimized = true;
for (IDataMapTable table : tables) {
if (table.isMinimized()) {
allTablesAreNotMinimized = false;
} else {
allTablesAreMinimized = false;
}
}
if (allTablesAreMinimized) {
return new Boolean(true);
} else if (allTablesAreNotMinimized) {
return new Boolean(false);
}
return new Boolean(false);
}
use of org.talend.designer.abstractmap.model.table.IDataMapTable in project tdi-studio-se by Talend.
the class DropContextAnalyzer method checkZoonTarget.
private boolean checkZoonTarget() {
IDataMapTable dataMapTable = dataMapTableViewTarget.getDataMapTable();
if (zoneTarget == Zone.OUTPUTS) {
OutputTable outputTable = (OutputTable) dataMapTable;
if (outputTable.isErrorRejectTable()) {
if (currentTableTarget != null && event != null) {
if (event.item instanceof TableItem) {
Object data = event.item.getData();
if (data instanceof OutputColumnTableEntry) {
String label = ((OutputColumnTableEntry) data).getName();
if (mapperManager.ERROR_REJECT_MESSAGE.equals(label) || mapperManager.ERROR_REJECT_STACK_TRACE.equals(label)) {
return false;
}
}
}
}
}
boolean useRepositoryMeta = (outputTable.isRepository()) || (outputTable.getId() != null && !"".equals(outputTable.getId()));
// for join table if main table use repository metadata
if (!useRepositoryMeta && outputTable.getIsJoinTableOf() != null && !"".equals(outputTable.getIsJoinTableOf())) {
OutputTable mainTable = mapperManager.getOutputTableByName(outputTable.getIsJoinTableOf());
if (mainTable != null) {
useRepositoryMeta = mainTable.getId() != null && !"".equals(mainTable.getId());
}
}
if (useRepositoryMeta && currentStyledTextTarget != null) {
return true;
}
if (useRepositoryMeta && isCursorOverHeader || useRepositoryMeta && !isCursorOverExpressionCell) {
return false;
}
}
return true;
}
Aggregations