Program: 137253
Project: 137253
Buggy source:
public static void addMenuAndTip(final TableViewer tbViewer,final IDataExplorer explorer,final Analysis analysis){
  final ExecutionLanguage currentEngine=analysis.getParameters().getExecutionLanguage();
  final boolean isJAVALanguage=ExecutionLanguage.JAVA == currentEngine;
  final Connection tdDataProvider=(Connection)analysis.getContext().getConnection();
  final boolean isMDMAnalysis=ConnectionUtils.isMdmConnection(tdDataProvider);
  final boolean isDelimitedFileAnalysis=ConnectionUtils.isDelimitedFileConnection(tdDataProvider);
  final boolean isHiveConnection=ConnectionHelper.isHive(tdDataProvider);
  final Table table=tbViewer.getTable();
  table.addMouseListener(new MouseAdapter(){
    @Override public void mouseDown(    MouseEvent e){
      if (table.getMenu() != null) {
        table.getMenu().setVisible(false);
      }
      if (e.button == 3) {
        StructuredSelection selection=(StructuredSelection)tbViewer.getSelection();
        final ChartDataEntity dataEntity=(ChartDataEntity)selection.getFirstElement();
        final Indicator indicator=dataEntity != null ? dataEntity.getIndicator() : null;
        if (indicator != null && dataEntity != null) {
          Menu menu=new Menu(table.getShell(),SWT.POP_UP);
          table.setMenu(menu);
          MenuItemEntity[] itemEntities=ChartTableMenuGenerator.generate(explorer,analysis,dataEntity);
          Long rowCount=getRowCount(analysis,dataEntity.getIndicator().getAnalyzedElement());
          if (!isJAVALanguage) {
            boolean showExtraMenu=false;
            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){
                  String query=itemEntity.getQuery();
                  String editorName=indicator.getName();
                  if (isPatternMatchingIndicator(indicator) && !((PatternExplorer)explorer).isImplementRegexFunction(itemEntity.getLabel())) {
                    MessageDialog.openInformation(new Shell(),itemEntity.getLabel(),DefaultMessagesImpl.getString("String_Node_Str"));
                    return;
                  }
                  CorePlugin.getDefault().runInDQViewer(tdDataProvider,query,editorName);
                }
              }
);
              if (IndicatorHelper.isWhereRuleIndicatorNotAide(indicator)) {
                WhereRuleIndicator ind=(WhereRuleIndicator)indicator;
                EList<JoinElement> joinConditions=ind.getJoinConditions();
                if (joinConditions.size() > 0) {
                  showExtraMenu=true;
                }
              }
              if (isPatternFrequencyIndicator(indicator)) {
                MenuItem itemCreatePatt=new MenuItem(menu,SWT.PUSH);
                itemCreatePatt.setText(DefaultMessagesImpl.getString("String_Node_Str"));
                itemCreatePatt.setImage(ImageLib.getImage(ImageLib.PATTERN_REG));
                itemCreatePatt.addSelectionListener(new SelectionAdapter(){
                  @Override public void widgetSelected(                  SelectionEvent e){
                    DbmsLanguage language=DbmsLanguageFactory.createDbmsLanguage(analysis);
                    PatternTransformer pattTransformer=new PatternTransformer(language);
                    createPattern(analysis,itemEntity,pattTransformer);
                  }
                }
);
              }
            }
            if (showExtraMenu) {
              MenuItem itemCreateWhereRule=new MenuItem(menu,SWT.PUSH);
              itemCreateWhereRule.setText(DefaultMessagesImpl.getString("String_Node_Str"));
              itemCreateWhereRule.addSelectionListener(new SelectionAdapter(){
                @Override public void widgetSelected(                SelectionEvent e){
                  final StructuredSelection selectionOne=(StructuredSelection)tbViewer.getSelection();
                  Object firstElement=selectionOne.getFirstElement();
                  if (firstElement instanceof WhereRuleChartDataEntity) {
                    WhereRuleChartDataEntity wrChartDataEntity=(WhereRuleChartDataEntity)firstElement;
                    WhereRuleIndicator wrInd=(WhereRuleIndicator)wrChartDataEntity.getIndicator();
                    CreateDuplicatesAnalysisAction action=new CreateDuplicatesAnalysisAction(buildColumnsMap(wrInd));
                    action.run();
                  }
                }
                /** 
 * DOC xqliu Comment method "buildColumnsMap".
 * @param wrInd
 * @return
 */
                private Map<ColumnSet,List<TdColumn>> buildColumnsMap(                WhereRuleIndicator wrInd){
                  Map<ColumnSet,List<TdColumn>> map=new HashMap<ColumnSet,List<TdColumn>>();
                  List<TdColumn> columns=new ArrayList<TdColumn>();
                  EList<JoinElement> joinConditions=wrInd.getJoinConditions();
                  for (                  JoinElement joinElement : joinConditions) {
                    TdColumn tempColumn=(TdColumn)joinElement.getColA();
                    if (!columns.contains(tempColumn)) {
                      columns.add(tempColumn);
                    }
                    tempColumn=(TdColumn)joinElement.getColB();
                    if (!columns.contains(tempColumn)) {
                      columns.add(tempColumn);
                    }
                  }
                  for (                  TdColumn column : columns) {
                    ColumnSet columnSet=ColumnHelper.getColumnOwnerAsColumnSet(column);
                    List<TdColumn> list=map.get(columnSet);
                    if (list == null) {
                      list=new ArrayList<TdColumn>();
                      map.put(columnSet,list);
                    }
                    list.add(column);
                  }
                  return getUserSelectedMap(map);
                }
                /** 
 * DOC xqliu Comment method "getUserSelectedMap".
 * @param map
 * @return
 */
                private Map<ColumnSet,List<TdColumn>> getUserSelectedMap(                Map<ColumnSet,List<TdColumn>> map){
                  Map<ColumnSet,List<TdColumn>> userMap=new HashMap<ColumnSet,List<TdColumn>>();
                  List<RepositoryNode> columnNodes=getColumnNodes(map);
                  RepositoryNode rootNode=getConnectionNode(map);
                  if (!columnNodes.isEmpty() && rootNode != null) {
                    ColumnsMapSelectionDialog dialog=new ColumnsMapSelectionDialog(null,PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),DefaultMessagesImpl.getString("String_Node_Str"),columnNodes,rootNode,DefaultMessagesImpl.getString("String_Node_Str"));
                    dialog.setAllMap(map);
                    if (dialog.open() == Window.OK) {
                      userMap=dialog.getUserMap();
                    }
                  }
                  return userMap;
                }
                /** 
 * DOC xqliu Comment method "getConnectionNode".
 * @param map
 * @return
 */
                private RepositoryNode getConnectionNode(                Map<ColumnSet,List<TdColumn>> map){
                  RepositoryNode node=null;
                  if (map != null && !map.isEmpty()) {
                    Connection connection=ConnectionHelper.getConnection(map.keySet().iterator().next());
                    if (connection != null) {
                      node=RepositoryNodeHelper.recursiveFind(connection);
                    }
                  }
                  return node;
                }
                /** 
 * DOC xqliu Comment method "getColumnNodes".
 * @param map
 * @return
 */
                private List<RepositoryNode> getColumnNodes(                Map<ColumnSet,List<TdColumn>> map){
                  List<RepositoryNode> nodes=new ArrayList<RepositoryNode>();
                  if (map != null && !map.isEmpty()) {
                    List<TdColumn> columns=new ArrayList<TdColumn>();
                    Set<ColumnSet> keySet=map.keySet();
                    for (                    ColumnSet cs : keySet) {
                      columns.addAll(map.get(cs));
                    }
                    if (!columns.isEmpty()) {
                      for (                      TdColumn column : columns) {
                        nodes.add(RepositoryNodeHelper.recursiveFind(column));
                      }
                    }
                  }
                  return nodes;
                }
              }
);
            }
          }
 else {
            if (analysis.getParameters().isStoreData()) {
              if (indicator.isSaveTempDataToFile()) {
                createDrillDownMenuForMapDB(dataEntity,menu,itemEntities);
              }
 else {
                createDrillDownMenuForJava(dataEntity,menu,itemEntities);
              }
              if (isPatternFrequencyIndicator(indicator)) {
                for (                final MenuItemEntity itemEntity : itemEntities) {
                  if (itemEntity.getQuery() == null) {
                    if (dataEntity.getKey() == null) {
                      itemEntity.setQuery(dataEntity.getLabel());
                    }
 else {
                      itemEntity.setQuery(dataEntity.getKey().toString());
                    }
                  }
                  MenuItem itemCreatePatt=new MenuItem(menu,SWT.PUSH);
                  itemCreatePatt.setText(DefaultMessagesImpl.getString("String_Node_Str"));
                  itemCreatePatt.setImage(ImageLib.getImage(ImageLib.PATTERN_REG));
                  itemCreatePatt.addSelectionListener(new SelectionAdapter(){
                    @Override public void widgetSelected(                    SelectionEvent e){
                      DbmsLanguage language=DbmsLanguageFactory.createDbmsLanguage(analysis);
                      PatternTransformer pattTransformer=new PatternTransformer(language);
                      createPattern(analysis,itemEntity,pattTransformer);
                    }
                  }
);
                }
              }
            }
            if (isDatePatternFrequencyIndicator(indicator)) {
              final DatePatternFreqIndicator dateIndicator=(DatePatternFreqIndicator)indicator;
              MenuItem itemCreatePatt=new MenuItem(menu,SWT.PUSH);
              itemCreatePatt.setText(DefaultMessagesImpl.getString("String_Node_Str"));
              itemCreatePatt.setImage(ImageLib.getImage(ImageLib.PATTERN_REG));
              itemCreatePatt.addSelectionListener(new SelectionAdapter(){
                @Override public void widgetSelected(                SelectionEvent e){
                  DbmsLanguage language=DbmsLanguageFactory.createDbmsLanguage(analysis);
                  IFolder folder=ResourceManager.getPatternRegexFolder();
                  String model=dataEntity.getLabel();
                  String regex=dateIndicator.getRegex(model);
                  new CreatePatternAction(folder,ExpressionType.REGEXP,"String_Node_Str" + regex + "String_Node_Str",model == null ? "String_Node_Str" : "String_Node_Str" + model + "String_Node_Str",language.getDbmsName()).run();
                }
              }
);
            }
          }
          addJobGenerationMenu(menu,analysis,indicator);
          menu.setVisible(true);
        }
      }
    }
    private void createDrillDownMenuForMapDB(    final ChartDataEntity dataEntity,    Menu menu,    MenuItemEntity[] itemEntities){
      final Indicator indicator=dataEntity != null ? dataEntity.getIndicator() : null;
      if (dataEntity == null || RowCountIndicator.class.isInstance(indicator)) {
        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){
            CorePlugin.getDefault().openEditor(new DrillDownEditorInput(analysis,dataEntity,itemEntity),ChartTableFactory.DRILL_DOWN_EDITOR);
          }
        }
);
      }
    }
    /** 
 * DOC talend Comment method "createDrillDownMenu".
 * @param analysis
 * @param dataEntity
 * @param menu
 * @param itemEntities
 */
    private void createDrillDownMenuForJava(    final ChartDataEntity dataEntity,    Menu menu,    MenuItemEntity[] itemEntities){
      final Indicator indicator=dataEntity != null ? dataEntity.getIndicator() : null;
      AnalyzedDataSet analyDataSet=analysis.getResults().getIndicToRowMap().get(indicator);
      boolean hasData=analyDataSet != null && (analyDataSet.getData() != null && analyDataSet.getData().size() > 0 || analyDataSet.getFrequencyData() != null && analyDataSet.getFrequencyData().size() > 0 || analyDataSet.getPatternData() != null && analyDataSet.getPatternData().size() > 0);
      if (hasData) {
        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){
              CorePlugin.getDefault().openEditor(new DrillDownEditorInput(analysis,dataEntity,itemEntity),ChartTableFactory.DRILL_DOWN_EDITOR);
            }
          }
);
        }
      }
    }
    /** 
 * DOC xqliu Comment method "getRowCount".
 * @param analysis
 * @param analyzedElement
 * @return
 */
    private Long getRowCount(    Analysis analysis,    ModelElement analyzedElement){
      Long rowCount=0L;
      EList<Indicator> indicators=analysis.getResults().getIndicators();
      for (      Indicator ind : indicators) {
        if (ind instanceof RowCountIndicator && ind.getAnalyzedElement().equals(analyzedElement)) {
          rowCount=ind.getCount();
        }
      }
      return rowCount;
    }
    private SelectionAdapter getAdapter(    final IDatabaseJobService service){
      return new SelectionAdapter(){
        @Override public void widgetSelected(        SelectionEvent e){
          service.executeJob();
        }
      }
;
    }
  }
);
  TableUtils.addTooltipOnTableItem(table);
}

Fixed version (ground truth):
public static void addMenuAndTip(final TableViewer tbViewer,final IDataExplorer explorer,final Analysis analysis){
  final ExecutionLanguage currentEngine=analysis.getParameters().getExecutionLanguage();
  final boolean isJAVALanguage=ExecutionLanguage.JAVA == currentEngine;
  final Connection tdDataProvider=(Connection)analysis.getContext().getConnection();
  final boolean isMDMAnalysis=ConnectionUtils.isMdmConnection(tdDataProvider);
  final boolean isDelimitedFileAnalysis=ConnectionUtils.isDelimitedFileConnection(tdDataProvider);
  final boolean isHiveConnection=ConnectionHelper.isHive(tdDataProvider);
  final Table table=tbViewer.getTable();
  table.addMouseListener(new MouseAdapter(){
    @Override public void mouseDown(    MouseEvent e){
      if (table.getMenu() != null) {
        table.getMenu().setVisible(false);
      }
      if (e.button == 3) {
        StructuredSelection selection=(StructuredSelection)tbViewer.getSelection();
        final ChartDataEntity dataEntity=(ChartDataEntity)selection.getFirstElement();
        final Indicator indicator=dataEntity != null ? dataEntity.getIndicator() : null;
        if (indicator != null && dataEntity != null) {
          Menu menu=new Menu(table.getShell(),SWT.POP_UP);
          table.setMenu(menu);
          MenuItemEntity[] itemEntities=ChartTableMenuGenerator.generate(explorer,analysis,dataEntity);
          Long rowCount=getRowCount(analysis,dataEntity.getIndicator().getAnalyzedElement());
          if (!isJAVALanguage) {
            boolean showExtraMenu=false;
            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){
                  String query=itemEntity.getQuery();
                  String editorName=indicator.getName();
                  if (isPatternMatchingIndicator(indicator) && !((PatternExplorer)explorer).isImplementRegexFunction(itemEntity.getLabel())) {
                    MessageDialog.openInformation(new Shell(),itemEntity.getLabel(),DefaultMessagesImpl.getString("String_Node_Str"));
                    return;
                  }
                  CorePlugin.getDefault().runInDQViewer(tdDataProvider,query,editorName);
                }
              }
);
              if (IndicatorHelper.isWhereRuleIndicatorNotAide(indicator)) {
                WhereRuleIndicator ind=(WhereRuleIndicator)indicator;
                EList<JoinElement> joinConditions=ind.getJoinConditions();
                if (joinConditions.size() > 0) {
                  showExtraMenu=true;
                }
              }
              if (isPatternFrequencyIndicator(indicator)) {
                MenuItem itemCreatePatt=new MenuItem(menu,SWT.PUSH);
                itemCreatePatt.setText(DefaultMessagesImpl.getString("String_Node_Str"));
                itemCreatePatt.setImage(ImageLib.getImage(ImageLib.PATTERN_REG));
                itemCreatePatt.addSelectionListener(new SelectionAdapter(){
                  @Override public void widgetSelected(                  SelectionEvent e){
                    DbmsLanguage language=DbmsLanguageFactory.createDbmsLanguage(analysis);
                    PatternTransformer pattTransformer=new PatternTransformer(language);
                    createPattern(analysis,itemEntity,pattTransformer);
                  }
                }
);
              }
            }
            if (showExtraMenu) {
              MenuItem itemCreateWhereRule=new MenuItem(menu,SWT.PUSH);
              itemCreateWhereRule.setText(DefaultMessagesImpl.getString("String_Node_Str"));
              itemCreateWhereRule.addSelectionListener(new SelectionAdapter(){
                @Override public void widgetSelected(                SelectionEvent e){
                  final StructuredSelection selectionOne=(StructuredSelection)tbViewer.getSelection();
                  Object firstElement=selectionOne.getFirstElement();
                  if (firstElement instanceof WhereRuleChartDataEntity) {
                    WhereRuleChartDataEntity wrChartDataEntity=(WhereRuleChartDataEntity)firstElement;
                    WhereRuleIndicator wrInd=(WhereRuleIndicator)wrChartDataEntity.getIndicator();
                    CreateDuplicatesAnalysisAction action=new CreateDuplicatesAnalysisAction(buildColumnsMap(wrInd));
                    action.run();
                  }
                }
                /** 
 * DOC xqliu Comment method "buildColumnsMap".
 * @param wrInd
 * @return
 */
                private Map<ColumnSet,List<TdColumn>> buildColumnsMap(                WhereRuleIndicator wrInd){
                  Map<ColumnSet,List<TdColumn>> map=new HashMap<ColumnSet,List<TdColumn>>();
                  List<TdColumn> columns=new ArrayList<TdColumn>();
                  EList<JoinElement> joinConditions=wrInd.getJoinConditions();
                  for (                  JoinElement joinElement : joinConditions) {
                    TdColumn tempColumn=(TdColumn)joinElement.getColA();
                    if (!columns.contains(tempColumn)) {
                      columns.add(tempColumn);
                    }
                    tempColumn=(TdColumn)joinElement.getColB();
                    if (!columns.contains(tempColumn)) {
                      columns.add(tempColumn);
                    }
                  }
                  for (                  TdColumn column : columns) {
                    ColumnSet columnSet=ColumnHelper.getColumnOwnerAsColumnSet(column);
                    List<TdColumn> list=map.get(columnSet);
                    if (list == null) {
                      list=new ArrayList<TdColumn>();
                      map.put(columnSet,list);
                    }
                    list.add(column);
                  }
                  return getUserSelectedMap(map);
                }
                /** 
 * DOC xqliu Comment method "getUserSelectedMap".
 * @param map
 * @return
 */
                private Map<ColumnSet,List<TdColumn>> getUserSelectedMap(                Map<ColumnSet,List<TdColumn>> map){
                  Map<ColumnSet,List<TdColumn>> userMap=new HashMap<ColumnSet,List<TdColumn>>();
                  List<RepositoryNode> columnNodes=getColumnNodes(map);
                  RepositoryNode rootNode=getConnectionNode(map);
                  if (!columnNodes.isEmpty() && rootNode != null) {
                    ColumnsMapSelectionDialog dialog=new ColumnsMapSelectionDialog(null,PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),DefaultMessagesImpl.getString("String_Node_Str"),columnNodes,rootNode,DefaultMessagesImpl.getString("String_Node_Str"));
                    dialog.setAllMap(map);
                    if (dialog.open() == Window.OK) {
                      userMap=dialog.getUserMap();
                    }
                  }
                  return userMap;
                }
                /** 
 * DOC xqliu Comment method "getConnectionNode".
 * @param map
 * @return
 */
                private RepositoryNode getConnectionNode(                Map<ColumnSet,List<TdColumn>> map){
                  RepositoryNode node=null;
                  if (map != null && !map.isEmpty()) {
                    Connection connection=ConnectionHelper.getConnection(map.keySet().iterator().next());
                    if (connection != null) {
                      node=RepositoryNodeHelper.recursiveFind(connection);
                    }
                  }
                  return node;
                }
                /** 
 * DOC xqliu Comment method "getColumnNodes".
 * @param map
 * @return
 */
                private List<RepositoryNode> getColumnNodes(                Map<ColumnSet,List<TdColumn>> map){
                  List<RepositoryNode> nodes=new ArrayList<RepositoryNode>();
                  if (map != null && !map.isEmpty()) {
                    List<TdColumn> columns=new ArrayList<TdColumn>();
                    Set<ColumnSet> keySet=map.keySet();
                    for (                    ColumnSet cs : keySet) {
                      columns.addAll(map.get(cs));
                    }
                    if (!columns.isEmpty()) {
                      for (                      TdColumn column : columns) {
                        nodes.add(RepositoryNodeHelper.recursiveFind(column));
                      }
                    }
                  }
                  return nodes;
                }
              }
);
            }
          }
 else {
            if (analysis.getParameters().isStoreData()) {
              if (indicator.isUsedMapDBMode()) {
                createDrillDownMenuForMapDB(dataEntity,menu,itemEntities);
              }
 else {
                createDrillDownMenuForJava(dataEntity,menu,itemEntities);
              }
              if (isPatternFrequencyIndicator(indicator)) {
                for (                final MenuItemEntity itemEntity : itemEntities) {
                  if (itemEntity.getQuery() == null) {
                    if (dataEntity.getKey() == null) {
                      itemEntity.setQuery(dataEntity.getLabel());
                    }
 else {
                      itemEntity.setQuery(dataEntity.getKey().toString());
                    }
                  }
                  MenuItem itemCreatePatt=new MenuItem(menu,SWT.PUSH);
                  itemCreatePatt.setText(DefaultMessagesImpl.getString("String_Node_Str"));
                  itemCreatePatt.setImage(ImageLib.getImage(ImageLib.PATTERN_REG));
                  itemCreatePatt.addSelectionListener(new SelectionAdapter(){
                    @Override public void widgetSelected(                    SelectionEvent e){
                      DbmsLanguage language=DbmsLanguageFactory.createDbmsLanguage(analysis);
                      PatternTransformer pattTransformer=new PatternTransformer(language);
                      createPattern(analysis,itemEntity,pattTransformer);
                    }
                  }
);
                }
              }
            }
            if (isDatePatternFrequencyIndicator(indicator)) {
              final DatePatternFreqIndicator dateIndicator=(DatePatternFreqIndicator)indicator;
              MenuItem itemCreatePatt=new MenuItem(menu,SWT.PUSH);
              itemCreatePatt.setText(DefaultMessagesImpl.getString("String_Node_Str"));
              itemCreatePatt.setImage(ImageLib.getImage(ImageLib.PATTERN_REG));
              itemCreatePatt.addSelectionListener(new SelectionAdapter(){
                @Override public void widgetSelected(                SelectionEvent e){
                  DbmsLanguage language=DbmsLanguageFactory.createDbmsLanguage(analysis);
                  IFolder folder=ResourceManager.getPatternRegexFolder();
                  String model=dataEntity.getLabel();
                  String regex=dateIndicator.getRegex(model);
                  new CreatePatternAction(folder,ExpressionType.REGEXP,"String_Node_Str" + regex + "String_Node_Str",model == null ? "String_Node_Str" : "String_Node_Str" + model + "String_Node_Str",language.getDbmsName()).run();
                }
              }
);
            }
          }
          addJobGenerationMenu(menu,analysis,indicator);
          menu.setVisible(true);
        }
      }
    }
    private void createDrillDownMenuForMapDB(    final ChartDataEntity dataEntity,    Menu menu,    MenuItemEntity[] itemEntities){
      final Indicator indicator=dataEntity != null ? dataEntity.getIndicator() : null;
      if (dataEntity == null || RowCountIndicator.class.isInstance(indicator)) {
        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){
            CorePlugin.getDefault().openEditor(new DrillDownEditorInput(analysis,dataEntity,itemEntity),ChartTableFactory.DRILL_DOWN_EDITOR);
          }
        }
);
      }
    }
    /** 
 * DOC talend Comment method "createDrillDownMenu".
 * @param analysis
 * @param dataEntity
 * @param menu
 * @param itemEntities
 */
    private void createDrillDownMenuForJava(    final ChartDataEntity dataEntity,    Menu menu,    MenuItemEntity[] itemEntities){
      final Indicator indicator=dataEntity != null ? dataEntity.getIndicator() : null;
      AnalyzedDataSet analyDataSet=analysis.getResults().getIndicToRowMap().get(indicator);
      boolean hasData=analyDataSet != null && (analyDataSet.getData() != null && analyDataSet.getData().size() > 0 || analyDataSet.getFrequencyData() != null && analyDataSet.getFrequencyData().size() > 0 || analyDataSet.getPatternData() != null && analyDataSet.getPatternData().size() > 0);
      if (hasData) {
        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){
              CorePlugin.getDefault().openEditor(new DrillDownEditorInput(analysis,dataEntity,itemEntity),ChartTableFactory.DRILL_DOWN_EDITOR);
            }
          }
);
        }
      }
    }
    /** 
 * DOC xqliu Comment method "getRowCount".
 * @param analysis
 * @param analyzedElement
 * @return
 */
    private Long getRowCount(    Analysis analysis,    ModelElement analyzedElement){
      Long rowCount=0L;
      EList<Indicator> indicators=analysis.getResults().getIndicators();
      for (      Indicator ind : indicators) {
        if (ind instanceof RowCountIndicator && ind.getAnalyzedElement().equals(analyzedElement)) {
          rowCount=ind.getCount();
        }
      }
      return rowCount;
    }
    private SelectionAdapter getAdapter(    final IDatabaseJobService service){
      return new SelectionAdapter(){
        @Override public void widgetSelected(        SelectionEvent e){
          service.executeJob();
        }
      }
;
    }
  }
);
  TableUtils.addTooltipOnTableItem(table);
}