Program: 123296
Project: 123296
Buggy source:
protected void addButtonListeners(){
  previewBtn.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    final SelectionEvent e){
      refreshPreview();
    }
  }
);
  fetchBtn.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    final SelectionEvent e){
      fetchCodes();
    }
  }
);
  leftBtn.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    final SelectionEvent e){
      getUIManager().moveRecord(schemaTreeViewer,true);
      getUIManager().packSchemaTreeFirstColumn(schemaTreeViewer);
    }
  }
);
  rightBtn.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    final SelectionEvent e){
      getUIManager().moveRecord(schemaTreeViewer,false);
      getUIManager().packSchemaTreeFirstColumn(schemaTreeViewer);
    }
  }
);
  addRow.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      SchemasKeyData root=(SchemasKeyData)schemaTreeViewer.getInput();
      AddRowDialog dialog=new AddRowDialog(MultiSchemasUI.this.getShell(),root);
      if (Window.OK == dialog.open()) {
        Object input=schemaTreeViewer.getInput();
        if (input instanceof SchemasKeyData) {
          SchemasKeyData data=(SchemasKeyData)input;
          List<SchemasKeyData> all=data.getChildren();
          SchemasKeyData newData=new SchemasKeyData(dialog.getRecordValue());
          newData.setSeparator(dialog.getSepValue());
          newData.setUniqueRecord(dialog.getKeyValue());
          final IMetadataTable metadataTable=MetadataTool.getMetadataTableFromNode(getMultiSchemasComponent(),dialog.getKeyValue());
          if (metadataTable != null) {
            multiSchemaManager.createMultiSchemasColumns(newData,metadataTable.clone(true));
          }
 else {
            List<MultiMetadataColumn> colums=multiSchemaManager.createPropertiesColumns(newData);
            newData.setMetadataColumns(colums);
          }
          all.add(newData);
          data.addChild(newData);
          newData.setParent(data);
          schemaTreeViewer.refresh();
          int len=schemaTreeViewer.getTree().getItems().length;
          schemaTreeViewer.getTree().select(schemaTreeViewer.getTree().getItems()[len - 1]);
        }
        getUIManager().refreshSchemasDetailView(schemaTreeViewer,schemaDetailsViewer,getSchemaDetailModel());
      }
    }
  }
);
  removeRow.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      boolean needRefresh=false;
      if (schemaTreeViewer == null) {
        return;
      }
      SchemasKeyData removeData=null;
      ISelection selection=schemaTreeViewer.getSelection();
      Object input=schemaTreeViewer.getInput();
      if (selection instanceof IStructuredSelection) {
        Object element=((IStructuredSelection)selection).getFirstElement();
        if (element instanceof SchemasKeyData) {
          removeData=(SchemasKeyData)element;
        }
      }
      if (input instanceof SchemasKeyData) {
        SchemasKeyData data=(SchemasKeyData)input;
        List<SchemasKeyData> all=data.getChildren();
        if (all.contains(removeData)) {
          all.remove(removeData);
          schemaTreeViewer.setInput(data);
          needRefresh=true;
        }
        if (needRefresh) {
          schemaTreeViewer.refresh();
          int len=schemaTreeViewer.getTree().getItems().length;
          if (len > 0) {
            schemaTreeViewer.getTree().select(schemaTreeViewer.getTree().getItems()[len - 1]);
          }
          removeRow.setEnabled(!all.isEmpty());
          editSchema.setEnabled(!all.isEmpty());
          getUIManager().refreshSchemasDetailView(schemaTreeViewer,schemaDetailsViewer,getSchemaDetailModel());
        }
      }
    }
  }
);
  editSchema.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      ISelection selection=schemaTreeViewer.getSelection();
      SchemasKeyData selectedData=null;
      if (selection instanceof IStructuredSelection) {
        Object element=((IStructuredSelection)selection).getFirstElement();
        if (element instanceof SchemasKeyData) {
          selectedData=(SchemasKeyData)element;
          IMetadataTable metadataTable=MetadataTool.getMetadataTableFromNode(getMultiSchemasComponent(),selectedData.getUniqueRecord());
          if (metadataTable == null) {
            metadataTable=new org.talend.core.model.metadata.MetadataTable();
          }
          MetadataDialog dialog=new MetadataDialog(MultiSchemasUI.this.getShell(),metadataTable,getMultiSchemasComponent(),new CommandStackForComposite(MultiSchemasUI.this.getShell()));
          dialog.setText("String_Node_Str" + selectedData.getUniqueRecord());
          if (Window.OK == dialog.open()) {
            metadataTable=dialog.getOutputMetaData();
            if (!selectedData.getMetadataColumns().isEmpty()) {
              selectedData.getMetadataColumns().clear();
            }
            multiSchemaManager.createMultiSchemasColumns(selectedData,metadataTable);
            getUIManager().refreshSchemasDetailView(schemaTreeViewer,schemaDetailsViewer,getSchemaDetailModel());
          }
        }
      }
    }
  }
);
}

Fixed version (ground truth):
protected void addButtonListeners(){
  previewBtn.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    final SelectionEvent e){
      refreshPreview();
    }
  }
);
  fetchBtn.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    final SelectionEvent e){
      fetchCodes();
    }
  }
);
  leftBtn.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    final SelectionEvent e){
      getUIManager().moveRecord(schemaTreeViewer,true);
      getUIManager().packSchemaTreeFirstColumn(schemaTreeViewer);
    }
  }
);
  rightBtn.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    final SelectionEvent e){
      getUIManager().moveRecord(schemaTreeViewer,false);
      getUIManager().packSchemaTreeFirstColumn(schemaTreeViewer);
    }
  }
);
  addRow.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      SchemasKeyData root=(SchemasKeyData)schemaTreeViewer.getInput();
      AddRowDialog dialog=new AddRowDialog(MultiSchemasUI.this.getShell(),root);
      if (Window.OK == dialog.open()) {
        Object input=schemaTreeViewer.getInput();
        if (input instanceof SchemasKeyData) {
          SchemasKeyData data=(SchemasKeyData)input;
          List<SchemasKeyData> all=data.getChildren();
          SchemasKeyData newData=new SchemasKeyData(dialog.getRecordValue());
          newData.setSeparator(dialog.getSepValue());
          newData.setUniqueRecord(dialog.getKeyValue());
          final IMetadataTable metadataTable=MetadataTool.getMetadataTableFromNode(getMultiSchemasComponent(),dialog.getKeyValue());
          if (metadataTable != null) {
            multiSchemaManager.createMultiSchemasColumns(newData,metadataTable.clone(true));
          }
 else {
            List<MultiMetadataColumn> colums=multiSchemaManager.createPropertiesColumns(newData);
            newData.setMetadataColumns(colums);
          }
          all.add(newData);
          data.addChild(newData);
          newData.setParent(data);
          schemaTreeViewer.refresh();
          int len=schemaTreeViewer.getTree().getItems().length;
          schemaTreeViewer.getTree().select(schemaTreeViewer.getTree().getItems()[len - 1]);
        }
        getUIManager().refreshSchemasDetailView(schemaTreeViewer,schemaDetailsViewer,getSchemaDetailModel());
      }
    }
  }
);
  removeRow.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      boolean needRefresh=false;
      if (schemaTreeViewer == null) {
        return;
      }
      SchemasKeyData removeData=null;
      ISelection selection=schemaTreeViewer.getSelection();
      Object input=schemaTreeViewer.getInput();
      if (selection instanceof IStructuredSelection) {
        Object element=((IStructuredSelection)selection).getFirstElement();
        if (element instanceof SchemasKeyData) {
          removeData=(SchemasKeyData)element;
        }
      }
      if (input instanceof SchemasKeyData) {
        SchemasKeyData data=(SchemasKeyData)input;
        List<SchemasKeyData> all=data.getChildren();
        if (all.contains(removeData)) {
          all.remove(removeData);
          schemaTreeViewer.setInput(data);
          needRefresh=true;
        }
        if (needRefresh) {
          schemaTreeViewer.refresh();
          int len=schemaTreeViewer.getTree().getItems().length;
          if (len > 0) {
            schemaTreeViewer.getTree().select(schemaTreeViewer.getTree().getItems()[len - 1]);
          }
          removeRow.setEnabled(!all.isEmpty());
          editSchema.setEnabled(!all.isEmpty());
          getUIManager().refreshSchemasDetailView(schemaTreeViewer,schemaDetailsViewer,getSchemaDetailModel());
        }
      }
    }
  }
);
  editSchema.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      ISelection selection=schemaTreeViewer.getSelection();
      SchemasKeyData selectedData=null;
      if (selection instanceof IStructuredSelection) {
        Object element=((IStructuredSelection)selection).getFirstElement();
        if (element instanceof SchemasKeyData) {
          selectedData=(SchemasKeyData)element;
          IMetadataTable metadataTable=MetadataTool.getMetadataTableFromNode(getMultiSchemasComponent(),selectedData.getUniqueRecord());
          if (metadataTable == null) {
            metadataTable=new org.talend.core.model.metadata.MetadataTable();
          }
          metadataTable.getListColumns().clear();
          SchemasKeyData keydata=(SchemasKeyData)schemaTreeViewer.getInput();
          for (int i=0; i < keydata.getChildren().size(); i++) {
            if (selectedData.getUniqueRecord().equals(keydata.getChildren().get(i).getUniqueRecord())) {
              metadataTable.getListColumns().addAll(keydata.getChildren().get(i).getMetadataColumns());
              break;
            }
          }
          MetadataDialog dialog=new MetadataDialog(MultiSchemasUI.this.getShell(),metadataTable,getMultiSchemasComponent(),new CommandStackForComposite(MultiSchemasUI.this.getShell()));
          dialog.setText("String_Node_Str" + selectedData.getUniqueRecord());
          if (Window.OK == dialog.open()) {
            metadataTable=dialog.getOutputMetaData();
            if (!selectedData.getMetadataColumns().isEmpty()) {
              selectedData.getMetadataColumns().clear();
            }
            multiSchemaManager.createMultiSchemasColumns(selectedData,metadataTable);
            getUIManager().refreshSchemasDetailView(schemaTreeViewer,schemaDetailsViewer,getSchemaDetailModel());
          }
        }
      }
    }
  }
);
}