Program: 137791
Project: 137791
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=(EList<TableIndicator>)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(){
      public void widgetSelected(      SelectionEvent e){
        TableItem tableItem=cursor.getRow();
        String tableName=tableItem.getText(0);
        Package parentPack=(Package)currentSelectionSchemaIndicator.getAnalyzedElement();
        if (currentCatalogIndicator != null)         parentPack=(Package)currentCatalogIndicator.getAnalyzedElement();
        TypedReturnCode<TableNode> findSqlExplorerTableNode=SqlExplorerBridge.findSqlExplorerTableNode(tdDataProvider,parentPack,tableName,Messages.getString("String_Node_Str"));
        if (!findSqlExplorerTableNode.isOk()) {
        }
      }
    }
);
    indexitem.addSelectionListener(new SelectionAdapter(){
      public void widgetSelected(      SelectionEvent e){
        TableItem tableItem=cursor.getRow();
        String tableName=tableItem.getText(0);
        Package parentPack=(Package)currentSelectionSchemaIndicator.getAnalyzedElement();
        if (currentCatalogIndicator != null)         parentPack=(Package)currentCatalogIndicator.getAnalyzedElement();
        TypedReturnCode<TableNode> findSqlExplorerTableNode=SqlExplorerBridge.findSqlExplorerTableNode(tdDataProvider,parentPack,tableName,Messages.getString("String_Node_Str"));
        if (!findSqlExplorerTableNode.isOk()) {
        }
      }
    }
);
    tableAnalysisitem.addSelectionListener(new SelectionAdapter(){
      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);
  }
  tableOfCatalogOrSchemaViewer.getTable().setMenu(null);
  tableOfCatalogOrSchemaViewer.setInput(tableElements);
  List<ViewIndicator> indicatorViewList=(List<ViewIndicator>)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){
        TableItem tableItem=cursor.getRow();
        String tableName=tableItem.getText(0);
        Package parentPack=(Package)currentSelectionSchemaIndicator.getAnalyzedElement();
        if (currentCatalogIndicator != null) {
          parentPack=(Package)currentCatalogIndicator.getAnalyzedElement();
        }
        TypedReturnCode<TableNode> findSqlExplorerTableNode=SqlExplorerBridge.findSqlExplorerTableNode(tdDataProvider,parentPack,tableName,Messages.getString("String_Node_Str"));
        if (!findSqlExplorerTableNode.isOk()) {
        }
      }
    }
);
    indexitem.addSelectionListener(new SelectionAdapter(){
      @Override public void widgetSelected(      SelectionEvent e){
        TableItem tableItem=cursor.getRow();
        String tableName=tableItem.getText(0);
        Package parentPack=(Package)currentSelectionSchemaIndicator.getAnalyzedElement();
        if (currentCatalogIndicator != null) {
          parentPack=(Package)currentCatalogIndicator.getAnalyzedElement();
        }
        TypedReturnCode<TableNode> findSqlExplorerTableNode=SqlExplorerBridge.findSqlExplorerTableNode(tdDataProvider,parentPack,tableName,Messages.getString("String_Node_Str"));
        if (!findSqlExplorerTableNode.isOk()) {
        }
      }
    }
);
    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);
  }
  tableOfCatalogOrSchemaViewer.getTable().setMenu(null);
  tableOfCatalogOrSchemaViewer.setInput(tableElements);
  List<ViewIndicator> indicatorViewList=schemaIndicator.getViewIndicators();
  viewOfCatalogOrSchemaViewer.setInput(indicatorViewList);
  tableAndViewComposite.pack();
  statisticalSection.pack();
  statisticalSection.layout();
  form.reflow(true);
}