Program: 122074
Project: 122074
Buggy source:
@Override public void handleEvent(ListenableListEvent event){
  if (event.type == TYPE.ADDED) {
    EList<OutputTreeNode> nodes=selectedOutputTree.getNodes();
    List<IMetadataColumn> metadataColumns=(List<IMetadataColumn>)event.addedObjects;
    if (event.index != null) {
      int index=event.index;
      for (      IMetadataColumn column : metadataColumns) {
        OutputTreeNode createTreeNode=XmlmapFactory.eINSTANCE.createOutputTreeNode();
        createTreeNode.setName(column.getLabel());
        createTreeNode.setType(column.getTalendType());
        createTreeNode.setNullable(column.isNullable());
        createTreeNode.setPattern(column.getPattern());
        createTreeNode.setXpath(XmlMapUtil.getXPath(selectedOutputTree.getName(),createTreeNode.getName(),createTreeNode.getNodeType()));
        selectedOutputTree.getNodes().add(index,createTreeNode);
        index=index + 1;
      }
    }
  }
 else   if (event.type == TYPE.REMOVED) {
    List<IMetadataColumn> metadataColumns=(List<IMetadataColumn>)event.removedObjects;
    List treeNodeToRemove=new ArrayList();
    for (    IMetadataColumn column : metadataColumns) {
      for (      TreeNode node : selectedOutputTree.getNodes()) {
        if (node.getName() != null && node.getName().equals(column.getLabel())) {
          XmlMapUtil.detachNodeConnections(node,copyOfMapData,true);
          treeNodeToRemove.add(node);
        }
      }
    }
    selectedOutputTree.getNodes().removeAll(treeNodeToRemove);
  }
 else   if (event.type == TYPE.SWAPED) {
    List<Integer> listIndexTarget=event.indicesTarget;
    List<Integer> listIndexOrignal=event.indicesOrigin;
    for (int i=0; i < listIndexOrignal.size(); i++) {
      int orignal=listIndexOrignal.get(i);
      int target=listIndexTarget.get(i);
      if (orignal < selectedOutputTree.getNodes().size()) {
        OutputTreeNode tempTreeNode=selectedOutputTree.getNodes().get(orignal);
        selectedOutputTree.getNodes().remove(orignal);
        selectedOutputTree.getNodes().add(target,tempTreeNode);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void handleEvent(ListenableListEvent event){
  if (event.type == TYPE.ADDED) {
    EList<OutputTreeNode> nodes=selectedOutputTree.getNodes();
    List<IMetadataColumn> metadataColumns=(List<IMetadataColumn>)event.addedObjects;
    if (event.index != null) {
      int index=event.index;
      for (      IMetadataColumn column : metadataColumns) {
        OutputTreeNode createTreeNode=XmlmapFactory.eINSTANCE.createOutputTreeNode();
        createTreeNode.setName(column.getLabel());
        createTreeNode.setType(column.getTalendType());
        createTreeNode.setNullable(column.isNullable());
        createTreeNode.setPattern(column.getPattern());
        createTreeNode.setXpath(XmlMapUtil.getXPath(selectedOutputTree.getName(),createTreeNode.getName(),createTreeNode.getNodeType()));
        selectedOutputTree.getNodes().add(index,createTreeNode);
        index=index + 1;
      }
    }
  }
 else   if (event.type == TYPE.REMOVED) {
    List<IMetadataColumn> metadataColumns=(List<IMetadataColumn>)event.removedObjects;
    List treeNodeToRemove=new ArrayList();
    for (    IMetadataColumn column : metadataColumns) {
      for (      TreeNode node : selectedOutputTree.getNodes()) {
        if (node.getName() != null && node.getName().equals(column.getLabel())) {
          XmlMapUtil.detachNodeConnections(node,copyOfMapData,true);
          treeNodeToRemove.add(node);
        }
      }
    }
    selectedOutputTree.getNodes().removeAll(treeNodeToRemove);
  }
 else   if (event.type == TYPE.SWAPED) {
    List<Integer> listIndexTarget=event.indicesTarget;
    List<Integer> listIndexOrignal=event.indicesOrigin;
    for (int i=0; i < listIndexOrignal.size(); i++) {
      int orignal=listIndexOrignal.get(i);
      int target=listIndexTarget.get(i);
      if (orignal < selectedOutputTree.getNodes().size()) {
        OutputTreeNode tempTreeNode=selectedOutputTree.getNodes().get(orignal);
        selectedOutputTree.getNodes().remove(orignal);
        selectedOutputTree.getNodes().add(target,tempTreeNode);
      }
    }
  }
 else   if (event.type == TYPE.REPLACED) {
    List added=(List)event.addedObjects;
    List removed=(List)event.removedObjects;
    List<IMetadataColumn> removedColumn=new ArrayList<IMetadataColumn>();
    List<IMetadataColumn> addedColumn=new ArrayList<IMetadataColumn>();
    if (!added.isEmpty()) {
      addedColumn.addAll((List<IMetadataColumn>)added.get(0));
    }
    if (!removed.isEmpty()) {
      removedColumn.addAll((List<IMetadataColumn>)removed.get(0));
    }
    Map<IMetadataColumn,OutputTreeNode> nodeMap=new HashMap<IMetadataColumn,OutputTreeNode>();
    for (int i=0; i < removedColumn.size(); i++) {
      IMetadataColumn column=removedColumn.get(i);
      OutputTreeNode node=selectedOutputTree.getNodes().get(i);
      boolean found=false;
      for (      IMetadataColumn columnAdded : addedColumn) {
        if (column.sameMetacolumnAs(columnAdded)) {
          nodeMap.put(columnAdded,node);
          found=true;
          break;
        }
      }
      if (!found) {
        XmlMapUtil.detachNodeConnections(node,copyOfMapData,true);
      }
    }
    boolean needCheck=false;
    if (selectedOutputTree.isMultiLoops()) {
      needCheck=true;
    }
    selectedOutputTree.getNodes().clear();
    for (    IMetadataColumn column : addedColumn) {
      OutputTreeNode treeNode=nodeMap.get(column);
      if (treeNode == null) {
        treeNode=XmlmapFactory.eINSTANCE.createOutputTreeNode();
        treeNode.setName(column.getLabel());
        treeNode.setType(column.getTalendType());
        treeNode.setNullable(column.isNullable());
        treeNode.setPattern(column.getPattern());
        treeNode.setXpath(XmlMapUtil.getXPath(selectedInputTree.getName(),treeNode.getName(),treeNode.getNodeType()));
        if (XmlMapUtil.DOCUMENT.equals(column.getTalendType())) {
          TreeNode createTreeNode=XmlmapFactory.eINSTANCE.createOutputTreeNode();
          createTreeNode.setName("String_Node_Str");
          createTreeNode.setType(XmlMapUtil.DEFAULT_DATA_TYPE);
          createTreeNode.setNodeType(NodeType.ELEMENT);
          createTreeNode.setXpath(XmlMapUtil.getXPath(treeNode.getXpath(),createTreeNode.getName(),createTreeNode.getNodeType()));
          createTreeNode.setLoop(true);
          createTreeNode.setMain(true);
          treeNode.getChildren().add(createTreeNode);
        }
      }
      selectedOutputTree.getNodes().add(treeNode);
    }
    if (needCheck) {
      List<TreeNode> newloopNodes=XmlMapUtil.getMultiLoopsForXmlTree(selectedOutputTree);
      if (newloopNodes.size() < 2) {
        selectedOutputTree.setMultiLoops(false);
      }
    }
    mapperUI.updateStatusBar();
    mapperUI.updateStatusBar();
  }
}