Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 161374

Summary: [ActionSets] NullPointerException in EditActionSets Action
Product: [Eclipse Project] Platform Reporter: Ingo Kroh <ingo.kroh>
Component: UIAssignee: Tim Mok <timothym>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: digga1404, pwebster
Version: 3.2.1Keywords: helpwanted
Target Milestone: 3.4   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Ingo Kroh CLA 2006-10-18 04:48:46 EDT
I have problems while developing a RCP application. I get a NullPointerException in the EditActionSets Action if I want to change the visibility of an actionset. The problem only occurs if I want to add the action to a toolbar defined in the ActionBarAdvisor. If I use an identifier not defined in the ActionBarAdvisor the action appears in a separate toolbar and no exception is thrown. You can reproduce this with the following code:

Add the EditActionSets Action to the menu and define a toolbar in the ActionBarAdvisor like this:

makeActions(IWorkbenchWindow window) {

   editActionSetsAction = ActionFactory.EDIT_ACTION_SETS.create(window);
   register(editActionSetsAction);
}

fillMenuBar(IMenuManager menuBar) {
   MenuManager windowMenu = new MenuManager("&Window", IWorkbenchActionConstants.M_WINDOW);
   windowMenu.add(editActionSetsAction);
   menuBar.add(windowMenu);
}
fillCoolBar(ICoolBarManager coolBar)
{
   IToolBarManager toolbar = new ToolBarManager(SWT.FLAT | SWT.RIGHT);
   toolbar.add(new GroupMarker(IWorkbenchActionConstants.OPEN_EXT));
   coolBar.add(new ToolBarContributionItem(toolbar, "standard"));
}

Add an action via the extension-point org.eclipse.ui.actionSets:

<actionSet
   id="OpenFilesActionSet"
   label="Open Files"
    visible="true">
   <action
      class="OpenAction"
      id="openAction"
      label="Open"
      style="push"
      toolbarPath="standard/open.ext"/>
</actionSet>

Then start the application and open the Edit Actionsets Dialog. Try to disable the OpenFilesActionSet. The following NullPointerException is thrown:

!ENTRY org.eclipse.jface 4 2 2006-10-18 10:44:00.156
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.jface".
!STACK 0
java.lang.NullPointerException
	at org.eclipse.ui.internal.dialogs.DialogUtil.removeAccel(DialogUtil.java:69)
	at org.eclipse.ui.internal.dialogs.CustomizePerspectiveDialog$ActionSetDisplayItem.<init>(CustomizePerspectiveDialog.java:214)
	at org.eclipse.ui.internal.dialogs.CustomizePerspectiveDialog$ActionSetDisplayItem.fillToolsFor(CustomizePerspectiveDialog.java:308)
	at org.eclipse.ui.internal.dialogs.CustomizePerspectiveDialog.handleActionSetSelected(CustomizePerspectiveDialog.java:1336)
	at org.eclipse.ui.internal.dialogs.CustomizePerspectiveDialog$2.selectionChanged(CustomizePerspectiveDialog.java:900)
	at org.eclipse.jface.viewers.Viewer$2.run(Viewer.java:162)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
	at org.eclipse.core.runtime.Platform.run(Platform.java:843)
	at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:44)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:149)
	at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:160)
	at org.eclipse.jface.viewers.StructuredViewer.updateSelection(StructuredViewer.java:1976)
	at org.eclipse.jface.viewers.StructuredViewer.handleSelect(StructuredViewer.java:1128)
	at org.eclipse.jface.viewers.CheckboxTableViewer.handleSelect(CheckboxTableViewer.java:269)
	at org.eclipse.jface.viewers.StructuredViewer$4.widgetSelected(StructuredViewer.java:1154)
	at org.eclipse.jface.util.OpenStrategy.fireSelectionEvent(OpenStrategy.java:213)
	at org.eclipse.jface.util.OpenStrategy.access$3(OpenStrategy.java:207)
	at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:374)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3348)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2968)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:820)
	at org.eclipse.jface.window.Window.open(Window.java:796)
	at org.eclipse.ui.internal.WorkbenchPage.editActionSets(WorkbenchPage.java:1693)
	at org.eclipse.ui.internal.EditActionSetsAction.run(EditActionSetsAction.java:49)
	at org.eclipse.ui.internal.PerspectiveAction.run(PerspectiveAction.java:70)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:499)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:539)
	at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488)
	at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:400)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3348)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2968)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1914)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:419)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at de.ingmbh.sphinx.editor.Application.run(Application.java:18)
	at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:324)
	at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
	at org.eclipse.core.launcher.Main.run(Main.java:977)
	at org.eclipse.core.launcher.Main.main(Main.java:952)

I'm not sure if this is a bug, but I posted it in the newsgroups and they said I should open a bug report.

Best regards,

Ingo
Comment 1 Dominik G. CLA 2006-11-27 04:32:01 EST
Is there any progress on this issue? I have the same problem.
Comment 2 Paul Webster CLA 2006-11-27 08:48:34 EST
This probably won't be looked at until after 3.3M5

PW
Comment 3 Tim Mok CLA 2007-10-17 13:45:01 EDT
I cannot reproduce the NPE with the given test case. When disabling the action set, no NPE is thrown and the action set is disabled as expected.
Comment 4 Tim Mok CLA 2007-11-14 13:44:15 EST
I'm marking this as WORKSFORME since I cannot reproduce the bug. This bug can be reopened if it's still a problem and can be reproduced.