Program: 139318
Project: 139318
Buggy source:
/** 
 * DOC xzhao Comment method "createTreeMenu".
 * @param newTree
 * @param containEdit
 */
private void createTreeMenu(final Tree newTree,boolean containEdit){
  Menu oldMenu=newTree.getMenu();
  if (oldMenu != null && !oldMenu.isDisposed()) {
    oldMenu.dispose();
  }
  menu=new Menu(newTree);
  MenuItem deleteMenuItem=new MenuItem(menu,SWT.CASCADE);
  deleteMenuItem.setText(DefaultMessagesImpl.getString("String_Node_Str"));
  deleteMenuItem.setImage(ImageLib.getImage(ImageLib.DELETE_ACTION));
  deleteMenuItem.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      removeSelectedElements(newTree);
    }
  }
);
  MenuItem showMenuItem=new MenuItem(menu,SWT.CASCADE);
  showMenuItem.setText(DefaultMessagesImpl.getString("String_Node_Str"));
  showMenuItem.setImage(ImageLib.getImage(ImageLib.EXPLORE_IMAGE));
  showMenuItem.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      TreeItem[] selection=newTree.getSelection();
      if (selection.length == 1) {
        DQRespositoryView dqview=CorePlugin.getDefault().getRepositoryView();
        try {
          TdColumn tdColumn=(TdColumn)selection[0].getData(COLUMN_INDICATOR_KEY);
          dqview.showSelectedElements(tdColumn);
        }
 catch (        Exception ex) {
          log.error(ex,ex);
        }
      }
    }
  }
);
  if (containEdit) {
    editPatternMenuItem=new MenuItem(menu,SWT.CASCADE);
    editPatternMenuItem.setText(DefaultMessagesImpl.getString("String_Node_Str"));
    editPatternMenuItem.setImage(ImageLib.getImage(ImageLib.PATTERN_REG));
    editPatternMenuItem.addSelectionListener(new SelectionAdapter(){
      @Override public void widgetSelected(      SelectionEvent e){
        TreeItem[] selection=tree.getSelection();
        if (selection.length > 0) {
          TreeItem treeItem=selection[0];
          IndicatorUnit indicatorUnit=(IndicatorUnit)treeItem.getData(INDICATOR_UNIT_KEY);
          PatternMatchingIndicator indicator=(PatternMatchingIndicator)indicatorUnit.getIndicator();
          Pattern pattern=indicator.getParameters().getDataValidDomain().getPatterns().get(0);
          IFolder patternFolder=ResourceManager.getPatternFolder();
          IFolder sqlPatternFolder=ResourceManager.getPatternSQLFolder();
          IFile file=PatternResourceFileHelper.getInstance().getPatternFile(pattern,new IFolder[]{patternFolder,sqlPatternFolder});
          IWorkbenchPage activePage=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
          try {
            activePage.openEditor(new FileEditorInput(file),"String_Node_Str");
          }
 catch (          PartInitException e1) {
            log.error(e1,e1);
          }
        }
      }
    }
);
  }
  newTree.setMenu(menu);
}

Fixed version (ground truth):
/** 
 * DOC xzhao Comment method "createTreeMenu".
 * @param newTree
 * @param containEdit
 */
private void createTreeMenu(final Tree newTree,boolean containEdit){
  Menu oldMenu=newTree.getMenu();
  if (oldMenu != null && !oldMenu.isDisposed()) {
    oldMenu.dispose();
  }
  menu=new Menu(newTree);
  MenuItem deleteMenuItem=new MenuItem(menu,SWT.CASCADE);
  deleteMenuItem.setText(DefaultMessagesImpl.getString("String_Node_Str"));
  deleteMenuItem.setImage(ImageLib.getImage(ImageLib.DELETE_ACTION));
  deleteMenuItem.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      removeSelectedElements(newTree);
      updateBindConnection(masterPage,tree);
    }
  }
);
  MenuItem showMenuItem=new MenuItem(menu,SWT.CASCADE);
  showMenuItem.setText(DefaultMessagesImpl.getString("String_Node_Str"));
  showMenuItem.setImage(ImageLib.getImage(ImageLib.EXPLORE_IMAGE));
  showMenuItem.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      TreeItem[] selection=newTree.getSelection();
      if (selection.length == 1) {
        DQRespositoryView dqview=CorePlugin.getDefault().getRepositoryView();
        try {
          TdColumn tdColumn=(TdColumn)selection[0].getData(COLUMN_INDICATOR_KEY);
          dqview.showSelectedElements(tdColumn);
        }
 catch (        Exception ex) {
          log.error(ex,ex);
        }
      }
    }
  }
);
  if (containEdit) {
    editPatternMenuItem=new MenuItem(menu,SWT.CASCADE);
    editPatternMenuItem.setText(DefaultMessagesImpl.getString("String_Node_Str"));
    editPatternMenuItem.setImage(ImageLib.getImage(ImageLib.PATTERN_REG));
    editPatternMenuItem.addSelectionListener(new SelectionAdapter(){
      @Override public void widgetSelected(      SelectionEvent e){
        TreeItem[] selection=tree.getSelection();
        if (selection.length > 0) {
          TreeItem treeItem=selection[0];
          IndicatorUnit indicatorUnit=(IndicatorUnit)treeItem.getData(INDICATOR_UNIT_KEY);
          PatternMatchingIndicator indicator=(PatternMatchingIndicator)indicatorUnit.getIndicator();
          Pattern pattern=indicator.getParameters().getDataValidDomain().getPatterns().get(0);
          IFolder patternFolder=ResourceManager.getPatternFolder();
          IFolder sqlPatternFolder=ResourceManager.getPatternSQLFolder();
          IFile file=PatternResourceFileHelper.getInstance().getPatternFile(pattern,new IFolder[]{patternFolder,sqlPatternFolder});
          IWorkbenchPage activePage=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
          try {
            activePage.openEditor(new FileEditorInput(file),"String_Node_Str");
          }
 catch (          PartInitException e1) {
            log.error(e1,e1);
          }
        }
      }
    }
);
  }
  newTree.setMenu(menu);
}