Program: 137317
Project: 137317
Buggy source:
/** 
 * DOC klliu Comment method "displayTableAndViewComp".
 * @param schemaIndicator
 * @param parentNode
 */
protected void displayTableAndViewComp(final SchemaIndicator schemaIndicator,final IRepositoryNode parentNode){
  tableAndViewComposite.setVisible(true);
  EList<TableIndicator> indicatorTableList=schemaIndicator.getTableIndicators();
  List<OverviewIndUIElement> tableElements=wapperInput(indicatorTableList,parentNode);
  if (tableOfCatalogOrSchemaViewer == null) {
    tableOfCatalogOrSchemaViewer=new TableViewer(tableAndViewComposite,SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER| SWT.SINGLE);
    final Table catalogOrSchemaTable=tableOfCatalogOrSchemaViewer.getTable();
    catalogOrSchemaTable.setHeaderVisible(true);
    catalogOrSchemaTable.setLinesVisible(true);
    GridData layoutData=new GridData(SWT.FILL,SWT.FILL,true,true);
    layoutData.heightHint=150;
    catalogOrSchemaTable.setLayoutData(layoutData);
    String[] columnTexts=new String[]{DefaultMessagesImpl.getString("String_Node_Str"),DefaultMessagesImpl.getString("String_Node_Str"),DefaultMessagesImpl.getString("String_Node_Str"),DefaultMessagesImpl.getString("String_Node_Str")};
    createSorterColumns(tableOfCatalogOrSchemaViewer,columnTexts,tableSorters,COLUMN_TABLE_WIDTH);
    TableOfCatalogOrSchemaProvider providerTable=new TableOfCatalogOrSchemaProvider();
    tableOfCatalogOrSchemaViewer.setLabelProvider(providerTable);
    tableOfCatalogOrSchemaViewer.setContentProvider(providerTable);
    final TableCursor cursor=new TableCursor(catalogOrSchemaTable,SWT.NONE);
    cursor.setBackground(catalogOrSchemaTable.getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION));
    cursor.setForeground(catalogOrSchemaTable.getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT));
    cursor.setLayout(new FillLayout());
    final Menu menu=new Menu(catalogOrSchemaTable);
    MenuItem keyitem=new MenuItem(menu,SWT.PUSH);
    keyitem.setText(DefaultMessagesImpl.getString("String_Node_Str"));
    keyitem.setImage(ImageLib.getImage(ImageLib.PK_DECORATE));
    final Menu menu1=new Menu(catalogOrSchemaTable);
    MenuItem indexitem=new MenuItem(menu1,SWT.PUSH);
    indexitem.setText(DefaultMessagesImpl.getString("String_Node_Str"));
    indexitem.setImage(ImageLib.getImage(ImageLib.INDEX_VIEW));
    final Menu menu2=new Menu(catalogOrSchemaTable);
    MenuItem tableAnalysisitem=new MenuItem(menu2,SWT.PUSH);
    tableAnalysisitem.setText(DefaultMessagesImpl.getString("String_Node_Str"));
    tableAnalysisitem.setImage(ImageLib.getImage(ImageLib.ACTION_NEW_ANALYSIS));
    keyitem.addSelectionListener(new SelectionAdapter(){
      @Override public void widgetSelected(      SelectionEvent e){
        runMenu(cursor,Messages.getString("String_Node_Str"));
      }
    }
);
    indexitem.addSelectionListener(new SelectionAdapter(){
      @Override public void widgetSelected(      SelectionEvent e){
        runMenu(cursor,Messages.getString("String_Node_Str"));
      }
    }
);
    tableAnalysisitem.addSelectionListener(new SelectionAdapter(){
      @Override public void widgetSelected(      SelectionEvent e){
        TableItem tableItem=cursor.getRow();
        OverviewIndUIElement data=(OverviewIndUIElement)tableItem.getData();
        runTableAnalysis(data);
      }
    }
);
    cursor.addMenuDetectListener(new MenuDetectListener(){
      public void menuDetected(      MenuDetectEvent e){
        int column=cursor.getColumn();
        if (column == TABLE_COLUMN_INDEX) {
          cursor.setMenu(menu2);
          menu2.setVisible(true);
        }
 else         if (column == VIEW_COLUMN_INDEXES) {
          cursor.setMenu(menu1);
          menu1.setVisible(true);
        }
 else         if (column == VIEW_COLUMN_INDEX) {
          cursor.setMenu(menu);
          menu.setVisible(true);
        }
 else {
          cursor.setMenu(null);
        }
      }
    }
);
    viewOfCatalogOrSchemaViewer=new TableViewer(tableAndViewComposite,SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER| SWT.FULL_SELECTION);
    Table tableCatalogOrSchemaView=viewOfCatalogOrSchemaViewer.getTable();
    tableCatalogOrSchemaView.setHeaderVisible(true);
    tableCatalogOrSchemaView.setLinesVisible(true);
    layoutData=new GridData(SWT.FILL,SWT.FILL,true,true);
    layoutData.heightHint=150;
    tableCatalogOrSchemaView.setLayoutData(layoutData);
    columnTexts=new String[]{DefaultMessagesImpl.getString("String_Node_Str"),DefaultMessagesImpl.getString("String_Node_Str")};
    createSorterColumns(viewOfCatalogOrSchemaViewer,columnTexts,viewSorters,COLUMN_VIEW_WIDTH);
    ViewOfCatalogOrSchemaProvider viewProvider=new ViewOfCatalogOrSchemaProvider();
    viewOfCatalogOrSchemaViewer.setLabelProvider(viewProvider);
    viewOfCatalogOrSchemaViewer.setContentProvider(viewProvider);
    final Menu menuForView=new Menu(tableCatalogOrSchemaView);
    MenuItem tableAnalysisitemForView=new MenuItem(menuForView,SWT.PUSH);
    tableAnalysisitemForView.setText(DefaultMessagesImpl.getString("String_Node_Str"));
    tableAnalysisitemForView.setImage(ImageLib.getImage(ImageLib.ACTION_NEW_ANALYSIS));
    final TableCursor cursorForView=new TableCursor(tableCatalogOrSchemaView,SWT.NONE);
    cursorForView.setBackground(tableCatalogOrSchemaView.getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION));
    cursorForView.setForeground(tableCatalogOrSchemaView.getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT));
    cursorForView.setLayout(new FillLayout());
    cursorForView.addMenuDetectListener(new MenuDetectListener(){
      public void menuDetected(      MenuDetectEvent e){
        int column=cursorForView.getColumn();
        if (column == TABLE_COLUMN_INDEX) {
          cursorForView.setMenu(menuForView);
          menuForView.setVisible(true);
        }
 else {
          cursorForView.setMenu(null);
        }
      }
    }
);
    tableAnalysisitemForView.addSelectionListener(new SelectionAdapter(){
      @Override public void widgetSelected(      SelectionEvent e){
        TableItem tableItem=cursorForView.getRow();
        ViewIndicator viewIndicator=(ViewIndicator)tableItem.getData();
        runTableAnalysis(viewIndicator.getTableName());
      }
    }
);
  }
  tableOfCatalogOrSchemaViewer.getTable().setMenu(null);
  tableOfCatalogOrSchemaViewer.setInput(tableElements);
  List<ViewIndicator> indicatorViewList=schemaIndicator.getViewIndicators();
  viewOfCatalogOrSchemaViewer.setInput(indicatorViewList);
  tableAndViewComposite.pack();
  statisticalSection.pack();
  statisticalSection.layout();
  form.reflow(true);
}

Fixed version (ground truth):
/** 
 * DOC klliu Comment method "displayTableAndViewComp".
 * @param schemaIndicator
 * @param parentNode
 */
protected void displayTableAndViewComp(final SchemaIndicator schemaIndicator,final IRepositoryNode parentNode){
  tableAndViewComposite.setVisible(true);
  EList<TableIndicator> indicatorTableList=schemaIndicator.getTableIndicators();
  List<OverviewIndUIElement> tableElements=wapperInput(indicatorTableList,parentNode);
  if (tableOfCatalogOrSchemaViewer == null) {
    tableOfCatalogOrSchemaViewer=new TableViewer(tableAndViewComposite,SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER| SWT.SINGLE);
    final Table catalogOrSchemaTable=tableOfCatalogOrSchemaViewer.getTable();
    catalogOrSchemaTable.setHeaderVisible(true);
    catalogOrSchemaTable.setLinesVisible(true);
    GridData layoutData=new GridData(SWT.FILL,SWT.FILL,true,true);
    layoutData.heightHint=150;
    catalogOrSchemaTable.setLayoutData(layoutData);
    String[] columnTexts=new String[]{DefaultMessagesImpl.getString("String_Node_Str"),DefaultMessagesImpl.getString("String_Node_Str"),DefaultMessagesImpl.getString("String_Node_Str"),DefaultMessagesImpl.getString("String_Node_Str")};
    createSorterColumns(tableOfCatalogOrSchemaViewer,columnTexts,tableSorters,COLUMN_TABLE_WIDTH);
    TableOfCatalogOrSchemaProvider providerTable=new TableOfCatalogOrSchemaProvider();
    tableOfCatalogOrSchemaViewer.setLabelProvider(providerTable);
    tableOfCatalogOrSchemaViewer.setContentProvider(providerTable);
    final TableCursor cursor=new TableCursor(catalogOrSchemaTable,SWT.NONE);
    cursor.setBackground(catalogOrSchemaTable.getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION));
    cursor.setForeground(catalogOrSchemaTable.getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT));
    cursor.setLayout(new FillLayout());
    final Menu menu=new Menu(catalogOrSchemaTable);
    MenuItem keyitem=new MenuItem(menu,SWT.PUSH);
    keyitem.setText(DefaultMessagesImpl.getString("String_Node_Str"));
    keyitem.setImage(ImageLib.getImage(ImageLib.PK_DECORATE));
    final Menu menu1=new Menu(catalogOrSchemaTable);
    MenuItem indexitem=new MenuItem(menu1,SWT.PUSH);
    indexitem.setText(DefaultMessagesImpl.getString("String_Node_Str"));
    indexitem.setImage(ImageLib.getImage(ImageLib.INDEX_VIEW));
    final Menu menu2=new Menu(catalogOrSchemaTable);
    MenuItem tableAnalysisitem=new MenuItem(menu2,SWT.PUSH);
    tableAnalysisitem.setText(DefaultMessagesImpl.getString("String_Node_Str"));
    tableAnalysisitem.setImage(ImageLib.getImage(ImageLib.ACTION_NEW_ANALYSIS));
    keyitem.addSelectionListener(new SelectionAdapter(){
      @Override public void widgetSelected(      SelectionEvent e){
        runMenu(cursor,Messages.getString("String_Node_Str"));
      }
    }
);
    indexitem.addSelectionListener(new SelectionAdapter(){
      @Override public void widgetSelected(      SelectionEvent e){
        runMenu(cursor,Messages.getString("String_Node_Str"));
      }
    }
);
    tableAnalysisitem.addSelectionListener(new SelectionAdapter(){
      @Override public void widgetSelected(      SelectionEvent e){
        TableItem tableItem=cursor.getRow();
        OverviewIndUIElement data=(OverviewIndUIElement)tableItem.getData();
        runTableAnalysis(data);
      }
    }
);
    cursor.addMenuDetectListener(new MenuDetectListener(){
      public void menuDetected(      MenuDetectEvent e){
        boolean isHive=false;
        if (tdDataProvider instanceof DatabaseConnection) {
          isHive=EDatabaseTypeName.HIVE.getXmlName().equals(((DatabaseConnection)tdDataProvider).getDatabaseType());
        }
        int column=cursor.getColumn();
        if (column == TABLE_COLUMN_INDEX) {
          cursor.setMenu(menu2);
          menu2.setVisible(true);
        }
 else         if (column == VIEW_COLUMN_INDEXES) {
          if (!isHive) {
            cursor.setMenu(menu1);
            menu1.setVisible(true);
          }
        }
 else         if (column == VIEW_COLUMN_INDEX) {
          if (!isHive) {
            cursor.setMenu(menu);
            menu.setVisible(true);
          }
        }
 else {
          cursor.setMenu(null);
        }
      }
    }
);
    viewOfCatalogOrSchemaViewer=new TableViewer(tableAndViewComposite,SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER| SWT.FULL_SELECTION);
    Table tableCatalogOrSchemaView=viewOfCatalogOrSchemaViewer.getTable();
    tableCatalogOrSchemaView.setHeaderVisible(true);
    tableCatalogOrSchemaView.setLinesVisible(true);
    layoutData=new GridData(SWT.FILL,SWT.FILL,true,true);
    layoutData.heightHint=150;
    tableCatalogOrSchemaView.setLayoutData(layoutData);
    columnTexts=new String[]{DefaultMessagesImpl.getString("String_Node_Str"),DefaultMessagesImpl.getString("String_Node_Str")};
    createSorterColumns(viewOfCatalogOrSchemaViewer,columnTexts,viewSorters,COLUMN_VIEW_WIDTH);
    ViewOfCatalogOrSchemaProvider viewProvider=new ViewOfCatalogOrSchemaProvider();
    viewOfCatalogOrSchemaViewer.setLabelProvider(viewProvider);
    viewOfCatalogOrSchemaViewer.setContentProvider(viewProvider);
    final Menu menuForView=new Menu(tableCatalogOrSchemaView);
    MenuItem tableAnalysisitemForView=new MenuItem(menuForView,SWT.PUSH);
    tableAnalysisitemForView.setText(DefaultMessagesImpl.getString("String_Node_Str"));
    tableAnalysisitemForView.setImage(ImageLib.getImage(ImageLib.ACTION_NEW_ANALYSIS));
    final TableCursor cursorForView=new TableCursor(tableCatalogOrSchemaView,SWT.NONE);
    cursorForView.setBackground(tableCatalogOrSchemaView.getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION));
    cursorForView.setForeground(tableCatalogOrSchemaView.getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT));
    cursorForView.setLayout(new FillLayout());
    cursorForView.addMenuDetectListener(new MenuDetectListener(){
      public void menuDetected(      MenuDetectEvent e){
        int column=cursorForView.getColumn();
        if (column == TABLE_COLUMN_INDEX) {
          cursorForView.setMenu(menuForView);
          menuForView.setVisible(true);
        }
 else {
          cursorForView.setMenu(null);
        }
      }
    }
);
    tableAnalysisitemForView.addSelectionListener(new SelectionAdapter(){
      @Override public void widgetSelected(      SelectionEvent e){
        TableItem tableItem=cursorForView.getRow();
        ViewIndicator viewIndicator=(ViewIndicator)tableItem.getData();
        runTableAnalysis(viewIndicator.getTableName());
      }
    }
);
  }
  tableOfCatalogOrSchemaViewer.getTable().setMenu(null);
  tableOfCatalogOrSchemaViewer.setInput(tableElements);
  List<ViewIndicator> indicatorViewList=schemaIndicator.getViewIndicators();
  viewOfCatalogOrSchemaViewer.setInput(indicatorViewList);
  tableAndViewComposite.pack();
  statisticalSection.pack();
  statisticalSection.layout();
  form.reflow(true);
}