Program: 121255
Project: 121255
Buggy source:
@Override protected void removeTable(){
  CommandStack commandStack=graphicViewer.getEditDomain().getCommandStack();
  commandStack.execute(new Command(){
    @Override public void execute(){
      OutputXmlTreeEditPart currentSelectedOutputXmlTree=graphicViewer.getFiguresManager().getCurrentSelectedOutputTable();
      if (currentSelectedOutputXmlTree != null) {
        OutputXmlTree outputTree=(OutputXmlTree)currentSelectedOutputXmlTree.getModel();
        int indexOf=externalPart.getModelChildren().indexOf(outputTree);
        mapperComponent.getProcess().removeUniqueConnectionName(outputTree.getName());
        removeMetadataTableByName(outputTree.getName());
        for (        OutputTreeNode treeNode : outputTree.getNodes()) {
          XmlMapUtil.detachConnectionsSouce(treeNode,externalData);
        }
        externalData.getOutputTrees().remove(outputTree);
        XmlMapUtil.detachFilterSource(outputTree,externalData);
        indexOf=indexOf - 1;
        if (indexOf > -1 && (EditPart)externalPart.getChildren().get(indexOf) instanceof OutputXmlTreeEditPart) {
          graphicViewer.select((EditPart)externalPart.getChildren().get(indexOf));
        }
 else         if (indexOf > -1 && indexOf + 1 < externalPart.getChildren().size() && (EditPart)externalPart.getChildren().get(indexOf + 1) instanceof OutputXmlTreeEditPart) {
          graphicViewer.select((EditPart)externalPart.getChildren().get(indexOf + 1));
        }
 else {
          mapperManger.getMapperUI().getTabFolderEditors().getOutputMetaEditorView().setMetadataTableEditor(null);
        }
        mapperManger.getProblemsAnalyser().clearProblemsForTree(outputTree);
        mapperManger.getMapperUI().updateStatusBar();
      }
      if (externalData.getOutputTrees().isEmpty() && min_size.isEnabled()) {
        min_size.setEnabled(false);
      }
    }
  }
);
}

Fixed version (ground truth):
@Override protected void removeTable(){
  CommandStack commandStack=graphicViewer.getEditDomain().getCommandStack();
  commandStack.execute(new Command(){
    @Override public void execute(){
      OutputXmlTreeEditPart currentSelectedOutputXmlTree=graphicViewer.getFiguresManager().getCurrentSelectedOutputTable();
      if (currentSelectedOutputXmlTree != null) {
        OutputXmlTree outputTree=(OutputXmlTree)currentSelectedOutputXmlTree.getModel();
        int indexOf=externalPart.getModelChildren().indexOf(outputTree);
        mapperComponent.getProcess().removeUniqueConnectionName(outputTree.getName());
        removeMetadataTableByName(outputTree.getName());
        for (        OutputTreeNode treeNode : outputTree.getNodes()) {
          XmlMapUtil.detachConnectionsSouce(treeNode,externalData);
        }
        externalData.getOutputTrees().remove(outputTree);
        XmlMapUtil.detachFilterSource(outputTree,externalData);
        indexOf=indexOf - 1;
        if (indexOf > -1 && (EditPart)externalPart.getChildren().get(indexOf) instanceof OutputXmlTreeEditPart) {
          graphicViewer.select((EditPart)externalPart.getChildren().get(indexOf));
        }
 else         if (indexOf > -1 && indexOf + 1 < externalPart.getChildren().size() && (EditPart)externalPart.getChildren().get(indexOf + 1) instanceof OutputXmlTreeEditPart) {
          graphicViewer.select((EditPart)externalPart.getChildren().get(indexOf + 1));
        }
 else {
          mapperManger.getMapperUI().getTabFolderEditors().getOutputMetaEditorView().setMetadataTableEditor(null);
        }
        mapperManger.getProblemsAnalyser().clearProblemsForTree(outputTree);
        mapperManger.getMapperUI().updateStatusBar();
      }
      if (externalData.getOutputTrees().isEmpty() && min_size.isEnabled()) {
        min_size.setEnabled(false);
      }
      if (externalData.getOutputTrees().isEmpty() || externalData.getInputTrees().isEmpty()) {
        auto_map.setEnabled(false);
      }
    }
  }
);
}