Program: 139165
Project: 139165
Buggy source:
protected void displayTableAndViewComp(final SchemaIndicator schemaIndicator){
  tableAndViewComposite.setVisible(true);
  List<TableIndicator> indicatorTableList=(List<TableIndicator>)schemaIndicator.getTableIndicators();
  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();
        TypedReturnCode<TdProviderConnection> tdPc=DataProviderHelper.getTdProviderConnection(tdDataProvider);
        TdProviderConnection providerConnection=tdPc.getObject();
        TypedReturnCode<TableNode> findSqlExplorerTableNode=SqlExplorerBridge.findSqlExplorerTableNode(providerConnection,parentPack,tableName,Messages.getString("String_Node_Str"));
        if (!findSqlExplorerTableNode.isOk()) {
          log.error(findSqlExplorerTableNode.getMessage());
        }
      }
    }
);
    cursor.addSelectionListener(new SelectionAdapter(){
      public void widgetSelected(      SelectionEvent e){
        int column=cursor.getColumn();
        if (column == VIEW_COLUMN_INDEX) {
          cursor.setMenu(menu);
          menu.setVisible(true);
        }
 else {
          cursor.setMenu(null);
        }
      }
    }
);
    indexitem.addSelectionListener(new SelectionAdapter(){
      public void widgetSelected(      SelectionEvent e){
        TableItem tableItem=cursor.getRow();
        String tableName=tableItem.getText(0);
        Package parentPack=(Package)currentSelectionSchemaIndicator.getAnalyzedElement();
        TypedReturnCode<TdProviderConnection> tdPc=DataProviderHelper.getTdProviderConnection(tdDataProvider);
        TdProviderConnection providerConnection=tdPc.getObject();
        TypedReturnCode<TableNode> findSqlExplorerTableNode=SqlExplorerBridge.findSqlExplorerTableNode(providerConnection,parentPack,tableName,Messages.getString("String_Node_Str"));
        if (!findSqlExplorerTableNode.isOk()) {
          log.error(findSqlExplorerTableNode.getMessage());
        }
      }
    }
);
    cursor.addSelectionListener(new SelectionAdapter(){
      public void widgetSelected(      SelectionEvent e){
        int column=cursor.getColumn();
        if (column == VIEW_COLUMN_INDEXES) {
          cursor.setMenu(menu1);
          menu1.setVisible(true);
        }
 else {
          cursor.setMenu(null);
        }
      }
    }
);
    tableAnalysisitem.addSelectionListener(new SelectionAdapter(){
      public void widgetSelected(      SelectionEvent e){
        TableItem tableItem=cursor.getRow();
        runTableAnalysis(tableItem.getText(0));
      }
    }
);
    cursor.addSelectionListener(new SelectionAdapter(){
      public void widgetSelected(      SelectionEvent e){
        int column=cursor.getColumn();
        if (column == TABLE_COLUMN_INDEX) {
          cursor.setMenu(menu2);
          menu2.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(indicatorTableList);
  List<ViewIndicator> indicatorViewList=(List<ViewIndicator>)schemaIndicator.getViewIndicators();
  viewOfCatalogOrSchemaViewer.setInput(indicatorViewList);
  tableAndViewComposite.pack();
  statisticalSection.pack();
  statisticalSection.layout();
  form.reflow(true);
}

Fixed version (ground truth):
protected void displayTableAndViewComp(final SchemaIndicator schemaIndicator){
  tableAndViewComposite.setVisible(true);
  List<TableIndicator> indicatorTableList=(List<TableIndicator>)schemaIndicator.getTableIndicators();
  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();
        TypedReturnCode<TdProviderConnection> tdPc=DataProviderHelper.getTdProviderConnection(tdDataProvider);
        TdProviderConnection providerConnection=tdPc.getObject();
        TypedReturnCode<TableNode> findSqlExplorerTableNode=SqlExplorerBridge.findSqlExplorerTableNode(providerConnection,parentPack,tableName,Messages.getString("String_Node_Str"));
        if (!findSqlExplorerTableNode.isOk()) {
          log.error(findSqlExplorerTableNode.getMessage());
        }
      }
    }
);
    cursor.addSelectionListener(new SelectionAdapter(){
      public void widgetSelected(      SelectionEvent e){
        int column=cursor.getColumn();
        if (column == VIEW_COLUMN_INDEX) {
          cursor.setMenu(menu);
          menu.setVisible(true);
        }
 else {
          cursor.setMenu(null);
        }
      }
    }
);
    indexitem.addSelectionListener(new SelectionAdapter(){
      public void widgetSelected(      SelectionEvent e){
        TableItem tableItem=cursor.getRow();
        String tableName=tableItem.getText(0);
        Package parentPack=(Package)currentSelectionSchemaIndicator.getAnalyzedElement();
        TypedReturnCode<TdProviderConnection> tdPc=DataProviderHelper.getTdProviderConnection(tdDataProvider);
        TdProviderConnection providerConnection=tdPc.getObject();
        TypedReturnCode<TableNode> findSqlExplorerTableNode=SqlExplorerBridge.findSqlExplorerTableNode(providerConnection,parentPack,tableName,Messages.getString("String_Node_Str"));
        if (!findSqlExplorerTableNode.isOk()) {
          log.error(findSqlExplorerTableNode.getMessage());
        }
      }
    }
);
    cursor.addSelectionListener(new SelectionAdapter(){
      public void widgetSelected(      SelectionEvent e){
        int column=cursor.getColumn();
        if (column == VIEW_COLUMN_INDEXES) {
          cursor.setMenu(menu1);
          menu1.setVisible(true);
        }
 else {
          cursor.setMenu(null);
        }
      }
    }
);
    tableAnalysisitem.addSelectionListener(new SelectionAdapter(){
      public void widgetSelected(      SelectionEvent e){
        TableItem tableItem=cursor.getRow();
        runTableAnalysis(tableItem.getText(0));
      }
    }
);
    cursor.addListener(SWT.MouseUp,new Listener(){
      public void handleEvent(      Event e){
        if (1 < e.button) {
          int column=cursor.getColumn();
          if (column == TABLE_COLUMN_INDEX) {
            cursor.setMenu(menu2);
            menu2.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(indicatorTableList);
  List<ViewIndicator> indicatorViewList=(List<ViewIndicator>)schemaIndicator.getViewIndicators();
  viewOfCatalogOrSchemaViewer.setInput(indicatorViewList);
  tableAndViewComposite.pack();
  statisticalSection.pack();
  statisticalSection.layout();
  form.reflow(true);
}