Bug 90415 [Contributions] NPE in ActionContributionItem.update when trying to set accelerator in menu
Exception in thread "main" java.lang.NullPointerException at org.eclipse.jface.action.ActionContributionItem.update(ActionContributionItem.java:749) at org.eclipse.jface.action.ActionContributionItem.fill(ActionContributionItem.java:281) at org.eclipse.jface.action.MenuManager.update(MenuManager.java:627) at org.eclipse.jface.action.MenuManager.update(MenuManager.java:549) at org.eclipse.jface.action.MenuManager.createMenuBar(MenuManager.java:158) at org.eclipse.jface.window.ApplicationWindow.createTrimWidgets(ApplicationWindow.java:332) at org.eclipse.jface.window.ApplicationWindow.configureShell(ApplicationWindow.java:320) at org.eclipse.jface.window.Window.createShell(Window.java:483) at org.eclipse.jface.window.Window.create(Window.java:417) at org.eclipse.jface.window.Window.open(Window.java:770) at MenuActionTest.main(MenuActionTest.java:76)
bundles/org.eclipse.jface/src/org/eclipse/jface/action/ActionContributionItem.java
* <code>IContributionItem</code> method creates an SWT <code>ToolItem</code>
     * for the action using the action's style. If the action's checked property has
     * been set, a button is created and primed to the value of the checked
     * property. If the action's menu creator property has been set, a drop-down
     * tool item is created.
     */
    public void fill(ToolBar parent, int index) {
        if (widget == null && parent != null) {
            int flags = SWT.PUSH;
            if (action != null) {
                int style = action.getStyle();
                if (style == IAction.AS_CHECK_BOX)
                    flags = SWT.CHECK;
                else if (style == IAction.AS_RADIO_BUTTON)
                    flags = SWT.RADIO;
                else if (style == IAction.AS_DROP_DOWN_MENU)
                    flags = SWT.DROP_DOWN;
            }
            ToolItem ti = null;
            if (index >= 0)
                ti = new ToolItem(parent, flags, index);
            else
                ti = new ToolItem(parent, flags);
            ti.setData(this);
            ti.addListener(SWT.Selection, getToolItemListener());
            ti.addListener(SWT.Dispose, getToolItemListener());
            widget = ti;
            update(null);
            
            action.addPropertyChangeListener(propertyListener);