Program: 119788
Project: 119788
Buggy source:
@Override public void run(IProgressMonitor monitor){
  TreeItem root=xmlViewer.getTree().getItem(0);
  boolean noCurSchema=false;
  if (root != null && root.getData() != null && root.getData() instanceof HL7TreeNode) {
    HL7TreeNode node=(HL7TreeNode)root.getData();
    if (node.getColumnLabel().equals("String_Node_Str")) {
      noCurSchema=true;
    }
  }
  if (getManager().getHl7Component().isHL7Output()) {
    if (getManager() instanceof HL7OutputManager) {
      List<HL7TreeNode> mappableNodes=new ArrayList<HL7TreeNode>();
      IElementParameter param=getManager().getHl7Component().getElementParameterFromField(EParameterFieldType.PROPERTY_TYPE);
      String value=(String)param.getChildParameters().get(EParameterName.PROPERTY_TYPE.getName()).getValue();
      if (value.equals(EmfComponent.BUILTIN) && !noCurSchema) {
        List<HL7TreeNode> treeData=((HL7OutputManager)getManager()).getTreeData(((HL7OutputManager)getManager()).getCurrentSchema(false));
        for (        HL7TreeNode data : treeData) {
          if (data.isMain()) {
            if (data.hasChildren()) {
              mappableNodes.addAll(data.getChildren());
            }
          }
 else {
            mappableNodes.add(data);
          }
        }
      }
 else {
        mappableNodes=((HL7OutputManager)getManager()).getTreeData("String_Node_Str");
      }
      createLoopLinks(mappableNodes);
      xmlViewer.refresh();
      getBackgroundRefresher().refreshBackground();
    }
  }
 else {
    List<TreeItem> allItems=TreeUtils.collectAllItems(root);
    monitorWrap=new EventLoopProgressMonitor(monitor);
    String taskName=Messages.getString("String_Node_Str");
    int totalWork=allItems.size();
    monitorWrap.beginTask(taskName,totalWork);
    for (int i=0; i < totalWork; i++) {
      if (monitorWrap.isCanceled()) {
        return;
      }
      TreeItem treeItem=allItems.get(i);
      HL7TreeNode node=(HL7TreeNode)treeItem.getData();
      if (node.getColumn() == null) {
        continue;
      }
      createLoopLinks(node.getColumn().getLabel(),treeItem,monitorWrap,i == totalWork - 1);
      monitorWrap.worked(1);
    }
    monitorWrap.done();
  }
}

Fixed version (ground truth):
@Override public void run(IProgressMonitor monitor){
  TreeItem root=xmlViewer.getTree().getItem(0);
  List<HL7TreeNode> mappableNodes=new ArrayList<HL7TreeNode>();
  if (getManager().getHl7Component().isHL7Output()) {
    if (getManager() instanceof HL7OutputManager) {
      mappableNodes=((HL7OutputManager)getManager()).getTreeData("String_Node_Str");
      createLoopLinks(mappableNodes);
      xmlViewer.refresh();
      getBackgroundRefresher().refreshBackground();
    }
  }
 else {
    List<TreeItem> allItems=TreeUtils.collectAllItems(root);
    monitorWrap=new EventLoopProgressMonitor(monitor);
    String taskName=Messages.getString("String_Node_Str");
    int totalWork=allItems.size();
    monitorWrap.beginTask(taskName,totalWork);
    for (int i=0; i < totalWork; i++) {
      if (monitorWrap.isCanceled()) {
        return;
      }
      TreeItem treeItem=allItems.get(i);
      HL7TreeNode node=(HL7TreeNode)treeItem.getData();
      if (node.getColumn() == null) {
        continue;
      }
      createLoopLinks(node.getColumn().getLabel(),treeItem,monitorWrap,i == totalWork - 1);
      monitorWrap.worked(1);
    }
    monitorWrap.done();
  }
}