Program: 136508
Project: 136508
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.getTable().isDisposed()) {
    tableOfCatalogOrSchemaViewer=new TableViewer(tableAndViewComposite,SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER| SWT.FULL_SELECTION);
    final Table catalogOrSchemaTable=tableOfCatalogOrSchemaViewer.getTable();
    TableUtils.addActionTooltip(catalogOrSchemaTable);
    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 tableProvider=new TableOfCatalogOrSchemaProvider();
    tableOfCatalogOrSchemaViewer.setLabelProvider(tableProvider);
    tableOfCatalogOrSchemaViewer.setContentProvider(tableProvider);
    catalogOrSchemaTable.addMouseListener(new MouseAdapter(){
      @Override public void mouseDown(      MouseEvent e){
        if (e.button == 3) {
          if (catalogOrSchemaTable.getItemCount() > 0 && catalogOrSchemaTable.getSelectionIndex() != -1) {
            final Menu menu=new Menu(catalogOrSchemaTable.getShell(),SWT.POP_UP);
            catalogOrSchemaTable.setMenu(menu);
            MenuItem viewKeyMenuItem=new MenuItem(menu,SWT.PUSH);
            viewKeyMenuItem.setText(DefaultMessagesImpl.getString("String_Node_Str"));
            viewKeyMenuItem.setImage(ImageLib.getImage(ImageLib.PK_DECORATE));
            viewKeyMenuItem.addSelectionListener(new SelectionAdapter(){
              @Override public void widgetSelected(              SelectionEvent e){
                runMenu(catalogOrSchemaTable,DefaultMessagesImpl.getString("String_Node_Str"));
              }
            }
);
            MenuItem viewIndexMenuItem=new MenuItem(menu,SWT.PUSH);
            viewIndexMenuItem.setText(DefaultMessagesImpl.getString("String_Node_Str"));
            viewIndexMenuItem.setImage(ImageLib.getImage(ImageLib.INDEX_VIEW));
            viewIndexMenuItem.addSelectionListener(new SelectionAdapter(){
              @Override public void widgetSelected(              SelectionEvent e){
                runMenu(catalogOrSchemaTable,DefaultMessagesImpl.getString("String_Node_Str"));
              }
            }
);
            MenuItem tableAnalysisMenuItem=new MenuItem(menu,SWT.PUSH);
            tableAnalysisMenuItem.setText(DefaultMessagesImpl.getString("String_Node_Str"));
            tableAnalysisMenuItem.setImage(ImageLib.getImage(ImageLib.ACTION_NEW_ANALYSIS));
            tableAnalysisMenuItem.addSelectionListener(new SelectionAdapter(){
              @Override public void widgetSelected(              SelectionEvent e){
                TableItem tableItem=catalogOrSchemaTable.getItem(catalogOrSchemaTable.getSelectionIndex());
                OverviewIndUIElement data=(OverviewIndUIElement)tableItem.getData();
                runTableAnalysis(data);
              }
            }
);
          }
 else {
            catalogOrSchemaTable.setMenu(null);
          }
        }
      }
    }
);
    viewOfCatalogOrSchemaViewer=new TableViewer(tableAndViewComposite,SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER| SWT.FULL_SELECTION);
    final Table tableCatalogOrSchemaView=viewOfCatalogOrSchemaViewer.getTable();
    TableUtils.addActionTooltip(tableCatalogOrSchemaView);
    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);
    tableCatalogOrSchemaView.addMouseListener(new MouseAdapter(){
      @Override public void mouseDown(      MouseEvent e){
        if (e.button == 3) {
          if (tableCatalogOrSchemaView.getItemCount() > 0 && tableCatalogOrSchemaView.getSelectionIndex() != -1) {
            final Menu menu=new Menu(tableCatalogOrSchemaView.getShell(),SWT.POP_UP);
            tableCatalogOrSchemaView.setMenu(menu);
            MenuItem tableAnalysisMenuItem=new MenuItem(menu,SWT.PUSH);
            tableAnalysisMenuItem.setText(DefaultMessagesImpl.getString("String_Node_Str"));
            tableAnalysisMenuItem.setImage(ImageLib.getImage(ImageLib.ACTION_NEW_ANALYSIS));
            tableAnalysisMenuItem.addSelectionListener(new SelectionAdapter(){
              @Override public void widgetSelected(              SelectionEvent e){
                TableItem tableItem=tableCatalogOrSchemaView.getItem(tableCatalogOrSchemaView.getSelectionIndex());
                ViewIndicator viewIndicator=(ViewIndicator)tableItem.getData();
                runTableAnalysis(viewIndicator.getTableName());
              }
            }
);
          }
 else {
            tableCatalogOrSchemaView.setMenu(null);
          }
        }
      }
    }
);
  }
  tableOfCatalogOrSchemaViewer.getTable().setMenu(null);
  tableOfCatalogOrSchemaViewer.setInput(tableElements);
  List<ViewIndicator> indicatorViewList=schemaIndicator.getViewIndicators();
  viewOfCatalogOrSchemaViewer.setInput(indicatorViewList);
  viewOfCatalogOrSchemaViewer.getTable().setMenu(null);
  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.getTable().isDisposed()) {
    tableOfCatalogOrSchemaViewer=new TableViewer(tableAndViewComposite,SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER| SWT.FULL_SELECTION);
    final Table catalogOrSchemaTable=tableOfCatalogOrSchemaViewer.getTable();
    TableUtils.addActionTooltip(catalogOrSchemaTable);
    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 tableProvider=new TableOfCatalogOrSchemaProvider();
    tableOfCatalogOrSchemaViewer.setLabelProvider(tableProvider);
    tableOfCatalogOrSchemaViewer.setContentProvider(tableProvider);
    catalogOrSchemaTable.addMouseListener(new MouseAdapter(){
      @Override public void mouseDown(      MouseEvent e){
        if (e.button == 3) {
          TableItem item=catalogOrSchemaTable.getItem(catalogOrSchemaTable.getSelectionIndex());
          if (catalogOrSchemaTable.getItemCount() > 0 && catalogOrSchemaTable.getSelectionIndex() != -1) {
            final Menu menu=new Menu(catalogOrSchemaTable.getShell(),SWT.POP_UP);
            catalogOrSchemaTable.setMenu(menu);
            MenuItem viewKeyMenuItem=new MenuItem(menu,SWT.PUSH);
            viewKeyMenuItem.setText(DefaultMessagesImpl.getString("String_Node_Str"));
            viewKeyMenuItem.setImage(ImageLib.getImage(ImageLib.PK_DECORATE));
            viewKeyMenuItem.addSelectionListener(new SelectionAdapter(){
              @Override public void widgetSelected(              SelectionEvent e){
                runMenu(catalogOrSchemaTable,DefaultMessagesImpl.getString("String_Node_Str"));
              }
            }
);
            MenuItem viewIndexMenuItem=new MenuItem(menu,SWT.PUSH);
            viewIndexMenuItem.setText(DefaultMessagesImpl.getString("String_Node_Str"));
            viewIndexMenuItem.setImage(ImageLib.getImage(ImageLib.INDEX_VIEW));
            viewIndexMenuItem.addSelectionListener(new SelectionAdapter(){
              @Override public void widgetSelected(              SelectionEvent e){
                runMenu(catalogOrSchemaTable,DefaultMessagesImpl.getString("String_Node_Str"));
              }
            }
);
            TableItem tableItem=catalogOrSchemaTable.getItem(catalogOrSchemaTable.getSelectionIndex());
            final OverviewIndUIElement data=(OverviewIndUIElement)tableItem.getData();
            MenuItem tableAnalysisMenuItem=new MenuItem(menu,SWT.PUSH);
            tableAnalysisMenuItem.setText(DefaultMessagesImpl.getString("String_Node_Str"));
            tableAnalysisMenuItem.setImage(ImageLib.getImage(ImageLib.ACTION_NEW_ANALYSIS));
            tableAnalysisMenuItem.addSelectionListener(new SelectionAdapter(){
              @Override public void widgetSelected(              SelectionEvent e){
                runTableAnalysis(data);
              }
            }
);
            if (data.isVirtualNode()) {
              tableAnalysisMenuItem.setEnabled(false);
            }
          }
 else {
            catalogOrSchemaTable.setMenu(null);
          }
        }
      }
    }
);
    viewOfCatalogOrSchemaViewer=new TableViewer(tableAndViewComposite,SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER| SWT.FULL_SELECTION);
    final Table tableCatalogOrSchemaView=viewOfCatalogOrSchemaViewer.getTable();
    TableUtils.addActionTooltip(tableCatalogOrSchemaView);
    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);
    tableCatalogOrSchemaView.addMouseListener(new MouseAdapter(){
      @Override public void mouseDown(      MouseEvent e){
        if (e.button == 3) {
          TableItem tableItem=tableCatalogOrSchemaView.getItem(tableCatalogOrSchemaView.getSelectionIndex());
          final OverviewIndUIElement data=(OverviewIndUIElement)tableItem.getData();
          if (tableCatalogOrSchemaView.getItemCount() > 0 && tableCatalogOrSchemaView.getSelectionIndex() != -1) {
            final Menu menu=new Menu(tableCatalogOrSchemaView.getShell(),SWT.POP_UP);
            tableCatalogOrSchemaView.setMenu(menu);
            MenuItem tableAnalysisMenuItem=new MenuItem(menu,SWT.PUSH);
            tableAnalysisMenuItem.setText(DefaultMessagesImpl.getString("String_Node_Str"));
            tableAnalysisMenuItem.setImage(ImageLib.getImage(ImageLib.ACTION_NEW_ANALYSIS));
            tableAnalysisMenuItem.addSelectionListener(new SelectionAdapter(){
              @Override public void widgetSelected(              SelectionEvent e){
                ViewIndicator viewIndicator=(ViewIndicator)data.getOverviewIndicator();
                runTableAnalysis(viewIndicator.getTableName());
              }
            }
);
            if (data.isVirtualNode()) {
              tableAnalysisMenuItem.setEnabled(false);
            }
          }
 else {
            tableCatalogOrSchemaView.setMenu(null);
          }
        }
      }
    }
);
  }
  tableOfCatalogOrSchemaViewer.getTable().setMenu(null);
  tableOfCatalogOrSchemaViewer.setInput(tableElements);
  List<ViewIndicator> indicatorViewList=schemaIndicator.getViewIndicators();
  List<OverviewIndUIElement> viewElements=wapperInput(indicatorViewList,parentNode);
  viewOfCatalogOrSchemaViewer.setInput(viewElements);
  viewOfCatalogOrSchemaViewer.getTable().setMenu(null);
  tableAndViewComposite.pack();
  statisticalSection.pack();
  statisticalSection.layout();
  form.reflow(true);
}