Buggy code:
public class CustomizePerspectiveDialog extends TrayDialog { private Perspective perspective ; WorkbenchWindow window ; private TabFolder tabFolder ; private CheckboxTableViewer actionSetsViewer ; private TreeViewer actionSetMenuViewer ; private TreeViewer actionSetToolbarViewer ; private Combo menusCombo ; private CheckboxTreeViewer menuCategoriesViewer ; private CheckboxTableViewer menuItemsViewer ; private static int lastSelectedTab = - 1 ; private static int lastSelectedMenuIndex = 0 ; private static String lastSelectedActionSetId = null ; private static int cursorSize = 15 ; private static final int TAB_WIDTH_IN_DLUS = 490 ; private static final int TAB_HEIGHT_IN_DLUS = 230 ; private final String [ ] shortcutMenuColumnHeaders = new String [ ] { WorkbenchMessages . ActionSetSelection_menuColumnHeader , WorkbenchMessages . ActionSetSelection_descriptionColumnHeader } ; private int [ ] shortcutMenuColumnWidths = new int [ ] { 125 , 300 } ; private ActionSetDescriptor selectedActionSet = null ; private CustomizePerspectiveDialog . ShortcutMenu selectedMenuCategory = null ; ImageDescriptor menuImageDescriptor = null ; ImageDescriptor submenuImageDescriptor = null ; ImageDescriptor toolbarImageDescriptor = null ; CustomizePerspectiveDialog . ShortcutMenu rootMenu ; private ArrayList actionSets = new ArrayList ( ) ; private Hashtable actionSetStructures = new Hashtable ( ) ; private IWorkbenchWindowConfigurer configurer ; private List initiallyActive = new ArrayList ( ) ; class ActionSetDisplayItem extends Object { ArrayList children = new ArrayList ( ) ; CustomizePerspectiveDialog . ActionSetDisplayItem parent = null ; private String id = null ; private String text = "" ; String description = "" ; ImageDescriptor imageDescriptor ; int type = CustomizePerspectiveDialog . ActionSetDisplayItem . MENUITEM ; private static final int MENUITEM = 0 ; private static final int TOOLITEM = 1 ; private ActionSetDisplayItem ( ) { } ActionSetDisplayItem ( String id ) { } private ActionSetDisplayItem ( CustomizePerspectiveDialog . ActionSetDisplayItem parent , String id , String text , int type ) { } private CustomizePerspectiveDialog . ActionSetDisplayItem find ( String itemId ) { } public void fillMenusFor ( String actionSetId , IContributionItem item ) { } public void fillToolsFor ( String actionSetId , CoolBarManager mgr ) { } int getDepth ( ) { } String getDisplayText ( ) { } protected boolean isTopLevelMenu ( ) { } public String toString ( ) { } } public class CustomizeActionBars implements IActionBars2 , IActionBarConfigurer { IWorkbenchWindowConfigurer configurer ; MenuManager menuManager = new MenuManager ( ) ; CoolBarManager coolBarManager = new CoolBarManager ( ) ; StatusLineManager statusLineManager = new StatusLineManager ( ) ; public CustomizeActionBars ( IWorkbenchWindowConfigurer configurer ) { } public IWorkbenchWindowConfigurer getWindowConfigurer ( ) { } public IMenuManager getMenuManager ( ) { } public IStatusLineManager getStatusLineManager ( ) { } public ICoolBarManager getCoolBarManager ( ) { } public IToolBarManager getToolBarManager ( ) { } public void setGlobalActionHandler ( String actionID , IAction handler ) { } public void updateActionBars ( ) { } public void clearGlobalActionHandlers ( ) { } public IAction getGlobalActionHandler ( String actionId ) { } public void registerGlobalAction ( IAction action ) { } public void dispose ( ) { } public final IServiceLocator getServiceLocator ( ) { } <START_BUG> public IContributionItem createToolBarContributionItem ( IToolBarManager toolBarManager , String id ) { <END_BUG> return new org . eclipse . jface . action . ToolBarContributionItem ( toolBarManager , id ) ; } public IToolBarManager createToolBarManager ( ) { } } class ShortcutMenuItemContentProvider implements IStructuredContentProvider { ShortcutMenuItemContentProvider ( ) { } public Object [ ] getElements ( Object input ) { } public void inputChanged ( Viewer viewer , Object oldInput , Object newInput ) { } public void dispose ( ) { } } class ShortcutMenuItemLabelProvider extends LabelProvider implements ITableLabelProvider { private Map imageTable = new Hashtable ( ) ; private static final int COLUMN_ID = 0 ; private static final int COLUMN_DESCRIPTION = 1 ; ShortcutMenuItemLabelProvider ( ) { } public final void dispose ( ) { } public Image getColumnImage ( Object element , int index ) { } public String getColumnText ( Object element , int columnIndex ) { } public String getText ( Object element ) { } } class ShortcutMenu extends Object { private static final String ID_VIEW = "org.eclipse.ui.views" ; private static final String ID_WIZARD = "org.eclipse.ui.wizards" ; private static final String ID_PERSP = "org.eclipse.ui.perspectives" ; String id ; String label ; private ArrayList items = new ArrayList ( ) ; private ArrayList checkedItems = new ArrayList ( ) ; ArrayList children = new ArrayList ( ) ; CustomizePerspectiveDialog . ShortcutMenu parent = null ; ShortcutMenu ( CustomizePerspectiveDialog . ShortcutMenu parent , String id , String label ) { } void addItem ( Object item ) { } void addCheckedItem ( Object item ) { } public String toString ( ) { } ArrayList getCheckedItems ( ) { } ArrayList getCheckedItemIds ( ) { } ArrayList getChildren ( ) { } ArrayList getItems ( ) { } private String getMenuId ( ) { } ArrayList getSubtreeItems ( ) { } Object getItem ( String menuItemId ) { } boolean isFullyChecked ( ) { } boolean isFullyUnchecked ( ) { } void removeCheckedItem ( Object item ) { } void checked ( boolean checked ) { } } class TreeContentProvider implements ITreeContentProvider { public void dispose ( ) { } public Object [ ] getChildren ( Object element ) { } public Object [ ] getElements ( Object element ) { } public Object getParent ( Object element ) { } public boolean hasChildren ( Object element ) { } public void inputChanged ( Viewer viewer , Object oldInput , Object newInput ) { } } class ActionSetLabelProvider extends LabelProvider { private Map imageTable = new Hashtable ( ) ; public void dispose ( ) { } public Image getImage ( Object element ) { } public String getText ( Object element ) { } } public CustomizePerspectiveDialog ( IWorkbenchWindowConfigurer configurer , Perspective persp ) { } private void addActionSetsListeners ( ) { } private void addShortcutListeners ( ) { } private void buildMenusAndToolbarsFor ( CustomizePerspectiveDialog . CustomizeActionBars customizeActionBars , ActionSetDescriptor actionSetDesc ) { } private void checkInitialActionSetSelections ( ) { } private void checkInitialMenuCategorySelections ( CustomizePerspectiveDialog . ShortcutMenu menu ) { } public boolean close ( ) { }

Fix:
public IToolBarContributionItem createToolBarContributionItem ( IToolBarManager toolBarManager , String id ) {