use of org.talend.commons.ui.runtime.swt.tableviewer.behavior.ComboEditorValueAdapter in project tdi-studio-se by Talend.
the class XmlMapLabelProvider method getColumnText.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
*/
@Override
public String getColumnText(Object element, int columnIndex) {
String returnValue = null;
TableViewerCreatorColumnNotModifiable column = (TableViewerCreatorColumnNotModifiable) this.tableViewerCreator.getColumns().get(columnIndex);
if (column.getLabelProvider() != null) {
returnValue = column.getLabelProvider().getLabel(element);
}
if (returnValue == null) {
if (column.getDisplayedValue() != null || column.getDefaultDisplayedValue() != null || column.getBeanPropertyAccessors() == null) {
String defaultValue = column.getDefaultDisplayedValue();
String imposedDisplayedValue = column.getDisplayedValue();
if (imposedDisplayedValue != null) {
returnValue = imposedDisplayedValue;
} else if (defaultValue == null) {
//$NON-NLS-1$
returnValue = "";
} else {
returnValue = defaultValue;
}
} else {
Object value = AccessorUtils.get(element, column);
CellEditor cellEditor = column.getCellEditor();
CellEditorValueAdapter retrieverValue = column.getCellEditorValueAdapter();
// add for bug TDI-21505
if (value != null && column.getCellEditorValueAdapter() != null && column.getCellEditorValueAdapter() instanceof ComboEditorValueAdapter) {
Object returnObject = column.getCellEditorValueAdapter().getCellEditorTypedValue(column.getCellEditor(), value);
if ("-1".equals(returnObject + "")) {
return "";
}
}
if (cellEditor != null && retrieverValue != null && value != null) {
if (element instanceof TreeNode) {
if ((((TreeNode) element).getNodeType()).equals(NodeType.ELEMENT)) {
returnValue = retrieverValue.getColumnText(cellEditor, element, value);
}
}
} else if (value != null) {
returnValue = String.valueOf(value);
} else {
//$NON-NLS-1$
returnValue = "";
}
}
// return the type
if (columnIndex == 3) {
if (element instanceof TreeNode) {
TreeNode node = (TreeNode) element;
returnValue = TalendTypeConvert.convertToJavaType(node.getType());
}
}
}
return returnValue;
}
Aggregations