Program: 137073
Project: 137073
Buggy source:
public void chartMouseClicked(ChartMouseEvent event){
  boolean flag=event.getTrigger().getButton() != MouseEvent.BUTTON3;
  chartComp.setDomainZoomable(flag);
  chartComp.setRangeZoomable(flag);
  final ExecutionLanguage currentEngine=analysis.getParameters().getExecutionLanguage();
  if (flag) {
    return;
  }
  ChartEntity chartEntity=event.getEntity();
  if (chartEntity != null && chartEntity instanceof CategoryItemEntity) {
    CategoryItemEntity cateEntity=(CategoryItemEntity)chartEntity;
    ICustomerDataset dataEntity=(ICustomerDataset)cateEntity.getDataset();
    final ChartDataEntity currentDataEntity=getCurrentChartDateEntity(cateEntity,dataEntity);
    if (currentDataEntity != null) {
      if (ExecutionLanguage.JAVA == currentEngine && 0 == analysis.getResults().getIndicToRowMap().size()) {
        return;
      }
      if (ExecutionLanguage.JAVA == currentEngine && !analysis.getParameters().isStoreData()) {
        return;
      }
      Menu menu=new Menu(chartComp.getShell(),SWT.POP_UP);
      chartComp.setMenu(menu);
      final Indicator currentIndicator=currentDataEntity.getIndicator();
      int createPatternFlag=0;
      MenuItemEntity[] itemEntities=ChartTableMenuGenerator.generate(explorer,analysis,currentDataEntity);
      if (currentIndicator instanceof DatePatternFreqIndicator && null == analysis.getResults().getIndicToRowMap().get(currentIndicator).getFrequencyData()) {
        return;
      }
      for (      final MenuItemEntity itemEntity : itemEntities) {
        MenuItem item=new MenuItem(menu,SWT.PUSH);
        item.setText(itemEntity.getLabel());
        item.setImage(itemEntity.getIcon());
        item.addSelectionListener(new SelectionAdapter(){
          @Override public void widgetSelected(          SelectionEvent e){
            if (ExecutionLanguage.JAVA == currentEngine) {
              try {
                DrillDownEditorInput input=new DrillDownEditorInput(analysis,currentDataEntity,itemEntity);
                if (input.computeColumnValueLength(input.filterAdaptDataList())) {
                  CorePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(input,"String_Node_Str");
                }
 else {
                  MessageDialog.openWarning(null,Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
                }
              }
 catch (              PartInitException e1) {
                e1.printStackTrace();
              }
            }
 else {
              Display.getDefault().asyncExec(new Runnable(){
                public void run(){
                  Connection tdDataProvider=SwitchHelpers.CONNECTION_SWITCH.doSwitch(analysis.getContext().getConnection());
                  String query=itemEntity.getQuery();
                  String editorName=currentIndicator.getName();
                  SqlExplorerUtils.getDefault().runInDQViewer(tdDataProvider,query,editorName);
                }
              }
);
            }
          }
        }
);
        if ((currentIndicator instanceof PatternFreqIndicator || currentIndicator instanceof PatternLowFreqIndicator) && createPatternFlag == 0) {
          MenuItem itemCreatePatt=new MenuItem(menu,SWT.PUSH);
          itemCreatePatt.setText(DefaultMessagesImpl.getString("String_Node_Str"));
          final PatternTransformer pattTransformer=new PatternTransformer(DbmsLanguageFactory.createDbmsLanguage(analysis));
          itemCreatePatt.addSelectionListener(new SelectionAdapter(){
            @Override public void widgetSelected(            SelectionEvent e){
              Display.getDefault().asyncExec(new Runnable(){
                public void run(){
                  ChartTableFactory.createPattern(analysis,itemEntity,pattTransformer);
                }
              }
);
            }
          }
);
        }
        createPatternFlag++;
      }
      ChartTableFactory.addJobGenerationMenu(menu,analysis,currentIndicator);
      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;
  }
  final ExecutionLanguage currentEngine=analysis.getParameters().getExecutionLanguage();
  if (ExecutionLanguage.JAVA == currentEngine && 0 == analysis.getResults().getIndicToRowMap().size()) {
    return;
  }
  if (ExecutionLanguage.JAVA == currentEngine && !analysis.getParameters().isStoreData()) {
    return;
  }
  ChartEntity chartEntity=event.getEntity();
  if (chartEntity != null && chartEntity instanceof CategoryItemEntity) {
    CategoryItemEntity cateEntity=(CategoryItemEntity)chartEntity;
    ICustomerDataset dataEntity=(ICustomerDataset)cateEntity.getDataset();
    final ChartDataEntity currentDataEntity=getCurrentChartDateEntity(cateEntity,dataEntity);
    if (currentDataEntity != null) {
      final Indicator currentIndicator=currentDataEntity.getIndicator();
      if (currentIndicator instanceof DatePatternFreqIndicator && null == analysis.getResults().getIndicToRowMap().get(currentIndicator).getFrequencyData()) {
        return;
      }
      if (ExecutionLanguage.JAVA == currentEngine && analysis.getParameters().isStoreData()) {
        if (currentIndicator.isUsedMapDBMode()) {
          if (dataEntity == null || currentIndicator == null || DrillDownUtils.getMapDB(currentDataEntity,analysis).size() == 0) {
            return;
          }
        }
      }
      Menu menu=new Menu(chartComp.getShell(),SWT.POP_UP);
      chartComp.setMenu(menu);
      int createPatternFlag=0;
      MenuItemEntity[] itemEntities=ChartTableMenuGenerator.generate(explorer,analysis,currentDataEntity);
      for (      final MenuItemEntity itemEntity : itemEntities) {
        MenuItem item=new MenuItem(menu,SWT.PUSH);
        item.setText(itemEntity.getLabel());
        item.setImage(itemEntity.getIcon());
        item.addSelectionListener(new SelectionAdapter(){
          @Override public void widgetSelected(          SelectionEvent e){
            if (ExecutionLanguage.JAVA == currentEngine) {
              try {
                DrillDownEditorInput input=new DrillDownEditorInput(analysis,currentDataEntity,itemEntity);
                if (input.computeColumnValueLength(input.filterAdaptDataList())) {
                  CorePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(input,"String_Node_Str");
                }
 else {
                  MessageDialog.openWarning(null,Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
                }
              }
 catch (              PartInitException e1) {
                log.error(e1,e1);
              }
            }
 else {
              Display.getDefault().asyncExec(new Runnable(){
                public void run(){
                  Connection tdDataProvider=SwitchHelpers.CONNECTION_SWITCH.doSwitch(analysis.getContext().getConnection());
                  String query=itemEntity.getQuery();
                  String editorName=currentIndicator.getName();
                  SqlExplorerUtils.getDefault().runInDQViewer(tdDataProvider,query,editorName);
                }
              }
);
            }
          }
        }
);
        if ((currentIndicator instanceof PatternFreqIndicator || currentIndicator instanceof PatternLowFreqIndicator) && createPatternFlag == 0) {
          MenuItem itemCreatePatt=new MenuItem(menu,SWT.PUSH);
          itemCreatePatt.setText(DefaultMessagesImpl.getString("String_Node_Str"));
          final PatternTransformer pattTransformer=new PatternTransformer(DbmsLanguageFactory.createDbmsLanguage(analysis));
          itemCreatePatt.addSelectionListener(new SelectionAdapter(){
            @Override public void widgetSelected(            SelectionEvent e){
              Display.getDefault().asyncExec(new Runnable(){
                public void run(){
                  ChartTableFactory.createPattern(analysis,itemEntity,pattTransformer);
                }
              }
);
            }
          }
);
        }
        createPatternFlag++;
      }
      ChartTableFactory.addJobGenerationMenu(menu,analysis,currentIndicator);
      menu.setVisible(true);
    }
  }
}