Buggy code:
public abstract class PartSite implements IWorkbenchPartSite { public static final void registerContextMenu ( final String menuId , final MenuManager menuManager , final ISelectionProvider selectionProvider , final boolean includeEditorInput , final IWorkbenchPart part , final Collection menuExtenders ) { final Iterator extenderItr = menuExtenders . iterator ( ) ; boolean foundMatch = false ; while ( extenderItr . hasNext ( ) ) { final PopupMenuExtender existingExtender = ( ( PopupMenuExtender ) ( extenderItr . next ( ) ) ) ; if ( existingExtender . matches ( menuManager , selectionProvider , part ) ) { existingExtender . addMenuId ( menuId ) ; foundMatch = true ; break ; } } if ( ! foundMatch ) { menuExtenders . add ( new PopupMenuExtender ( menuId , menuManager , selectionProvider , part , includeEditorInput ) ) ; } final IMenuService menuService = ( ( IMenuService ) ( part . getSite ( ) . getService ( IMenuService . class ) ) ) ; <START_BUG> final MenuLocationURI loc = new MenuLocationURI ( ( "popup:////" + menuId ) ) ; <END_BUG> if ( menuManager . getRemoveAllWhenShown ( ) ) { menuManager . addMenuListener ( new IMenuListener ( ) { public void menuAboutToShow ( IMenuManager manager ) { menuService . populateMenu ( menuManager , loc ) ; } } ) ; } else { menuService . populateMenu ( menuManager , loc ) ; } } private IWorkbenchPartReference partReference ; private IWorkbenchPart part ; private IWorkbenchPage page ; private String extensionID ; private String pluginID ; private String extensionName ; private ISelectionProvider selectionProvider ; private SubActionBars actionBars ; private KeyBindingService keyBindingService ; protected ArrayList menuExtenders ; private WorkbenchSiteProgressService progressService ; protected final ServiceLocator serviceLocator ; public PartSite ( IWorkbenchPartReference ref , IWorkbenchPart part , IWorkbenchPage page ) { } private void initializeDefaultServices ( ) { } public void dispose ( ) { } public IActionBars getActionBars ( ) { } public String getId ( ) { } public IWorkbenchPage getPage ( ) { } public PartPane getPane ( ) { } public IWorkbenchPart getPart ( ) { } public IWorkbenchPartReference getPartReference ( ) { } public String getPluginId ( ) { } public String getRegisteredName ( ) { } public ISelectionProvider getSelectionProvider ( ) { } public Shell getShell ( ) { } public IWorkbenchWindow getWorkbenchWindow ( ) { } public void registerContextMenu ( String menuID , MenuManager menuMgr , ISelectionProvider selProvider ) { } public void registerContextMenu ( MenuManager menuMgr , ISelectionProvider selProvider ) { } public String [ ] getContextMenuIds ( ) { } public void setActionBars ( SubActionBars bars ) { } public void setConfigurationElement ( IConfigurationElement configElement ) { } protected void setPluginId ( String pluginId ) { } protected void setId ( String id ) { } public void setPart ( IWorkbenchPart newPart ) { } protected void setRegisteredName ( String name ) { } public void setSelectionProvider ( ISelectionProvider provider ) { } public IKeyBindingService getKeyBindingService ( ) { } protected String getInitialScopeId ( ) { } public final Object getAdapter ( Class adapter ) { } public void activateActionBars ( boolean forceVisibility ) { } public void deactivateActionBars ( boolean forceHide ) { } private WorkbenchSiteProgressService getSiteProgressService ( ) { } public final Object getService ( final Class key ) { } public final boolean hasService ( final Class key ) { } public String toString ( ) { } }

Fix:
final MenuLocationURI loc = new MenuLocationURI ( ( "popup:" + menuId ) ) ;