Program: 122251
Project: 122251
Buggy source:
@SuppressWarnings("String_Node_Str") @Override protected void createColumns(final TableViewerCreator<B> tableViewerCreator,final Table table){
  PropertiesTableEditorModel model=getModel();
  TalendProposalProvider processProposalProvider=new TalendProposalProvider(model.getProcess());
  String[] titles=model.getTitles();
  final Object[] itemsValue=model.getItemsValue();
  final String[] items=model.getItems();
  final IElementParameter param=model.getElemParameter();
  final IElement element=model.getElement();
  for (int i=0; i < titles.length; i++) {
    final int curCol=i;
    final IElementParameter currentParam=(IElementParameter)itemsValue[i];
    boolean toDisplay=StringUtils.isEmpty(currentParam.getShowIf()) && StringUtils.isEmpty(currentParam.getNotShowIf());
    if (!toDisplay) {
      List<Map<String,Object>> fullTable=(List<Map<String,Object>>)param.getValue();
      for (int curLine=0; curLine < fullTable.size(); curLine++) {
        ((ElementParameter)currentParam).setCurrentRow(curLine);
        if (currentParam.isShow(element.getElementParameters())) {
          toDisplay=true;
          break;
        }
      }
    }
    if (toDisplay) {
      TableViewerCreatorColumn column=new TableViewerCreatorColumn(tableViewerCreator);
      column.setTitle(titles[i]);
      column.setModifiable(true);
      column.setMinimumWidth(100);
      column.setWeight(20);
switch (currentParam.getFieldType()) {
case CONTEXT_PARAM_NAME_LIST:
case CLOSED_LIST:
case LOOKUP_COLUMN_LIST:
case COLUMN_LIST:
case CONNECTION_LIST:
case DBTYPE_LIST:
case COMPONENT_LIST:
case PREV_COLUMN_LIST:
        final ComboBoxCellEditor cellEditor=new ComboBoxCellEditor(table,currentParam.getListItemsDisplayName());
      final IElementParameter copyOfTmpParam=currentParam;
    ((CCombo)cellEditor.getControl()).setEditable(false);
  ((CCombo)cellEditor.getControl()).setEnabled(!(param.isRepositoryValueUsed() || param.isReadOnly() || currentParam.isReadOnly()));
column.setCellEditor(cellEditor,new CellEditorValueAdapter(){
  @Override public String getColumnText(  CellEditor cellEditor,  Object bean,  Object cellEditorValue){
    return (String)cellEditorValue;
  }
  @Override public Object getOriginalTypedValue(  CellEditor cellEditor,  Object cellEditorTypedValue){
    Object returnedValue=null;
    if (cellEditorTypedValue != null && cellEditorTypedValue instanceof Integer) {
      int index=(Integer)cellEditorTypedValue;
      String[] namesSet=((CCombo)cellEditor.getControl()).getItems();
      if (namesSet.length > 0 && index > -1 && index < namesSet.length) {
        returnedValue=namesSet[index];
      }
 else {
        returnedValue=null;
      }
    }
 else {
      returnedValue=null;
    }
    IElementParameter rootParameter=element.getElementParameter("String_Node_Str");
    if (rootParameter != null) {
      List<Map<String,String>> rootValue=(List<Map<String,String>>)rootParameter.getValue();
      if (rootValue != null) {
        for (int i=0; i < rootValue.size(); i++) {
          Map<String,String> map=(Map<String,String>)rootValue.get(i);
          String columnName=map.get("String_Node_Str");
          String split[]=columnName.split("String_Node_Str");
          if (split.length == 2 && !returnedValue.equals("String_Node_Str")) {
            String newName=returnedValue + "String_Node_Str" + split[1];
            map.put("String_Node_Str",newName);
          }
 else           if (split.length == 1 && !returnedValue.equals("String_Node_Str")) {
            String newName=(String)returnedValue;
            map.put("String_Node_Str",newName);
          }
        }
      }
    }
    return returnedValue;
  }
  @Override public Object getCellEditorTypedValue(  CellEditor cellEditor,  Object originalTypedValue){
    CCombo combo=(CCombo)cellEditor.getControl();
    int rowNumber=((Table)combo.getParent()).getSelectionIndex();
    String[] listToDisplay=getItemsToDisplay(element,copyOfTmpParam,rowNumber);
    if (!Arrays.equals(listToDisplay,((ComboBoxCellEditor)cellEditor).getItems())) {
      ((ComboBoxCellEditor)cellEditor).setItems(listToDisplay);
    }
    Object returnedValue=0;
    if (originalTypedValue != null) {
      String[] namesSet=listToDisplay;
      for (int j=0; j < namesSet.length; j++) {
        if (namesSet[j].equals(originalTypedValue)) {
          returnedValue=j;
          break;
        }
      }
    }
    return returnedValue;
  }
}
);
cellEditor.addListener(new ICellEditorListener(){
@Override public void editorValueChanged(boolean oldValidState,boolean newValidState){
}
@Override public void cancelEditor(){
}
@Override public void applyEditorValue(){
  if (element instanceof Node) {
    IProcess process=((Node)element).getProcess();
    if (process instanceof IProcess2) {
      ((IProcess2)process).checkProcess();
    }
  }
}
}
);
break;
case MODULE_LIST:
column.setModifiable((!param.isRepositoryValueUsed()) && (!param.isReadOnly()) && (!currentParam.isReadOnly()));
ModuleListCellEditor moduleEditor=new ModuleListCellEditor(table,currentParam,param);
moduleEditor.setTableEditorView(this);
column.setCellEditor(moduleEditor);
break;
case COLOR:
column.setModifiable((!param.isRepositoryValueUsed()) && (!param.isReadOnly()) && (!currentParam.isReadOnly()));
column.setLabelProvider(null);
column.setCellEditor(new ColorCellEditor(table){
@Override protected void doSetValue(Object value){
if (value instanceof String) {
super.doSetValue(TalendTextUtils.stringToRGB((String)value));
}
 else {
super.doSetValue(value);
}
}
@Override protected void updateContents(Object value){
if (value != null) {
if (value instanceof String) {
super.updateContents(TalendTextUtils.stringToRGB((String)value));
}
 else {
super.updateContents(value);
}
}
}
}
);
column.setColorProvider(new IColumnColorProvider(){
@Override public Color getBackgroundColor(Object bean){
Object value=((Map<String,Object>)bean).get(items[curCol]);
if (value == null || (!(value instanceof String))) {
return Display.getCurrent().getSystemColor(SWT.COLOR_WHITE);
}
return new Color(null,TalendTextUtils.stringToRGB((String)value));
}
@Override public Color getForegroundColor(Object bean){
return null;
}
}
);
break;
case CHECK:
column.setModifiable((!param.isRepositoryValueUsed()) && (!param.isReadOnly()) && (!currentParam.isReadOnly()));
CheckColumnSelectionListener tableColumnSelectionListener=new CheckColumnSelectionListener(column,tableViewerCreator,currentParam);
if (!currentParam.isReadOnly()) {
column.setTableColumnSelectionListener(tableColumnSelectionListener);
}
column.setTableEditorContent(new CheckboxTableEditorContent());
Boolean curValue=(Boolean)currentParam.getValue();
tableColumnSelectionListener.setChecked(curValue.booleanValue());
if (curValue.booleanValue()) {
column.setImageHeader(ImageProvider.getImage(EImage.CHECKED_ICON));
}
 else {
column.setImageHeader(ImageProvider.getImage(EImage.UNCHECKED_ICON));
}
column.setDisplayedValue("String_Node_Str");
break;
case SCHEMA_TYPE:
column.setModifiable((!param.isRepositoryValueUsed()) && (!param.isReadOnly()) && (!currentParam.isReadOnly()));
final INode node=(INode)element;
column.setLabelProvider(new IColumnLabelProvider(){
@Override public String getLabel(Object bean){
if (bean instanceof Map) {
Map<String,Object> valueMap=(Map<String,Object>)bean;
String value=(String)valueMap.get(IEbcdicConstant.FIELD_SCHEMA);
if (value != null && !"String_Node_Str".equals(value)) {
IMetadataTable metadataTable=MetadataToolHelper.getMetadataTableFromNodeTableName(node,value);
if (metadataTable != null) {
if (isEBCDICNode(node)) {
if (isRepositorySchemaLine(node,valueMap)) {
return "String_Node_Str" + metadataTable.getTableName() + "String_Node_Str";
}
 else {
return "String_Node_Str" + metadataTable.getTableName() + "String_Node_Str";
}
}
 else {
return metadataTable.getTableName();
}
}
 else {
return value;
}
}
}
return "String_Node_Str";
}
}
);
SchemaCellEditor schemaEditor=new SchemaCellEditor(table,node);
schemaEditor.setTableEditorView(this);
column.setCellEditor(schemaEditor);
break;
case RULE_TYPE:
column.setTitle("String_Node_Str");
column.setModifiable((!param.isRepositoryValueUsed()) && (!param.isReadOnly()) && (!currentParam.isReadOnly()));
final INode node1=(INode)element;
column.setLabelProvider(new IColumnLabelProvider(){
@Override public String getLabel(Object bean){
if (bean instanceof Map) {
Map<String,Object> valueMap=(Map<String,Object>)bean;
String value=(String)valueMap.get(IRuleConstant.FIELD_RULE);
if (value != null && !"String_Node_Str".equals(value)) {
IMetadataTable metadataTable=MetadataToolHelper.getMetadataTableFromNodeTableName(node1,value);
if (metadataTable != null) {
return metadataTable.getTableName();
}
 else {
return value;
}
}
}
return "String_Node_Str";
}
}
);
RuleCellEditor ruleEditor=new RuleCellEditor(table,node1);
ruleEditor.setTableEditorView(this);
column.setCellEditor(ruleEditor);
break;
case SCHEMA_XPATH_QUERYS:
column.setModifiable((!param.isRepositoryValueUsed()) && (!param.isReadOnly()) && (!currentParam.isReadOnly()));
final INode node2=(INode)element;
SchemaXPathQuerysCellEditor schemaXPathEditor=new SchemaXPathQuerysCellEditor(table,node2);
schemaXPathEditor.setTableEditorView(this);
column.setCellEditor(schemaXPathEditor);
break;
default :
TextCellEditor tcEditor=null;
if (((i == 0) && (param.isBasedOnSchema() || param.isBasedOnSubjobStarts())) || (param.isRepositoryValueUsed()) || (param.isReadOnly())|| currentParam.isReadOnly()) {
}
 else {
if (currentParam.isNoContextAssist()) {
tcEditor=new TextCellEditor(table);
}
 else {
TextCellEditorWithProposal textCellEditor=new TextCellEditorWithProposal(table,column);
textCellEditor.setContentProposalProvider(processProposalProvider);
tcEditor=textCellEditor;
}
}
if (tcEditor != null) {
column.setCellEditor(tcEditor);
}
}
column.setColumnCellModifier(new ColumnCellModifier(column){
@Override public boolean canModify(Object bean){
boolean canModify=super.canModify(bean);
if (canModify) {
Map<String,Object> valueMap=(Map<String,Object>)bean;
List<Map<String,Object>> fullValues=(List<Map<String,Object>>)param.getValue();
((ElementParameter)currentParam).setCurrentRow(fullValues.indexOf(valueMap));
if (currentParam.isReadOnly(element.getElementParameters())) {
return false;
}
}
return canModify;
}
}
);
column.setColorProvider(new IColumnColorProvider<B>(){
@Override public Color getBackgroundColor(B bean){
Map<String,Object> valueMap=(Map<String,Object>)bean;
List<Map<String,Object>> fullValues=(List<Map<String,Object>>)param.getValue();
int index=fullValues.indexOf(valueMap);
if (index >= 0) {
((ElementParameter)currentParam).setCurrentRow(index);
if (currentParam.isReadOnly(element.getElementParameters())) {
return AbstractMetadataTableEditorView.READONLY_CELL_BG_COLOR;
}
}
return null;
}
@Override public Color getForegroundColor(B bean){
return null;
}
}
);
column.setBeanPropertyAccessors(new IBeanPropertyAccessors<B,Object>(){
@Override public Object get(B bean){
Object value=((Map<String,Object>)bean).get(items[curCol]);
if (value == null) {
return "String_Node_Str";
}
if (itemsValue[curCol] instanceof IElementParameter) {
IElementParameter tmpParam=(IElementParameter)itemsValue[curCol];
switch (tmpParam.getFieldType()) {
case CONTEXT_PARAM_NAME_LIST:
case CLOSED_LIST:
case COMPONENT_LIST:
case COLUMN_LIST:
case CONNECTION_LIST:
case LOOKUP_COLUMN_LIST:
case PREV_COLUMN_LIST:
case DBTYPE_LIST:
String[] namesSet=tmpParam.getListItemsDisplayName();
if (namesSet.length == 0) {
return tmpParam.getDefaultClosedListValue();
}
if (value instanceof String) {
boolean found=false;
int index=0;
Object[] items=((IElementParameter)itemsValue[curCol]).getListItemsValue();
for (int j=0; j < items.length && !found; j++) {
if (items[j].equals(value)) {
found=true;
index=j;
}
}
value=new Integer(index);
}
if (value != null && ((Integer)value) >= 0) {
return namesSet[(Integer)value];
}
return null;
case CHECK:
if (value instanceof String) {
return new Boolean((String)value);
}
return value;
case RADIO:
if (value instanceof String) {
return new Boolean((String)value);
}
return value;
case COLOR:
if (value instanceof String) {
return TalendTextUtils.stringToRGB((String)value);
}
return value;
default :
return value;
}
}
return value;
}
@Override public void set(B bean,Object value){
Object finalValue=value;
IElementParameter tmpParam=(IElementParameter)itemsValue[curCol];
boolean included=false;
for (Object object : param.getListItemsValue()) {
if (object instanceof IElementParameter) {
if (((IElementParameter)object).getShowIf() != null && ((IElementParameter)object).getShowIf().contains(tmpParam.getName())) {
included=true;
break;
}
if (((IElementParameter)object).getNotShowIf() != null && ((IElementParameter)object).getNotShowIf().contains(tmpParam.getName())) {
included=true;
break;
}
if (((IElementParameter)object).getReadOnlyIf() != null && ((IElementParameter)object).getReadOnlyIf().contains(tmpParam.getName())) {
included=true;
break;
}
if (((IElementParameter)object).getNotReadOnlyIf() != null && ((IElementParameter)object).getNotReadOnlyIf().contains(tmpParam.getName())) {
included=true;
break;
}
}
}
if (included) {
IElementParameter param=element.getElementParameter(EParameterName.UPDATE_COMPONENTS.getName());
if (param != null) {
param.setValue(Boolean.TRUE);
}
}
switch (tmpParam.getFieldType()) {
case CONTEXT_PARAM_NAME_LIST:
case CLOSED_LIST:
case COLUMN_LIST:
case COMPONENT_LIST:
case CONNECTION_LIST:
case LOOKUP_COLUMN_LIST:
case PREV_COLUMN_LIST:
if (value instanceof String) {
Object[] itemNames=((IElementParameter)itemsValue[curCol]).getListItemsDisplayName();
Object[] itemValues=((IElementParameter)itemsValue[curCol]).getListItemsValue();
boolean found=false;
int index=0;
for (int j=0; j < itemNames.length && !found; j++) {
if (itemNames[j].equals(value)) {
found=true;
index=j;
}
}
if (value != null && (index >= 0)) {
finalValue=itemValues[new Integer(index)];
}
}
break;
case COLOR:
if (value instanceof RGB) {
RGB rgb=(RGB)value;
finalValue=rgb.red + "String_Node_Str" + rgb.green+ "String_Node_Str"+ rgb.blue;
}
default :
}
((Map<String,Object>)bean).put(items[curCol],finalValue);
resetValuesIfNeeded(element,param,(Map<String,Object>)bean);
if (param.getFieldType().equals(EParameterFieldType.TABLE)) {
element.setPropertyValue(param.getName(),param.getValue());
}
}
}
);
}
}
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override protected void createColumns(final TableViewerCreator<B> tableViewerCreator,final Table table){
  PropertiesTableEditorModel model=getModel();
  TalendProposalProvider processProposalProvider=new TalendProposalProvider(model.getProcess());
  String[] titles=model.getTitles();
  final Object[] itemsValue=model.getItemsValue();
  final String[] items=model.getItems();
  final IElementParameter param=model.getElemParameter();
  final IElement element=model.getElement();
  for (int i=0; i < titles.length; i++) {
    final int curCol=i;
    final IElementParameter currentParam=(IElementParameter)itemsValue[i];
    boolean toDisplay=StringUtils.isEmpty(currentParam.getShowIf()) && StringUtils.isEmpty(currentParam.getNotShowIf());
    if (!toDisplay) {
      List<Map<String,Object>> fullTable=(List<Map<String,Object>>)param.getValue();
      for (int curLine=0; curLine < fullTable.size(); curLine++) {
        ((ElementParameter)currentParam).setCurrentRow(curLine);
        if (currentParam.isShow(element.getElementParameters())) {
          toDisplay=true;
          break;
        }
      }
    }
    if (toDisplay) {
      TableViewerCreatorColumn column=new TableViewerCreatorColumn(tableViewerCreator);
      column.setTitle(titles[i]);
      column.setModifiable(true);
      column.setMinimumWidth(100);
      column.setWeight(20);
switch (currentParam.getFieldType()) {
case CONTEXT_PARAM_NAME_LIST:
case CLOSED_LIST:
case LOOKUP_COLUMN_LIST:
case COLUMN_LIST:
case CONNECTION_LIST:
case DBTYPE_LIST:
case COMPONENT_LIST:
case PREV_COLUMN_LIST:
        final ComboBoxCellEditor cellEditor=new ComboBoxCellEditor(table,currentParam.getListItemsDisplayName());
      final IElementParameter copyOfTmpParam=currentParam;
    ((CCombo)cellEditor.getControl()).setEditable(false);
  ((CCombo)cellEditor.getControl()).setEnabled(!(param.isRepositoryValueUsed() || param.isReadOnly() || currentParam.isReadOnly()));
column.setCellEditor(cellEditor,new CellEditorValueAdapter(){
  @Override public String getColumnText(  CellEditor cellEditor,  Object bean,  Object cellEditorValue){
    return (String)cellEditorValue;
  }
  @Override public Object getOriginalTypedValue(  CellEditor cellEditor,  Object cellEditorTypedValue){
    Object returnedValue=null;
    if (cellEditorTypedValue != null && cellEditorTypedValue instanceof Integer) {
      int index=(Integer)cellEditorTypedValue;
      String[] namesSet=((CCombo)cellEditor.getControl()).getItems();
      if (namesSet.length > 0 && index > -1 && index < namesSet.length) {
        returnedValue=namesSet[index];
      }
 else {
        returnedValue=null;
      }
    }
 else {
      returnedValue=null;
    }
    if (element instanceof INode) {
      INode node=(INode)element;
      if (node.getComponent().getName() != null && node.getComponent().getName().equals("String_Node_Str")) {
        IElementParameter rootParameter=element.getElementParameter("String_Node_Str");
        if (rootParameter != null) {
          List<Map<String,String>> rootValue=(List<Map<String,String>>)rootParameter.getValue();
          if (rootValue != null) {
            for (int i=0; i < rootValue.size(); i++) {
              Map<String,String> map=(Map<String,String>)rootValue.get(i);
              String columnName=map.get("String_Node_Str");
              String split[]=columnName.split("String_Node_Str");
              if (split.length == 2 && !returnedValue.equals("String_Node_Str")) {
                String newName=returnedValue + "String_Node_Str" + split[1];
                map.put("String_Node_Str",newName);
              }
 else               if (split.length == 1 && !returnedValue.equals("String_Node_Str")) {
                String newName=(String)returnedValue;
                map.put("String_Node_Str",newName);
              }
            }
          }
        }
      }
    }
    return returnedValue;
  }
  @Override public Object getCellEditorTypedValue(  CellEditor cellEditor,  Object originalTypedValue){
    CCombo combo=(CCombo)cellEditor.getControl();
    int rowNumber=((Table)combo.getParent()).getSelectionIndex();
    String[] listToDisplay=getItemsToDisplay(element,copyOfTmpParam,rowNumber);
    if (!Arrays.equals(listToDisplay,((ComboBoxCellEditor)cellEditor).getItems())) {
      ((ComboBoxCellEditor)cellEditor).setItems(listToDisplay);
    }
    Object returnedValue=0;
    if (originalTypedValue != null) {
      String[] namesSet=listToDisplay;
      for (int j=0; j < namesSet.length; j++) {
        if (namesSet[j].equals(originalTypedValue)) {
          returnedValue=j;
          break;
        }
      }
    }
    return returnedValue;
  }
}
);
cellEditor.addListener(new ICellEditorListener(){
@Override public void editorValueChanged(boolean oldValidState,boolean newValidState){
}
@Override public void cancelEditor(){
}
@Override public void applyEditorValue(){
  if (element instanceof Node) {
    IProcess process=((Node)element).getProcess();
    if (process instanceof IProcess2) {
      ((IProcess2)process).checkProcess();
    }
  }
}
}
);
break;
case MODULE_LIST:
column.setModifiable((!param.isRepositoryValueUsed()) && (!param.isReadOnly()) && (!currentParam.isReadOnly()));
ModuleListCellEditor moduleEditor=new ModuleListCellEditor(table,currentParam,param);
moduleEditor.setTableEditorView(this);
column.setCellEditor(moduleEditor);
break;
case COLOR:
column.setModifiable((!param.isRepositoryValueUsed()) && (!param.isReadOnly()) && (!currentParam.isReadOnly()));
column.setLabelProvider(null);
column.setCellEditor(new ColorCellEditor(table){
@Override protected void doSetValue(Object value){
if (value instanceof String) {
super.doSetValue(TalendTextUtils.stringToRGB((String)value));
}
 else {
super.doSetValue(value);
}
}
@Override protected void updateContents(Object value){
if (value != null) {
if (value instanceof String) {
super.updateContents(TalendTextUtils.stringToRGB((String)value));
}
 else {
super.updateContents(value);
}
}
}
}
);
column.setColorProvider(new IColumnColorProvider(){
@Override public Color getBackgroundColor(Object bean){
Object value=((Map<String,Object>)bean).get(items[curCol]);
if (value == null || (!(value instanceof String))) {
return Display.getCurrent().getSystemColor(SWT.COLOR_WHITE);
}
return new Color(null,TalendTextUtils.stringToRGB((String)value));
}
@Override public Color getForegroundColor(Object bean){
return null;
}
}
);
break;
case CHECK:
column.setModifiable((!param.isRepositoryValueUsed()) && (!param.isReadOnly()) && (!currentParam.isReadOnly()));
CheckColumnSelectionListener tableColumnSelectionListener=new CheckColumnSelectionListener(column,tableViewerCreator,currentParam);
if (!currentParam.isReadOnly()) {
column.setTableColumnSelectionListener(tableColumnSelectionListener);
}
column.setTableEditorContent(new CheckboxTableEditorContent());
Boolean curValue=(Boolean)currentParam.getValue();
tableColumnSelectionListener.setChecked(curValue.booleanValue());
if (curValue.booleanValue()) {
column.setImageHeader(ImageProvider.getImage(EImage.CHECKED_ICON));
}
 else {
column.setImageHeader(ImageProvider.getImage(EImage.UNCHECKED_ICON));
}
column.setDisplayedValue("String_Node_Str");
break;
case SCHEMA_TYPE:
column.setModifiable((!param.isRepositoryValueUsed()) && (!param.isReadOnly()) && (!currentParam.isReadOnly()));
final INode node=(INode)element;
column.setLabelProvider(new IColumnLabelProvider(){
@Override public String getLabel(Object bean){
if (bean instanceof Map) {
Map<String,Object> valueMap=(Map<String,Object>)bean;
String value=(String)valueMap.get(IEbcdicConstant.FIELD_SCHEMA);
if (value != null && !"String_Node_Str".equals(value)) {
IMetadataTable metadataTable=MetadataToolHelper.getMetadataTableFromNodeTableName(node,value);
if (metadataTable != null) {
if (isEBCDICNode(node)) {
if (isRepositorySchemaLine(node,valueMap)) {
return "String_Node_Str" + metadataTable.getTableName() + "String_Node_Str";
}
 else {
return "String_Node_Str" + metadataTable.getTableName() + "String_Node_Str";
}
}
 else {
return metadataTable.getTableName();
}
}
 else {
return value;
}
}
}
return "String_Node_Str";
}
}
);
SchemaCellEditor schemaEditor=new SchemaCellEditor(table,node);
schemaEditor.setTableEditorView(this);
column.setCellEditor(schemaEditor);
break;
case RULE_TYPE:
column.setTitle("String_Node_Str");
column.setModifiable((!param.isRepositoryValueUsed()) && (!param.isReadOnly()) && (!currentParam.isReadOnly()));
final INode node1=(INode)element;
column.setLabelProvider(new IColumnLabelProvider(){
@Override public String getLabel(Object bean){
if (bean instanceof Map) {
Map<String,Object> valueMap=(Map<String,Object>)bean;
String value=(String)valueMap.get(IRuleConstant.FIELD_RULE);
if (value != null && !"String_Node_Str".equals(value)) {
IMetadataTable metadataTable=MetadataToolHelper.getMetadataTableFromNodeTableName(node1,value);
if (metadataTable != null) {
return metadataTable.getTableName();
}
 else {
return value;
}
}
}
return "String_Node_Str";
}
}
);
RuleCellEditor ruleEditor=new RuleCellEditor(table,node1);
ruleEditor.setTableEditorView(this);
column.setCellEditor(ruleEditor);
break;
case SCHEMA_XPATH_QUERYS:
column.setModifiable((!param.isRepositoryValueUsed()) && (!param.isReadOnly()) && (!currentParam.isReadOnly()));
final INode node2=(INode)element;
SchemaXPathQuerysCellEditor schemaXPathEditor=new SchemaXPathQuerysCellEditor(table,node2);
schemaXPathEditor.setTableEditorView(this);
column.setCellEditor(schemaXPathEditor);
break;
default :
TextCellEditor tcEditor=null;
if (((i == 0) && (param.isBasedOnSchema() || param.isBasedOnSubjobStarts())) || (param.isRepositoryValueUsed()) || (param.isReadOnly())|| currentParam.isReadOnly()) {
}
 else {
if (currentParam.isNoContextAssist()) {
tcEditor=new TextCellEditor(table);
}
 else {
TextCellEditorWithProposal textCellEditor=new TextCellEditorWithProposal(table,column);
textCellEditor.setContentProposalProvider(processProposalProvider);
tcEditor=textCellEditor;
}
}
if (tcEditor != null) {
column.setCellEditor(tcEditor);
}
}
column.setColumnCellModifier(new ColumnCellModifier(column){
@Override public boolean canModify(Object bean){
boolean canModify=super.canModify(bean);
if (canModify) {
Map<String,Object> valueMap=(Map<String,Object>)bean;
List<Map<String,Object>> fullValues=(List<Map<String,Object>>)param.getValue();
((ElementParameter)currentParam).setCurrentRow(fullValues.indexOf(valueMap));
if (currentParam.isReadOnly(element.getElementParameters())) {
return false;
}
}
return canModify;
}
}
);
column.setColorProvider(new IColumnColorProvider<B>(){
@Override public Color getBackgroundColor(B bean){
Map<String,Object> valueMap=(Map<String,Object>)bean;
List<Map<String,Object>> fullValues=(List<Map<String,Object>>)param.getValue();
int index=fullValues.indexOf(valueMap);
if (index >= 0) {
((ElementParameter)currentParam).setCurrentRow(index);
if (currentParam.isReadOnly(element.getElementParameters())) {
return AbstractMetadataTableEditorView.READONLY_CELL_BG_COLOR;
}
}
return null;
}
@Override public Color getForegroundColor(B bean){
return null;
}
}
);
column.setBeanPropertyAccessors(new IBeanPropertyAccessors<B,Object>(){
@Override public Object get(B bean){
Object value=((Map<String,Object>)bean).get(items[curCol]);
if (value == null) {
return "String_Node_Str";
}
if (itemsValue[curCol] instanceof IElementParameter) {
IElementParameter tmpParam=(IElementParameter)itemsValue[curCol];
switch (tmpParam.getFieldType()) {
case CONTEXT_PARAM_NAME_LIST:
case CLOSED_LIST:
case COMPONENT_LIST:
case COLUMN_LIST:
case CONNECTION_LIST:
case LOOKUP_COLUMN_LIST:
case PREV_COLUMN_LIST:
case DBTYPE_LIST:
String[] namesSet=tmpParam.getListItemsDisplayName();
if (namesSet.length == 0) {
return tmpParam.getDefaultClosedListValue();
}
if (value instanceof String) {
boolean found=false;
int index=0;
Object[] items=((IElementParameter)itemsValue[curCol]).getListItemsValue();
for (int j=0; j < items.length && !found; j++) {
if (items[j].equals(value)) {
found=true;
index=j;
}
}
value=new Integer(index);
}
if (value != null && ((Integer)value) >= 0) {
return namesSet[(Integer)value];
}
return null;
case CHECK:
if (value instanceof String) {
return new Boolean((String)value);
}
return value;
case RADIO:
if (value instanceof String) {
return new Boolean((String)value);
}
return value;
case COLOR:
if (value instanceof String) {
return TalendTextUtils.stringToRGB((String)value);
}
return value;
default :
return value;
}
}
return value;
}
@Override public void set(B bean,Object value){
Object finalValue=value;
IElementParameter tmpParam=(IElementParameter)itemsValue[curCol];
boolean included=false;
for (Object object : param.getListItemsValue()) {
if (object instanceof IElementParameter) {
if (((IElementParameter)object).getShowIf() != null && ((IElementParameter)object).getShowIf().contains(tmpParam.getName())) {
included=true;
break;
}
if (((IElementParameter)object).getNotShowIf() != null && ((IElementParameter)object).getNotShowIf().contains(tmpParam.getName())) {
included=true;
break;
}
if (((IElementParameter)object).getReadOnlyIf() != null && ((IElementParameter)object).getReadOnlyIf().contains(tmpParam.getName())) {
included=true;
break;
}
if (((IElementParameter)object).getNotReadOnlyIf() != null && ((IElementParameter)object).getNotReadOnlyIf().contains(tmpParam.getName())) {
included=true;
break;
}
}
}
if (included) {
IElementParameter param=element.getElementParameter(EParameterName.UPDATE_COMPONENTS.getName());
if (param != null) {
param.setValue(Boolean.TRUE);
}
}
switch (tmpParam.getFieldType()) {
case CONTEXT_PARAM_NAME_LIST:
case CLOSED_LIST:
case COLUMN_LIST:
case COMPONENT_LIST:
case CONNECTION_LIST:
case LOOKUP_COLUMN_LIST:
case PREV_COLUMN_LIST:
if (value instanceof String) {
Object[] itemNames=((IElementParameter)itemsValue[curCol]).getListItemsDisplayName();
Object[] itemValues=((IElementParameter)itemsValue[curCol]).getListItemsValue();
boolean found=false;
int index=0;
for (int j=0; j < itemNames.length && !found; j++) {
if (itemNames[j].equals(value)) {
found=true;
index=j;
}
}
if (value != null && (index >= 0)) {
finalValue=itemValues[new Integer(index)];
}
}
break;
case COLOR:
if (value instanceof RGB) {
RGB rgb=(RGB)value;
finalValue=rgb.red + "String_Node_Str" + rgb.green+ "String_Node_Str"+ rgb.blue;
}
default :
}
((Map<String,Object>)bean).put(items[curCol],finalValue);
resetValuesIfNeeded(element,param,(Map<String,Object>)bean);
if (param.getFieldType().equals(EParameterFieldType.TABLE)) {
element.setPropertyValue(param.getName(),param.getValue());
}
}
}
);
}
}
}