Program: 121754
Project: 121754
Buggy source:
private void addListenerForOutputCom(){
  rowTableForout.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      TableItem[] items=rowTableForout.getSelection();
      currentElementIndexForOut=rowTableForout.getSelectionIndex();
      currentOutputParameter=((OutPutMappingData)items[0].getData()).getParameter();
      currentOutputMappingData=(OutPutMappingData)items[0].getData();
      List<ParameterInfo> infoList=currentOutputParameter.getParameterInfos();
      ParameterInfo infoPa=currentOutputParameter.getParent();
      Boolean isArray=false;
      String isArrayName="String_Node_Str";
      if (currentOutputMappingData.getParameterName() != null) {
        isArrayName=currentOutputMappingData.getParameterName();
      }
      if ((currentOutputMappingData.getParameter().getArraySize() == -1 || currentOutputMappingData.getParameter().getArraySize() > 1) && !isArrayName.endsWith("String_Node_Str")) {
        isArray=true;
        isOutPutArray=true;
      }
      if (infoList != null && infoList.size() > 0 || isArray) {
        addListButForOut.setEnabled(true);
      }
 else {
        addListButForOut.setEnabled(false);
      }
      if (infoPa != null) {
        removeButForout.setEnabled(true);
      }
 else {
        removeButForout.setEnabled(false);
      }
    }
  }
);
  expressTableForout.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      TableItem[] items=expressTableForout.getSelection();
      currentIndexForOutExpress=expressTableForout.getSelectionIndex();
      currentSelectedOutExpress=(OutPutMappingData)items[0].getData();
      if (currentSelectedOutExpress.getParameterList().size() > 1) {
        denorButForOut.setEnabled(false);
        normalizeButForOut.setEnabled(false);
        return;
      }
      List<ParameterInfo> list=currentSelectedOutExpress.getParameterList();
      if (list.size() <= 0) {
        return;
      }
      List<ParameterInfo> infoList=currentSelectedOutExpress.getParameterList().get(0).getParameterInfos();
      IMetadataColumn column=currentSelectedOutExpress.getMetadataColumn();
      if (column == null) {
        return;
      }
      Boolean isArray=false;
      String isArrayName="String_Node_Str";
      if (currentSelectedOutExpress != null) {
        if (currentSelectedOutExpress.getParameterName() != null) {
          isArrayName=currentSelectedOutExpress.getParameterName();
        }
        if ((currentSelectedOutExpress.getParameterList().get(0).getArraySize() != 0) && !isArrayName.endsWith("String_Node_Str")) {
          isArray=true;
        }
        if (currentSelectedOutExpress.getParameterName().contains("String_Node_Str") && !currentSelectedOutExpress.getParameterName().contains("String_Node_Str")) {
          isArray=true;
        }
      }
      if (isArray && !(column.getTalendType().equals("String_Node_Str"))) {
        denorButForOut.setEnabled(true);
      }
 else {
        denorButForOut.setEnabled(false);
      }
      if (column.getTalendType().equals("String_Node_Str") && !isArray) {
        normalizeButForOut.setEnabled(true);
      }
 else {
        normalizeButForOut.setEnabled(false);
      }
    }
  }
);
  addListButForOut.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      Shell shell=uiParent.getShell();
      TableItem[] items=rowTableForout.getSelection();
      if (items.length <= 0) {
        return;
      }
      ParameterInfo para=((OutPutMappingData)items[0].getData()).getParameter();
      if (para.getArraySize() == -1 && para.getParameterInfos().isEmpty()) {
        InputDialog dlg=new InputDialog(shell,"String_Node_Str",Messages.getString("String_Node_Str"),"String_Node_Str",new InputIndexValidator());
        int openCode=dlg.open();
        if (openCode == InputDialog.OK) {
          String indexValue=dlg.getValue();
          OutPutMappingData data=new OutPutMappingData();
          data.setParameter(para);
          if (para.getParent() != null) {
            String name=((OutPutMappingData)items[0].getData()).getParameterName() + "String_Node_Str" + indexValue+ "String_Node_Str";
            data.setParameterName(name);
          }
 else {
            data.setParameterName(para.getName());
          }
          if (currentElementIndexForOut == 0) {
            rowoutPutTableView.getExtendedTableModel().add(data,-1);
          }
 else {
            rowoutPutTableView.getExtendedTableModel().add(data,currentElementIndexForOut + 1);
          }
          rowTableForout.setSelection(currentElementIndexForOut);
          rowoutPutTableView.getTableViewerCreator().getTableViewer().refresh();
        }
        return;
      }
      AddListDialog dialog=new AddListDialog(shell,((OutPutMappingData)items[0].getData()).getParameter(),"String_Node_Str",URLValue,serverConfig);
      dialog.setTitle(Messages.getString("String_Node_Str"));
      Rectangle boundsMapper=new Rectangle(50,50,100,50);
      if (ExternalWebServiceUIProperties.isShellMaximized()) {
        dialog.setMaximized(ExternalWebServiceUIProperties.isShellMaximized());
      }
 else {
        boundsMapper=ExternalWebServiceUIProperties.getBoundsMapper();
        if (boundsMapper.x < 0) {
          boundsMapper.x=0;
        }
        if (boundsMapper.y < 0) {
          boundsMapper.y=0;
        }
        dialog.setSize(boundsMapper);
        if (dialog.open() == AddListDialog.OK) {
          multiSelectedInChildren=dialog.getParamList();
          if (multiSelectedInChildren != null && !multiSelectedInChildren.isEmpty()) {
            int selectAmount=multiSelectedInChildren.size();
            for (int i=0; i < selectAmount; i++) {
              ParameterInfo paramet=multiSelectedInChildren.get(i);
              OutPutMappingData data=new OutPutMappingData();
              data.setParameter(paramet);
              if (paramet.getParent() != null) {
                String name=dialog.getParaUtil().getArrayFullName(paramet);
                if (name.contains("String_Node_Str") && name.contains("String_Node_Str")) {
                  int index=name.indexOf("String_Node_Str");
                  name=name.substring(0,index);
                }
                data.setParameterName(name);
              }
 else {
                data.setParameterName(paramet.getName());
              }
              rowoutPutTableView.getExtendedTableModel().add(data,currentElementIndexForOut + i + 1);
            }
            rowoutPutTableView.getTableViewerCreator().getTableViewer().refresh();
            rowTableForout.setSelection(currentElementIndexForOut);
          }
 else {
            currentSelectedOutChildren=dialog.getSelectedParaInfo();
            if (currentSelectedOutChildren == null || currentSelectedOutChildren.getName() == null) {
              return;
            }
            if (currentElementIndexForOut >= 0) {
              OutPutMappingData data=new OutPutMappingData();
              data.setParameter(currentSelectedOutChildren);
              if (currentSelectedOutChildren.getParent() != null) {
                String name=dialog.getParaUtil().getArrayFullName(currentSelectedOutChildren);
                data.setParameterName(name);
              }
 else {
                data.setParameterName(currentSelectedOutChildren.getName());
              }
              rowoutPutTableView.getExtendedTableModel().add(data,currentElementIndexForOut + 1);
              rowoutPutTableView.getTableViewerCreator().getTableViewer().refresh();
              rowTableForout.setSelection(currentElementIndexForOut);
            }
          }
        }
      }
    }
  }
);
  removeButForout.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      TableItem[] items=rowTableForout.getSelection();
      for (      TableItem item : items) {
        OutPutMappingData info=(OutPutMappingData)item.getData();
        rowoutPutTableView.getExtendedTableModel().remove(info);
        tabTotabLinkForout.updateLinksStyleAndControlsSelection(rowTableForout,true);
      }
      items=rowTableForout.getSelection();
      if (((OutPutMappingData)items[0].getData()).getParameter().getParameterInfos().size() == 0) {
        addListButForOut.setEnabled(false);
      }
      if ((((OutPutMappingData)items[0].getData()).getParameter()).getParent() == null) {
        removeButForout.setEnabled(false);
      }
      rowoutPutTableView.getTableViewerCreator().getTableViewer().refresh();
    }
  }
);
  normalizeButForOut.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      TableItem[] items=expressTableForout.getSelection();
      OutPutMappingData currentData=(OutPutMappingData)items[0].getData();
      int currentIndex=expressTableForout.getSelectionIndex();
      String parameterName=currentData.getParameterName();
      if (!(parameterName.contains("String_Node_Str") && parameterName.contains("String_Node_Str"))) {
        ExtendedTableModel model=expressoutPutTableView.getExtendedTableModel();
        currentData.setParameterName("String_Node_Str" + parameterName + "String_Node_Str");
        model.remove(currentIndex);
        model.add(currentData,currentIndex);
      }
    }
  }
);
  denorButForOut.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      TableItem[] items=expressTableForout.getSelection();
      OutPutMappingData currentData=(OutPutMappingData)items[0].getData();
      int currentIndex=expressTableForout.getSelectionIndex();
      String parameterName=((OutPutMappingData)items[0].getData()).getParameterName();
      if (!(parameterName.contains("String_Node_Str") && parameterName.contains("String_Node_Str"))) {
        ExtendedTableModel model=expressoutPutTableView.getExtendedTableModel();
        currentData.setParameterName("String_Node_Str" + parameterName + "String_Node_Str");
        model.remove(currentIndex);
        model.add(currentData,currentIndex);
      }
    }
  }
);
  schemaButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      MetadataDialog metaDialog=null;
      List outPutConnections=outputNode.getOutgoingConnections();
      if (inputMetaCopy != null && inputNode != null && outPutConnections != null && !outPutConnections.isEmpty()) {
        metaDialog=new MetadataDialog(uiParent.getShell(),inputMetaCopy,inputNode,outputMetaCopy,outputNode,null);
      }
 else {
        metaDialog=new MetadataDialog(uiParent.getShell(),outputMetaCopy,outputNode,null);
      }
      int openCode=metaDialog.open();
      if (openCode == MetadataDialog.OK) {
        inputMetaCopy=metaDialog.getInputMetaData();
        outputMetaCopy=metaDialog.getOutputMetaData();
        if (inputMetadata != null) {
          if (inputMetaCopy != null && !inputMetaCopy.sameMetadataAs(temInputMetadata,IMetadataColumn.OPTIONS_NONE)) {
            List<IMetadataColumn> inNewColumn=inputMetaCopy.getListColumns();
            inPutcolumnList.clear();
            inPutcolumnList.addAll(inNewColumn);
            temInputMetadata=inputMetaCopy.clone();
            columnInPutTableView.getTableViewerCreator().getTableViewer().refresh();
          }
        }
        if (!outputMetaCopy.sameMetadataAs(temOutputMetadata,IMetadataColumn.OPTIONS_NONE)) {
          List<IMetadataColumn> outNewColumn=outputMetaCopy.getListColumns();
          if (outNewColumn.isEmpty()) {
            outPutcolumnList.clear();
          }
 else {
            EList schemaMetadataColumn=null;
            if (connection != null) {
              Set<org.talend.core.model.metadata.builder.connection.MetadataTable> tables=ConnectionHelper.getTables(connection);
              Iterator it=tables.iterator();
              while (it.hasNext()) {
                org.talend.core.model.metadata.builder.connection.MetadataTable metadatatable=(org.talend.core.model.metadata.builder.connection.MetadataTable)it.next();
                if (metadatatable.getLabel().equals("String_Node_Str")) {
                  schemaMetadataColumn=metadatatable.getColumns();
                }
              }
            }
            for (int i=0; i < outPutcolumnList.size(); i++) {
              OutPutMappingData outcol=outPutcolumnList.get(i);
              IMetadataColumn oldCol=outcol.getMetadataColumn();
              if (!outcol.getOutputColumnValue().equals(oldCol.getLabel())) {
                if (connection != null) {
                  for (int j=0; j < schemaMetadataColumn.size(); j++) {
                    MetadataColumn mcolumn=(MetadataColumn)schemaMetadataColumn.get(j);
                    if (mcolumn.getLabel().equals(outcol.getOutputColumnValue())) {
                      mcolumn.setLabel(oldCol.getLabel());
                      mcolumn.setOriginalField(oldCol.getLabel());
                      mcolumn.setTalendType(oldCol.getTalendType());
                    }
                  }
                }
                outcol.setOutputColumnValue(oldCol.getLabel());
              }
            }
            for (int i=0; i < outNewColumn.size(); i++) {
              IMetadataColumn newCol=outNewColumn.get(i);
              if (isAdd(newCol,outPutcolumnList)) {
                forOutColumnList.add(newCol);
                OutPutMappingData outData=new OutPutMappingData();
                outData.setOutputColumnValue(newCol.getLabel());
                outData.setMetadataColumn(newCol);
                outPutcolumnList.add(outData);
                if (connection != null) {
                  MetadataColumn metadataColumn=ConnectionFactory.eINSTANCE.createMetadataColumn();
                  metadataColumn.setLabel(newCol.getLabel());
                  metadataColumn.setOriginalField(newCol.getLabel());
                  metadataColumn.setTalendType(newCol.getTalendType());
                  schemaMetadataColumn.add(metadataColumn);
                }
              }
            }
            for (int i=0; i < outPutcolumnList.size(); i++) {
              OutPutMappingData outcol=outPutcolumnList.get(i);
              IMetadataColumn oldCol=outcol.getMetadataColumn();
              if (isDelete(oldCol,outNewColumn)) {
                if (schemaMetadataColumn != null) {
                  for (int j=0; j < schemaMetadataColumn.size(); j++) {
                    MetadataColumn mcolumn=(MetadataColumn)schemaMetadataColumn.get(j);
                    if (mcolumn.getLabel().equals(oldCol.getLabel())) {
                      schemaMetadataColumn.remove(mcolumn);
                      j--;
                    }
                  }
                }
                outPutcolumnList.remove(outcol);
                i--;
              }
            }
            for (int i=0; i < outputColumnCompareList.size(); i++) {
              OutPutMappingData outcol=outputColumnCompareList.get(i);
              IMetadataColumn oldCol=outcol.getMetadataColumn();
              if (isDelete(oldCol,outNewColumn)) {
                if (schemaMetadataColumn != null) {
                  for (int j=0; j < schemaMetadataColumn.size(); j++) {
                    MetadataColumn mcolumn=(MetadataColumn)schemaMetadataColumn.get(j);
                    if (mcolumn.getLabel().equals(oldCol.getLabel())) {
                      schemaMetadataColumn.remove(mcolumn);
                      j--;
                    }
                  }
                }
              }
            }
          }
          temOutputMetadata=outputMetaCopy.clone();
          expressoutPutTableView.getTableViewerCreator().getTableViewer().refresh();
        }
      }
 else       if (openCode == MetadataDialog.CANCEL) {
        outputMetaCopy=temOutputMetadata.clone();
        return;
      }
    }
    private boolean isDeleteInputColumn(    IMetadataColumn oldCol,    List<IMetadataColumn> inNewColumn){
      for (int i=0; i < inNewColumn.size(); i++) {
        IMetadataColumn newCol=inNewColumn.get(i);
        if ((oldCol.getLabel()).equals(newCol.getLabel())) {
          return false;
        }
      }
      return true;
    }
    private boolean isAddInputColumn(    IMetadataColumn newCol,    List<IMetadataColumn> inPutcolumnList){
      for (int i=0; i < inPutcolumnList.size(); i++) {
        if ((newCol.getLabel()).equals(inPutcolumnList.get(i).getLabel())) {
          return false;
        }
      }
      return true;
    }
    private boolean isDelete(    IMetadataColumn oldCol,    List<IMetadataColumn> list){
      for (int i=0; i < list.size(); i++) {
        IMetadataColumn newCol=list.get(i);
        if ((oldCol.getLabel()).equals(newCol.getLabel())) {
          return false;
        }
      }
      return true;
    }
    private boolean isAdd(    IMetadataColumn newCol,    List<OutPutMappingData> outOldcolumnList){
      for (int i=0; i < outOldcolumnList.size(); i++) {
        IMetadataColumn outIter=outOldcolumnList.get(i).getMetadataColumn();
        if ((newCol.getLabel()).equals(outIter.getLabel())) {
          return false;
        }
      }
      return true;
    }
  }
);
}

Fixed version (ground truth):
private void addListenerForOutputCom(){
  rowTableForout.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      TableItem[] items=rowTableForout.getSelection();
      currentElementIndexForOut=rowTableForout.getSelectionIndex();
      currentOutputParameter=((OutPutMappingData)items[0].getData()).getParameter();
      currentOutputMappingData=(OutPutMappingData)items[0].getData();
      List<ParameterInfo> infoList=currentOutputParameter.getParameterInfos();
      ParameterInfo infoPa=currentOutputParameter.getParent();
      Boolean isArray=false;
      String isArrayName="String_Node_Str";
      if (currentOutputMappingData.getParameterName() != null) {
        isArrayName=currentOutputMappingData.getParameterName();
      }
      if ((currentOutputMappingData.getParameter().getArraySize() == -1 || currentOutputMappingData.getParameter().getArraySize() > 1) && !isArrayName.endsWith("String_Node_Str")) {
        isArray=true;
        isOutPutArray=true;
      }
      if (infoList != null && infoList.size() > 0 || isArray) {
        addListButForOut.setEnabled(true);
      }
 else {
        addListButForOut.setEnabled(false);
      }
      if (infoPa != null) {
        removeButForout.setEnabled(true);
      }
 else {
        removeButForout.setEnabled(false);
      }
    }
  }
);
  expressTableForout.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      TableItem[] items=expressTableForout.getSelection();
      currentIndexForOutExpress=expressTableForout.getSelectionIndex();
      currentSelectedOutExpress=(OutPutMappingData)items[0].getData();
      if (currentSelectedOutExpress.getParameterList().size() > 1) {
        denorButForOut.setEnabled(false);
        normalizeButForOut.setEnabled(false);
        return;
      }
      List<ParameterInfo> list=currentSelectedOutExpress.getParameterList();
      if (list.size() <= 0) {
        return;
      }
      List<ParameterInfo> infoList=currentSelectedOutExpress.getParameterList().get(0).getParameterInfos();
      IMetadataColumn column=currentSelectedOutExpress.getMetadataColumn();
      if (column == null) {
        return;
      }
      Boolean isArray=false;
      String isArrayName="String_Node_Str";
      if (currentSelectedOutExpress != null) {
        if (currentSelectedOutExpress.getParameterName() != null) {
          isArrayName=currentSelectedOutExpress.getParameterName();
        }
        if ((currentSelectedOutExpress.getParameterList().get(0).getArraySize() != 0) && !isArrayName.endsWith("String_Node_Str")) {
          isArray=true;
        }
        if (currentSelectedOutExpress.getParameterName().contains("String_Node_Str") && !currentSelectedOutExpress.getParameterName().contains("String_Node_Str")) {
          isArray=true;
        }
      }
      if (isArray && !(column.getTalendType().equals("String_Node_Str"))) {
        denorButForOut.setEnabled(true);
      }
 else {
        denorButForOut.setEnabled(false);
      }
      if (column.getTalendType().equals("String_Node_Str") && !isArray) {
        normalizeButForOut.setEnabled(true);
      }
 else {
        normalizeButForOut.setEnabled(false);
      }
    }
  }
);
  addListButForOut.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      Shell shell=uiParent.getShell();
      TableItem[] items=rowTableForout.getSelection();
      if (items.length <= 0) {
        return;
      }
      ParameterInfo para=((OutPutMappingData)items[0].getData()).getParameter();
      if (para.getArraySize() == -1 && para.getParameterInfos().isEmpty()) {
        InputDialog dlg=new InputDialog(shell,"String_Node_Str",Messages.getString("String_Node_Str"),"String_Node_Str",new InputIndexValidator());
        int openCode=dlg.open();
        if (openCode == InputDialog.OK) {
          String indexValue=dlg.getValue();
          OutPutMappingData data=new OutPutMappingData();
          data.setParameter(para);
          if (para.getParent() != null) {
            String name=((OutPutMappingData)items[0].getData()).getParameterName() + "String_Node_Str" + indexValue+ "String_Node_Str";
            data.setParameterName(name);
          }
 else {
            data.setParameterName(para.getName());
          }
          if (currentElementIndexForOut == 0) {
            rowoutPutTableView.getExtendedTableModel().add(data,-1);
          }
 else {
            rowoutPutTableView.getExtendedTableModel().add(data,currentElementIndexForOut + 1);
          }
          rowTableForout.setSelection(currentElementIndexForOut);
          rowoutPutTableView.getTableViewerCreator().getTableViewer().refresh();
        }
        return;
      }
      AddListDialog dialog=new AddListDialog(shell,((OutPutMappingData)items[0].getData()).getParameter(),"String_Node_Str",URLValue,serverConfig);
      dialog.setTitle(Messages.getString("String_Node_Str"));
      Rectangle boundsMapper=new Rectangle(50,50,100,50);
      if (ExternalWebServiceUIProperties.isShellMaximized()) {
        dialog.setMaximized(ExternalWebServiceUIProperties.isShellMaximized());
      }
 else {
        boundsMapper=ExternalWebServiceUIProperties.getBoundsMapper();
        if (boundsMapper.x < 0) {
          boundsMapper.x=0;
        }
        if (boundsMapper.y < 0) {
          boundsMapper.y=0;
        }
        dialog.setSize(boundsMapper);
        if (dialog.open() == AddListDialog.OK) {
          multiSelectedInChildren=dialog.getParamList();
          if (multiSelectedInChildren != null && !multiSelectedInChildren.isEmpty()) {
            int selectAmount=multiSelectedInChildren.size();
            for (int i=0; i < selectAmount; i++) {
              ParameterInfo paramet=multiSelectedInChildren.get(i);
              OutPutMappingData data=new OutPutMappingData();
              data.setParameter(paramet);
              if (paramet.getParent() != null) {
                String name=dialog.getParaUtil().getArrayFullName(paramet);
                if (name.contains("String_Node_Str") && name.contains("String_Node_Str")) {
                  int index=name.indexOf("String_Node_Str");
                  name=name.substring(0,index);
                }
                if (name.contains("String_Node_Str")) {
                  name=name.substring(0,10) + "String_Node_Str" + name.substring(11,name.length());
                }
                data.setParameterName(name);
              }
 else {
                data.setParameterName(paramet.getName());
              }
              rowoutPutTableView.getExtendedTableModel().add(data,currentElementIndexForOut + i + 1);
            }
            rowoutPutTableView.getTableViewerCreator().getTableViewer().refresh();
            rowTableForout.setSelection(currentElementIndexForOut);
          }
 else {
            currentSelectedOutChildren=dialog.getSelectedParaInfo();
            if (currentSelectedOutChildren == null || currentSelectedOutChildren.getName() == null) {
              return;
            }
            if (currentElementIndexForOut >= 0) {
              OutPutMappingData data=new OutPutMappingData();
              data.setParameter(currentSelectedOutChildren);
              if (currentSelectedOutChildren.getParent() != null) {
                String name=dialog.getParaUtil().getArrayFullName(currentSelectedOutChildren);
                data.setParameterName(name);
              }
 else {
                data.setParameterName(currentSelectedOutChildren.getName());
              }
              rowoutPutTableView.getExtendedTableModel().add(data,currentElementIndexForOut + 1);
              rowoutPutTableView.getTableViewerCreator().getTableViewer().refresh();
              rowTableForout.setSelection(currentElementIndexForOut);
            }
          }
        }
      }
    }
  }
);
  removeButForout.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      TableItem[] items=rowTableForout.getSelection();
      for (      TableItem item : items) {
        OutPutMappingData info=(OutPutMappingData)item.getData();
        rowoutPutTableView.getExtendedTableModel().remove(info);
        tabTotabLinkForout.updateLinksStyleAndControlsSelection(rowTableForout,true);
      }
      items=rowTableForout.getSelection();
      if (((OutPutMappingData)items[0].getData()).getParameter().getParameterInfos().size() == 0) {
        addListButForOut.setEnabled(false);
      }
      if ((((OutPutMappingData)items[0].getData()).getParameter()).getParent() == null) {
        removeButForout.setEnabled(false);
      }
      rowoutPutTableView.getTableViewerCreator().getTableViewer().refresh();
    }
  }
);
  normalizeButForOut.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      TableItem[] items=expressTableForout.getSelection();
      OutPutMappingData currentData=(OutPutMappingData)items[0].getData();
      int currentIndex=expressTableForout.getSelectionIndex();
      String parameterName=currentData.getParameterName();
      if (!(parameterName.contains("String_Node_Str") && parameterName.contains("String_Node_Str"))) {
        ExtendedTableModel model=expressoutPutTableView.getExtendedTableModel();
        currentData.setParameterName("String_Node_Str" + parameterName + "String_Node_Str");
        model.remove(currentIndex);
        model.add(currentData,currentIndex);
      }
    }
  }
);
  denorButForOut.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      TableItem[] items=expressTableForout.getSelection();
      OutPutMappingData currentData=(OutPutMappingData)items[0].getData();
      int currentIndex=expressTableForout.getSelectionIndex();
      String parameterName=((OutPutMappingData)items[0].getData()).getParameterName();
      if (!(parameterName.contains("String_Node_Str") && parameterName.contains("String_Node_Str"))) {
        ExtendedTableModel model=expressoutPutTableView.getExtendedTableModel();
        currentData.setParameterName("String_Node_Str" + parameterName + "String_Node_Str");
        model.remove(currentIndex);
        model.add(currentData,currentIndex);
      }
    }
  }
);
  schemaButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      MetadataDialog metaDialog=null;
      List outPutConnections=outputNode.getOutgoingConnections();
      if (inputMetaCopy != null && inputNode != null && outPutConnections != null && !outPutConnections.isEmpty()) {
        metaDialog=new MetadataDialog(uiParent.getShell(),inputMetaCopy,inputNode,outputMetaCopy,outputNode,null);
      }
 else {
        metaDialog=new MetadataDialog(uiParent.getShell(),outputMetaCopy,outputNode,null);
      }
      int openCode=metaDialog.open();
      if (openCode == MetadataDialog.OK) {
        inputMetaCopy=metaDialog.getInputMetaData();
        outputMetaCopy=metaDialog.getOutputMetaData();
        if (inputMetadata != null) {
          if (inputMetaCopy != null && !inputMetaCopy.sameMetadataAs(temInputMetadata,IMetadataColumn.OPTIONS_NONE)) {
            List<IMetadataColumn> inNewColumn=inputMetaCopy.getListColumns();
            inPutcolumnList.clear();
            inPutcolumnList.addAll(inNewColumn);
            temInputMetadata=inputMetaCopy.clone();
            columnInPutTableView.getTableViewerCreator().getTableViewer().refresh();
          }
        }
        if (!outputMetaCopy.sameMetadataAs(temOutputMetadata,IMetadataColumn.OPTIONS_NONE)) {
          List<IMetadataColumn> outNewColumn=outputMetaCopy.getListColumns();
          if (outNewColumn.isEmpty()) {
            outPutcolumnList.clear();
          }
 else {
            EList schemaMetadataColumn=null;
            if (connection != null) {
              Set<org.talend.core.model.metadata.builder.connection.MetadataTable> tables=ConnectionHelper.getTables(connection);
              Iterator it=tables.iterator();
              while (it.hasNext()) {
                org.talend.core.model.metadata.builder.connection.MetadataTable metadatatable=(org.talend.core.model.metadata.builder.connection.MetadataTable)it.next();
                if (metadatatable.getLabel().equals("String_Node_Str")) {
                  schemaMetadataColumn=metadatatable.getColumns();
                }
              }
            }
            for (int i=0; i < outPutcolumnList.size(); i++) {
              OutPutMappingData outcol=outPutcolumnList.get(i);
              IMetadataColumn oldCol=outcol.getMetadataColumn();
              if (!outcol.getOutputColumnValue().equals(oldCol.getLabel())) {
                if (connection != null) {
                  for (int j=0; j < schemaMetadataColumn.size(); j++) {
                    MetadataColumn mcolumn=(MetadataColumn)schemaMetadataColumn.get(j);
                    if (mcolumn.getLabel().equals(outcol.getOutputColumnValue())) {
                      mcolumn.setLabel(oldCol.getLabel());
                      mcolumn.setOriginalField(oldCol.getLabel());
                      mcolumn.setTalendType(oldCol.getTalendType());
                    }
                  }
                }
                outcol.setOutputColumnValue(oldCol.getLabel());
              }
            }
            for (int i=0; i < outNewColumn.size(); i++) {
              IMetadataColumn newCol=outNewColumn.get(i);
              if (isAdd(newCol,outPutcolumnList)) {
                forOutColumnList.add(newCol);
                OutPutMappingData outData=new OutPutMappingData();
                outData.setOutputColumnValue(newCol.getLabel());
                outData.setMetadataColumn(newCol);
                outPutcolumnList.add(outData);
                if (connection != null) {
                  MetadataColumn metadataColumn=ConnectionFactory.eINSTANCE.createMetadataColumn();
                  metadataColumn.setLabel(newCol.getLabel());
                  metadataColumn.setOriginalField(newCol.getLabel());
                  metadataColumn.setTalendType(newCol.getTalendType());
                  schemaMetadataColumn.add(metadataColumn);
                }
              }
            }
            for (int i=0; i < outPutcolumnList.size(); i++) {
              OutPutMappingData outcol=outPutcolumnList.get(i);
              IMetadataColumn oldCol=outcol.getMetadataColumn();
              if (isDelete(oldCol,outNewColumn)) {
                if (schemaMetadataColumn != null) {
                  for (int j=0; j < schemaMetadataColumn.size(); j++) {
                    MetadataColumn mcolumn=(MetadataColumn)schemaMetadataColumn.get(j);
                    if (mcolumn.getLabel().equals(oldCol.getLabel())) {
                      schemaMetadataColumn.remove(mcolumn);
                      j--;
                    }
                  }
                }
                outPutcolumnList.remove(outcol);
                i--;
              }
            }
            for (int i=0; i < outputColumnCompareList.size(); i++) {
              OutPutMappingData outcol=outputColumnCompareList.get(i);
              IMetadataColumn oldCol=outcol.getMetadataColumn();
              if (isDelete(oldCol,outNewColumn)) {
                if (schemaMetadataColumn != null) {
                  for (int j=0; j < schemaMetadataColumn.size(); j++) {
                    MetadataColumn mcolumn=(MetadataColumn)schemaMetadataColumn.get(j);
                    if (mcolumn.getLabel().equals(oldCol.getLabel())) {
                      schemaMetadataColumn.remove(mcolumn);
                      j--;
                    }
                  }
                }
              }
            }
          }
          temOutputMetadata=outputMetaCopy.clone();
          expressoutPutTableView.getTableViewerCreator().getTableViewer().refresh();
        }
      }
 else       if (openCode == MetadataDialog.CANCEL) {
        outputMetaCopy=temOutputMetadata.clone();
        return;
      }
    }
    private boolean isDeleteInputColumn(    IMetadataColumn oldCol,    List<IMetadataColumn> inNewColumn){
      for (int i=0; i < inNewColumn.size(); i++) {
        IMetadataColumn newCol=inNewColumn.get(i);
        if ((oldCol.getLabel()).equals(newCol.getLabel())) {
          return false;
        }
      }
      return true;
    }
    private boolean isAddInputColumn(    IMetadataColumn newCol,    List<IMetadataColumn> inPutcolumnList){
      for (int i=0; i < inPutcolumnList.size(); i++) {
        if ((newCol.getLabel()).equals(inPutcolumnList.get(i).getLabel())) {
          return false;
        }
      }
      return true;
    }
    private boolean isDelete(    IMetadataColumn oldCol,    List<IMetadataColumn> list){
      for (int i=0; i < list.size(); i++) {
        IMetadataColumn newCol=list.get(i);
        if ((oldCol.getLabel()).equals(newCol.getLabel())) {
          return false;
        }
      }
      return true;
    }
    private boolean isAdd(    IMetadataColumn newCol,    List<OutPutMappingData> outOldcolumnList){
      for (int i=0; i < outOldcolumnList.size(); i++) {
        IMetadataColumn outIter=outOldcolumnList.get(i).getMetadataColumn();
        if ((newCol.getLabel()).equals(outIter.getLabel())) {
          return false;
        }
      }
      return true;
    }
  }
);
}