Program: 139036
Project: 139036
Buggy source:
private void addTreeListener(final Tree tree){
  tree.addFocusListener(new FocusListener(){
    public void focusGained(    FocusEvent e){
      if (e.getSource() instanceof Tree) {
        Tree currentTree=(Tree)e.getSource();
        if (currentTree.getSelection().length > 0) {
          enabledButtons(true);
        }
      }
    }
    public void focusLost(    FocusEvent e){
      if (e.getSource() instanceof Tree) {
        Tree currentTree=(Tree)e.getSource();
        if (currentTree.getSelection().length <= 0) {
          enabledButtons(false);
        }
      }
    }
  }
);
  tree.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      boolean con=false;
      if (e.item instanceof TreeItem) {
        enabledButtons(true);
        TreeItem item=(TreeItem)e.item;
        if (DATA_PARAM.equals(item.getData(DATA_PARAM))) {
          tree.setMenu(null);
          return;
        }
 else         if (item.getData(INDICATOR_UNIT_KEY) != null) {
          IndicatorUnit indicatorUnit=(IndicatorUnit)item.getData(INDICATOR_UNIT_KEY);
          IndicatorEnum type=indicatorUnit.getType();
          con=IndicatorEnum.RegexpMatchingIndicatorEnum.compareTo(type) == 0 || IndicatorEnum.SqlPatternMatchingIndicatorEnum.compareTo(type) == 0;
        }
      }
      createTreeMenu(tree,con);
    }
  }
);
  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);
    }
  }
);
}

Fixed version (ground truth):
private void addTreeListener(final Tree tree){
  tree.addFocusListener(new FocusListener(){
    public void focusGained(    FocusEvent e){
      if (e.getSource() instanceof Tree) {
        Tree currentTree=(Tree)e.getSource();
        if (currentTree.getSelection().length > 0) {
          enabledButtons(true);
        }
      }
    }
    public void focusLost(    FocusEvent e){
      if (e.getSource() instanceof Tree) {
        Tree currentTree=(Tree)e.getSource();
        if (currentTree.getSelection().length <= 0) {
          enabledButtons(false);
        }
      }
    }
  }
);
  tree.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      boolean con=false;
      if (e.item instanceof TreeItem) {
        enabledButtons(true);
        TreeItem item=(TreeItem)e.item;
        if (DATA_PARAM.equals(item.getData(DATA_PARAM))) {
          tree.setMenu(null);
          return;
        }
 else {
          new AnalysisColumnSetMenuProvider(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);
    }
  }
);
}