Program: 139893
Project: 139893
Buggy source:
private void addTreeListener(final Tree tree){
  tree.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      TreeItem item=(TreeItem)e.item;
      if (DATA_PARAM.equals(item.getData(DATA_PARAM))) {
        tree.setMenu(null);
      }
 else {
        new TableTreeMenuProvider(tree).createTreeMenu();
      }
    }
  }
);
  tree.addTreeListener(new TreeAdapter(){
    @Override public void treeCollapsed(    TreeEvent e){
      ExpandableComposite theSuitedComposite=getTheSuitedComposite(e);
      ScrolledForm form=masterPage.getForm();
      Composite comp=masterPage.getChartComposite();
      if (theSuitedComposite != null && theSuitedComposite.isExpanded()) {
        getTheSuitedComposite(e).setExpanded(false);
      }
      comp.layout();
      form.reflow(true);
    }
    @Override public void treeExpanded(    TreeEvent e){
      ExpandableComposite theSuitedComposite=getTheSuitedComposite(e);
      ScrolledForm form=masterPage.getForm();
      Composite comp=masterPage.getChartComposite();
      if (theSuitedComposite != null && !theSuitedComposite.isExpanded()) {
        theSuitedComposite.setExpanded(true);
      }
      comp.layout();
      form.reflow(true);
    }
  }
);
  tree.addMouseListener(new MouseAdapter(){
    @Override public void mouseDoubleClick(    MouseEvent e){
      TreeItem item=tree.getSelection()[0];
      if (item != null) {
        Object indicatorobj=item.getData(INDICATOR_UNIT_KEY);
        Object tableobj=item.getData(TABLE_INDICATOR_KEY);
        if (tableobj != null && indicatorobj == null) {
          showAddDQRuleDialog(item,(TableIndicator)tableobj);
        }
 else         if (tableobj != null && indicatorobj != null) {
          openIndicatorOptionDialog(null,item);
        }
      }
    }
  }
);
}

Fixed version (ground truth):
private void addTreeListener(final Tree tree){
  tree.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      TreeItem item=(TreeItem)e.item;
      if (DATA_PARAM.equals(item.getData(DATA_PARAM))) {
        tree.setMenu(null);
      }
 else {
        new TableTreeMenuProvider(tree).createTreeMenu();
      }
    }
  }
);
  tree.addTreeListener(new TreeAdapter(){
    @Override public void treeCollapsed(    TreeEvent e){
      ExpandableComposite theSuitedComposite=getTheSuitedComposite(e);
      ScrolledForm form=masterPage.getForm();
      Composite comp=masterPage.getChartComposite();
      if (theSuitedComposite != null && theSuitedComposite.isExpanded()) {
        getTheSuitedComposite(e).setExpanded(false);
      }
      comp.layout();
      form.reflow(true);
    }
    @Override public void treeExpanded(    TreeEvent e){
      ExpandableComposite theSuitedComposite=getTheSuitedComposite(e);
      ScrolledForm form=masterPage.getForm();
      Composite comp=masterPage.getChartComposite();
      if (theSuitedComposite != null && !theSuitedComposite.isExpanded()) {
        theSuitedComposite.setExpanded(true);
      }
      comp.layout();
      form.reflow(true);
    }
  }
);
  tree.addMouseListener(new MouseAdapter(){
    @Override public void mouseDoubleClick(    MouseEvent e){
      TreeItem[] treeSelection=tree.getSelection();
      if (treeSelection.length > 0) {
        TreeItem item=treeSelection[0];
        Object indicatorobj=item.getData(INDICATOR_UNIT_KEY);
        Object tableobj=item.getData(TABLE_INDICATOR_KEY);
        if (tableobj != null && indicatorobj == null) {
          showAddDQRuleDialog(item,(TableIndicator)tableobj);
        }
 else         if (tableobj != null && indicatorobj != null) {
          openIndicatorOptionDialog(null,item);
        }
      }
    }
  }
);
}