Program: 140135
Project: 140135
Buggy source:
@Override public void mouseDown(MouseEvent e){
  if (e.button == 3) {
    StructuredSelection selection=(StructuredSelection)tbViewer.getSelection();
    ChartDataEntity dataEntity=(ChartDataEntity)selection.getFirstElement();
    final Indicator indicator=dataEntity.getIndicator();
    if (indicator != null) {
      Menu menu=new Menu(table.getShell(),SWT.POP_UP);
      table.setMenu(menu);
      int createPatternFlag=0;
      MenuItemEntity[] itemEntities=ChartTableMenuGenerator.generate(chartTableType,analysis,dataEntity);
      for (      final MenuItemEntity itemEntity : itemEntities) {
        MenuItem item=new MenuItem(menu,SWT.PUSH);
        item.setText(itemEntity.getLabel());
        item.setImage(itemEntity.getIcon());
        item.addListener(SWT.Selection,new Listener(){
          public void handleEvent(          Event event){
            viewRecordInDataExplorer(analysis,indicator,itemEntity.getQuery());
          }
        }
);
        if ((indicator.getName().trim().equals("String_Node_Str") || indicator.getName().trim().equals("String_Node_Str")) && createPatternFlag == 0) {
          MenuItem itemCreatePatt=new MenuItem(menu,SWT.PUSH);
          final PatternTransformer pattTransformer=new PatternTransformer(DbmsLanguageFactory.createDbmsLanguage(analysis));
          itemCreatePatt.setText("String_Node_Str");
          itemCreatePatt.addSelectionListener(new SelectionAdapter(){
            public void widgetSelected(            SelectionEvent e){
              createPattern(analysis,itemEntity,pattTransformer);
            }
          }
);
        }
      }
      createPatternFlag++;
      menu.setVisible(true);
    }
  }
}

Fixed version (ground truth):
@Override public void mouseDown(MouseEvent e){
  if (e.button == 3) {
    StructuredSelection selection=(StructuredSelection)tbViewer.getSelection();
    ChartDataEntity dataEntity=(ChartDataEntity)selection.getFirstElement();
    final Indicator indicator=dataEntity.getIndicator();
    if (indicator != null) {
      Menu menu=new Menu(table.getShell(),SWT.POP_UP);
      table.setMenu(menu);
      int createPatternFlag=0;
      MenuItemEntity[] itemEntities=ChartTableMenuGenerator.generate(chartTableType,analysis,dataEntity);
      for (      final MenuItemEntity itemEntity : itemEntities) {
        MenuItem item=new MenuItem(menu,SWT.PUSH);
        item.setText(itemEntity.getLabel());
        item.setImage(itemEntity.getIcon());
        item.addListener(SWT.Selection,new Listener(){
          public void handleEvent(          Event event){
            viewRecordInDataExplorer(analysis,indicator,itemEntity.getQuery());
          }
        }
);
        if (((indicator instanceof PatternFreqIndicator || indicator instanceof PatternLowFreqIndicator)) && createPatternFlag == 0) {
          MenuItem itemCreatePatt=new MenuItem(menu,SWT.PUSH);
          final PatternTransformer pattTransformer=new PatternTransformer(DbmsLanguageFactory.createDbmsLanguage(analysis));
          itemCreatePatt.setText("String_Node_Str");
          itemCreatePatt.addSelectionListener(new SelectionAdapter(){
            public void widgetSelected(            SelectionEvent e){
              createPattern(analysis,itemEntity,pattTransformer);
            }
          }
);
        }
      }
      createPatternFlag++;
      menu.setVisible(true);
    }
  }
}