Program: 170774
Project: 170774
Buggy source:
/** 
 * SubMenu for column specific tasks.
 * @param iColumn Column # that tasks apply to.
 */
public void fillColumnMenu(final Menu menu,final TableColumnCore column,boolean isBlankArea){
  String tableID=tv.getTableID();
  int hiddenColumnCount=0;
  if (!isBlankArea) {
    TableColumnManager tcm=TableColumnManager.getInstance();
    TableColumnCore[] allTableColumns=tcm.getAllTableColumnCoreAsArray(tv.getDataSourceType(),tableID);
    Arrays.sort(allTableColumns,TableColumnManager.getTableColumnOrderComparator());
    for (    final TableColumnCore tc : allTableColumns) {
      boolean visible=tc.isVisible();
      if (!visible) {
        TableColumnInfo columnInfo=tcm.getColumnInfo(tv.getDataSourceType(),tableID,tc.getName());
        if (columnInfo.getProficiency() != TableColumnInfo.PROFICIENCY_BEGINNER) {
          hiddenColumnCount++;
          continue;
        }
      }
      MenuItem menuItem=new MenuItem(menu,SWT.CHECK);
      Messages.setLanguageText(menuItem,tc.getTitleLanguageKey());
      if (visible) {
        menuItem.setSelection(true);
      }
      menuItem.addListener(SWT.Selection,new Listener(){
        @Override public void handleEvent(        Event e){
          tc.setVisible(!tc.isVisible());
          TableColumnManager tcm=TableColumnManager.getInstance();
          String tableID=tv.getTableID();
          tcm.saveTableColumns(tv.getDataSourceType(),tableID);
          if (tv instanceof TableStructureModificationListener) {
            ((TableStructureModificationListener)tv).tableStructureChanged(true,null);
          }
        }
      }
);
    }
  }
  if (hiddenColumnCount > 0) {
    MenuItem itemMoreHidden=new MenuItem(menu,SWT.PUSH);
    Messages.setLanguageText(itemMoreHidden,"String_Node_Str",new String[]{String.valueOf(hiddenColumnCount)});
    itemMoreHidden.addListener(SWT.Selection,new Listener(){
      @Override public void handleEvent(      Event e){
        showColumnEditor();
      }
    }
);
  }
  if (menu.getItemCount() > 0) {
    new MenuItem(menu,SWT.SEPARATOR);
  }
  if (column != null) {
    final MenuItem renameColumn=new MenuItem(menu,SWT.PUSH);
    Messages.setLanguageText(renameColumn,"String_Node_Str");
    renameColumn.addListener(SWT.Selection,new Listener(){
      @Override public void handleEvent(      Event e){
        SimpleTextEntryWindow entryWindow=new SimpleTextEntryWindow("String_Node_Str","String_Node_Str");
        String existing_name=column.getNameOverride();
        if (existing_name == null) {
          existing_name="String_Node_Str";
        }
        entryWindow.setPreenteredText(existing_name,false);
        entryWindow.selectPreenteredText(true);
        entryWindow.prompt(new UIInputReceiverListener(){
          @Override public void UIInputReceiverClosed(          UIInputReceiver entryWindow){
            if (!entryWindow.hasSubmittedInput()) {
              return;
            }
            String name=entryWindow.getSubmittedInput().trim();
            if (name.length() == 0) {
              name=null;
            }
            column.setNameOverride(name);
            TableColumnManager tcm=TableColumnManager.getInstance();
            String tableID=tv.getTableID();
            tcm.saveTableColumns(tv.getDataSourceType(),tableID);
            TableStructureEventDispatcher.getInstance(tableID).tableStructureChanged(true,null);
          }
        }
);
      }
    }
);
    final MenuItem itemPrefSize=new MenuItem(menu,SWT.PUSH);
    Messages.setLanguageText(itemPrefSize,"String_Node_Str");
    itemPrefSize.addListener(SWT.Selection,new Listener(){
      @Override public void handleEvent(      Event e){
        Utils.execSWTThread(new Runnable(){
          @Override public void run(){
            column.setPreferredWidth(-1);
            tv.runForAllRows(new TableGroupRowRunner(){
              @Override public void run(              TableRowCore row){
                row.fakeRedraw(column.getName());
              }
            }
);
            int pref=column.getPreferredWidth();
            if (pref != -1) {
              column.setWidth(pref);
            }
          }
        }
);
      }
    }
);
  }
  final MenuItem itemResetColumns=new MenuItem(menu,SWT.PUSH);
  Messages.setLanguageText(itemResetColumns,"String_Node_Str");
  itemResetColumns.addListener(SWT.Selection,new Listener(){
    @Override public void handleEvent(    Event e){
      String tableID=tv.getTableID();
      TableColumnManager tcm=TableColumnManager.getInstance();
      tcm.resetColumns(tv.getDataSourceType(),tableID);
    }
  }
);
  final MenuItem itemChangeTable=new MenuItem(menu,SWT.PUSH);
  Messages.setLanguageText(itemChangeTable,"String_Node_Str");
  Utils.setMenuItemImage(itemChangeTable,"String_Node_Str");
  itemChangeTable.addListener(SWT.Selection,new Listener(){
    @Override public void handleEvent(    Event e){
      showColumnEditor();
    }
  }
);
  menu.setData("String_Node_Str",column);
  if (column == null) {
    return;
  }
  String sColumnName=column.getName();
  if (sColumnName != null) {
    Object[] listeners=listenersMenuFill.toArray();
    for (int i=0; i < listeners.length; i++) {
      TableViewSWTMenuFillListener l=(TableViewSWTMenuFillListener)listeners[i];
      l.addThisColumnSubMenu(sColumnName,menu);
    }
  }
  final MenuItem at_item=new MenuItem(menu,SWT.CHECK);
  Messages.setLanguageText(at_item,"String_Node_Str");
  at_item.addListener(SWT.Selection,new Listener(){
    @Override public void handleEvent(    Event e){
      TableColumnCore tcc=(TableColumnCore)menu.getData("String_Node_Str");
      tcc.setAutoTooltip(at_item.getSelection());
      tcc.invalidateCells();
    }
  }
);
  at_item.setSelection(column.doesAutoTooltip());
  TableContextMenuItem[] items=column.getContextMenuItems(TableColumnCore.MENU_STYLE_HEADER);
  if (items.length > 0) {
    new MenuItem(menu,SWT.SEPARATOR);
    MenuBuildUtils.addPluginMenuItems(items,menu,true,true,new MenuBuildUtils.MenuItemPluginMenuControllerImpl(tv.getSelectedDataSources(true)));
  }
}

Fixed version (ground truth):
/** 
 * SubMenu for column specific tasks.
 * @param iColumn Column # that tasks apply to.
 */
public void fillColumnMenu(final Menu menu,final TableColumnCore column,boolean isBlankArea){
  String tableID=tv.getTableID();
  int hiddenColumnCount=0;
  if (!isBlankArea) {
    TableColumnManager tcm=TableColumnManager.getInstance();
    TableColumnCore[] allTableColumns=tcm.getAllTableColumnCoreAsArray(tv.getDataSourceType(),tableID);
    Arrays.sort(allTableColumns,TableColumnManager.getTableColumnOrderComparator());
    for (    final TableColumnCore tc : allTableColumns) {
      boolean visible=tc.isVisible();
      if (!visible) {
        TableColumnInfo columnInfo=tcm.getColumnInfo(tv.getDataSourceType(),tableID,tc.getName());
        if (columnInfo.getProficiency() != TableColumnInfo.PROFICIENCY_BEGINNER) {
          hiddenColumnCount++;
          continue;
        }
      }
      MenuItem menuItem=new MenuItem(menu,SWT.CHECK);
      Messages.setLanguageText(menuItem,tc.getTitleLanguageKey());
      if (visible) {
        menuItem.setSelection(true);
      }
      menuItem.addListener(SWT.Selection,new Listener(){
        @Override public void handleEvent(        Event e){
          tc.setVisible(!tc.isVisible());
          TableColumnManager tcm=TableColumnManager.getInstance();
          String tableID=tv.getTableID();
          tcm.saveTableColumns(tv.getDataSourceType(),tableID);
          if (tv instanceof TableStructureModificationListener) {
            ((TableStructureModificationListener)tv).tableStructureChanged(true,null);
          }
          TableStructureEventDispatcher.getInstance(tableID).tableStructureChanged(true,null);
        }
      }
);
    }
  }
  if (hiddenColumnCount > 0) {
    MenuItem itemMoreHidden=new MenuItem(menu,SWT.PUSH);
    Messages.setLanguageText(itemMoreHidden,"String_Node_Str",new String[]{String.valueOf(hiddenColumnCount)});
    itemMoreHidden.addListener(SWT.Selection,new Listener(){
      @Override public void handleEvent(      Event e){
        showColumnEditor();
      }
    }
);
  }
  if (menu.getItemCount() > 0) {
    new MenuItem(menu,SWT.SEPARATOR);
  }
  if (column != null) {
    final MenuItem renameColumn=new MenuItem(menu,SWT.PUSH);
    Messages.setLanguageText(renameColumn,"String_Node_Str");
    renameColumn.addListener(SWT.Selection,new Listener(){
      @Override public void handleEvent(      Event e){
        SimpleTextEntryWindow entryWindow=new SimpleTextEntryWindow("String_Node_Str","String_Node_Str");
        String existing_name=column.getNameOverride();
        if (existing_name == null) {
          existing_name="String_Node_Str";
        }
        entryWindow.setPreenteredText(existing_name,false);
        entryWindow.selectPreenteredText(true);
        entryWindow.prompt(new UIInputReceiverListener(){
          @Override public void UIInputReceiverClosed(          UIInputReceiver entryWindow){
            if (!entryWindow.hasSubmittedInput()) {
              return;
            }
            String name=entryWindow.getSubmittedInput().trim();
            if (name.length() == 0) {
              name=null;
            }
            column.setNameOverride(name);
            TableColumnManager tcm=TableColumnManager.getInstance();
            String tableID=tv.getTableID();
            tcm.saveTableColumns(tv.getDataSourceType(),tableID);
            TableStructureEventDispatcher.getInstance(tableID).tableStructureChanged(true,null);
          }
        }
);
      }
    }
);
    final MenuItem itemPrefSize=new MenuItem(menu,SWT.PUSH);
    Messages.setLanguageText(itemPrefSize,"String_Node_Str");
    itemPrefSize.addListener(SWT.Selection,new Listener(){
      @Override public void handleEvent(      Event e){
        Utils.execSWTThread(new Runnable(){
          @Override public void run(){
            column.setPreferredWidth(-1);
            tv.runForAllRows(new TableGroupRowRunner(){
              @Override public void run(              TableRowCore row){
                row.fakeRedraw(column.getName());
              }
            }
);
            int pref=column.getPreferredWidth();
            if (pref != -1) {
              column.setWidth(pref);
            }
          }
        }
);
      }
    }
);
  }
  final MenuItem itemResetColumns=new MenuItem(menu,SWT.PUSH);
  Messages.setLanguageText(itemResetColumns,"String_Node_Str");
  itemResetColumns.addListener(SWT.Selection,new Listener(){
    @Override public void handleEvent(    Event e){
      String tableID=tv.getTableID();
      TableColumnManager tcm=TableColumnManager.getInstance();
      tcm.resetColumns(tv.getDataSourceType(),tableID);
    }
  }
);
  final MenuItem itemChangeTable=new MenuItem(menu,SWT.PUSH);
  Messages.setLanguageText(itemChangeTable,"String_Node_Str");
  Utils.setMenuItemImage(itemChangeTable,"String_Node_Str");
  itemChangeTable.addListener(SWT.Selection,new Listener(){
    @Override public void handleEvent(    Event e){
      showColumnEditor();
    }
  }
);
  menu.setData("String_Node_Str",column);
  if (column == null) {
    return;
  }
  String sColumnName=column.getName();
  if (sColumnName != null) {
    Object[] listeners=listenersMenuFill.toArray();
    for (int i=0; i < listeners.length; i++) {
      TableViewSWTMenuFillListener l=(TableViewSWTMenuFillListener)listeners[i];
      l.addThisColumnSubMenu(sColumnName,menu);
    }
  }
  final MenuItem at_item=new MenuItem(menu,SWT.CHECK);
  Messages.setLanguageText(at_item,"String_Node_Str");
  at_item.addListener(SWT.Selection,new Listener(){
    @Override public void handleEvent(    Event e){
      TableColumnCore tcc=(TableColumnCore)menu.getData("String_Node_Str");
      tcc.setAutoTooltip(at_item.getSelection());
      tcc.invalidateCells();
    }
  }
);
  at_item.setSelection(column.doesAutoTooltip());
  TableContextMenuItem[] items=column.getContextMenuItems(TableColumnCore.MENU_STYLE_HEADER);
  if (items.length > 0) {
    new MenuItem(menu,SWT.SEPARATOR);
    MenuBuildUtils.addPluginMenuItems(items,menu,true,true,new MenuBuildUtils.MenuItemPluginMenuControllerImpl(tv.getSelectedDataSources(true)));
  }
}