Program: 139914
Project: 139914
Buggy source:
public void chartMouseClicked(ChartMouseEvent event){
  boolean flag=event.getTrigger().getButton() != MouseEvent.BUTTON3;
  chartComp.setDomainZoomable(flag);
  chartComp.setRangeZoomable(flag);
  if (flag) {
    return;
  }
  ChartEntity chartEntity=event.getEntity();
  if (chartEntity != null) {
    CategoryItemEntity cateEntity=(CategoryItemEntity)chartEntity;
    CustomerDefaultCategoryDataset dataEntity=(CustomerDefaultCategoryDataset)cateEntity.getDataset();
    Menu menu=new Menu(chartComp.getShell(),SWT.POP_UP);
    chartComp.setMenu(menu);
    ChartDataEntity currentDataEntity=null;
    ChartDataEntity[] dataEntities=dataEntity.getDataEntities();
    if (dataEntities.length == 1) {
      currentDataEntity=dataEntities[0];
    }
 else {
      for (      ChartDataEntity entity : dataEntities) {
        if (cateEntity.getColumnKey().compareTo(entity.getLabel()) == 0) {
          currentDataEntity=entity;
        }
 else {
          if (cateEntity.getRowKey().compareTo(entity.getLabel()) == 0) {
            currentDataEntity=entity;
          }
        }
      }
    }
    if (currentDataEntity != null) {
      RowMatchExplorer explorer=new RowMatchExplorer();
      final Analysis analysis=getAnalysisHandler().getAnalysis();
      final Indicator indicator=currentDataEntity.getIndicator();
      MenuItemEntity[] itemEntities=ChartTableMenuGenerator.generate(explorer,analysis,currentDataEntity);
      for (      final MenuItemEntity itemEntity : itemEntities) {
        MenuItem menuItem=new MenuItem(menu,SWT.NONE);
        menuItem.setText(itemEntity.getLabel());
        menuItem.setImage(ImageLib.getImage(ImageLib.EXPLORE_IMAGE));
        menuItem.addSelectionListener(new SelectionAdapter(){
          public void widgetSelected(          SelectionEvent e){
            Display.getDefault().asyncExec(new Runnable(){
              public void run(){
                TdDataProvider tdDataProvider=SwitchHelpers.TDDATAPROVIDER_SWITCH.doSwitch(analysis.getContext().getConnection());
                String query=itemEntity.getQuery();
                String editorName=indicator.getAnalyzedElement().getName();
                CorePlugin.getDefault().runInDQViewer(tdDataProvider,query,editorName);
              }
            }
);
          }
        }
);
      }
    }
    menu.setVisible(true);
  }
}

Fixed version (ground truth):
public void chartMouseClicked(ChartMouseEvent event){
  boolean flag=event.getTrigger().getButton() != MouseEvent.BUTTON3;
  chartComp.setDomainZoomable(flag);
  chartComp.setRangeZoomable(flag);
  if (flag) {
    return;
  }
  ChartEntity chartEntity=event.getEntity();
  if (chartEntity != null && chartEntity instanceof CategoryItemEntity) {
    CategoryItemEntity cateEntity=(CategoryItemEntity)chartEntity;
    CustomerDefaultCategoryDataset dataEntity=(CustomerDefaultCategoryDataset)cateEntity.getDataset();
    Menu menu=new Menu(chartComp.getShell(),SWT.POP_UP);
    chartComp.setMenu(menu);
    ChartDataEntity currentDataEntity=null;
    ChartDataEntity[] dataEntities=dataEntity.getDataEntities();
    if (dataEntities.length == 1) {
      currentDataEntity=dataEntities[0];
    }
 else {
      for (      ChartDataEntity entity : dataEntities) {
        if (cateEntity.getColumnKey().compareTo(entity.getLabel()) == 0) {
          currentDataEntity=entity;
        }
 else {
          if (cateEntity.getRowKey().compareTo(entity.getLabel()) == 0) {
            currentDataEntity=entity;
          }
        }
      }
    }
    if (currentDataEntity != null) {
      RowMatchExplorer explorer=new RowMatchExplorer();
      final Analysis analysis=getAnalysisHandler().getAnalysis();
      final Indicator indicator=currentDataEntity.getIndicator();
      MenuItemEntity[] itemEntities=ChartTableMenuGenerator.generate(explorer,analysis,currentDataEntity);
      for (      final MenuItemEntity itemEntity : itemEntities) {
        MenuItem menuItem=new MenuItem(menu,SWT.NONE);
        menuItem.setText(itemEntity.getLabel());
        menuItem.setImage(ImageLib.getImage(ImageLib.EXPLORE_IMAGE));
        menuItem.addSelectionListener(new SelectionAdapter(){
          public void widgetSelected(          SelectionEvent e){
            Display.getDefault().asyncExec(new Runnable(){
              public void run(){
                TdDataProvider tdDataProvider=SwitchHelpers.TDDATAPROVIDER_SWITCH.doSwitch(analysis.getContext().getConnection());
                String query=itemEntity.getQuery();
                String editorName=indicator.getAnalyzedElement().getName();
                CorePlugin.getDefault().runInDQViewer(tdDataProvider,query,editorName);
              }
            }
);
          }
        }
);
      }
    }
    menu.setVisible(true);
  }
}