Bug 93359 - [KeyBindings] assist: NPE in KeyBindingState
Summary: [KeyBindings] assist: NPE in KeyBindingState
Status: ASSIGNED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1   Edit
Hardware: All All
: P5 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-30 22:52 EDT by Sebastian Davids CLA
Modified: 2019-09-06 15:35 EDT (History)
0 users

See Also:


Attachments
fix (855 bytes, patch)
2005-05-01 00:33 EDT, Sebastian Davids CLA
no flags Details | Diff
fix 2 (934 bytes, patch)
2005-05-01 01:10 EDT, Sebastian Davids CLA
no flags Details | Diff
test case project (5.59 KB, application/octet-stream)
2005-05-02 12:04 EDT, Sebastian Davids CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastian Davids CLA 2005-04-30 22:52:43 EDT
Create a "Hello RCP" application.

Add

<extension
         point="org.eclipse.ui.actionSets">
      <actionSet
            label="KeyBindingActionSet"
            visible="true"
            id="org.eclipse.ui.actionSet.keyBindings">
         <action
               label="showKeyAssist"
               class="org.eclipse.ui.internal.handlers.ShowKeyAssistHandler"
               menubarPath="help/group.main"
               id="org.eclipse.ui.actions.showKeyAssistHandler"
               definitionId="org.eclipse.ui.window.showKeyAssist">
         </action>
      </actionSet>
   </extension>

to plugin.xml

Launch the application.

Press CTRL+SHIFT+L.

Observe the NPE.
Comment 1 Sebastian Davids CLA 2005-04-30 22:58:00 EDT
Actually you also have to change

ApplicationWorkbenchAdvisor#getInitialWindowPerspectiveId 

to return null which is allowed by the spec.
Comment 2 Sebastian Davids CLA 2005-05-01 00:33:20 EDT
Created attachment 20556 [details]
fix

Listeners should be informed of window activation even if no initial
perspective (page) is supplied.
Comment 3 Sebastian Davids CLA 2005-05-01 01:10:18 EDT
Created attachment 20557 [details]
fix 2

This fix 2 modifies WorkbenchKeyboard#windowListener to also listen on
windowOpened events.

The first fix modifies Workbench#busyOpenWorkbenchWindow to fire a
windowActivated event in case no initial perspective id is supplied.

I'm not intimately familiar with the inner workings of both classes therefore
I'm not able to decide which fix is the "better" one.

Both resolve the NPE though.
Comment 4 Douglas Pollock CLA 2005-05-02 10:13:01 EDT
Can you please attach the stack trace?
Comment 5 Sebastian Davids CLA 2005-05-02 12:02:26 EDT
!SESSION 2005-05-02 17:44:13.530 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.5.0_01
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=de_DE
Framework arguments:  -application test.application -pdelaunch
Command-line arguments:  -application test.application -data C:\Dokumente und
Einstellungen\Dawnfly\Desktop\eclipse-SDK-I20050426-1700-win32\runtime-EclipseApplication
-dev file:C:/Dokumente und
Einstellungen/Dawnfly/Desktop/eclipse-SDK-I20050426-1700-win32/workspace/.metadata/.plugins/org.eclipse.pde.core/Eclipse
Application/dev.properties -pdelaunch -os win32 -ws win32 -arch x86

!ENTRY org.eclipse.ui 4 4 2005-05-02 17:44:36.613
!MESSAGE Unhandled event loop exception

!ENTRY org.eclipse.ui 4 0 2005-05-02 17:44:36.623
!MESSAGE java.lang.NullPointerException
!STACK 0
java.lang.NullPointerException
	at
org.eclipse.ui.internal.keys.KeyAssistDialog.registerShellType(KeyAssistDialog.java:771)
	at
org.eclipse.ui.internal.keys.KeyAssistDialog.createContents(KeyAssistDialog.java:475)
	at org.eclipse.jface.window.Window.create(Window.java:418)
	at org.eclipse.jface.dialogs.Dialog.create(Dialog.java:996)
	at org.eclipse.ui.internal.keys.KeyAssistDialog.open(KeyAssistDialog.java:739)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.openMultiKeyAssistShell(WorkbenchKeyboard.java:682)
	at
org.eclipse.ui.internal.keys.BindingService.openKeyAssistDialog(BindingService.java:158)
	at
org.eclipse.ui.internal.handlers.ShowKeyAssistHandler.execute(ShowKeyAssistHandler.java:38)
	at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:151)
	at org.eclipse.core.commands.Command.execute(Command.java:312)
	at
org.eclipse.core.commands.ParameterizedCommand.execute(ParameterizedCommand.java:396)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:452)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:741)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:785)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:543)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:486)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:110)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
	at org.eclipse.swt.widgets.Display.filterEvent(Display.java:780)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:841)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:866)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:851)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:879)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:875)
	at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1182)
	at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:3125)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:3028)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:3492)
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1647)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2531)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1569)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1533)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:306)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)
	at test.Application.run(Application.java:12)
	at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:228)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:345)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:158)
	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:585)
	at org.eclipse.core.launcher.Main.invokeFramework(Main.java:319)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:272)
	at org.eclipse.core.launcher.Main.run(Main.java:951)
	at org.eclipse.core.launcher.Main.main(Main.java:935)

@@@@

keyBindingState.getAssociatedWindow() returns null.
Comment 6 Sebastian Davids CLA 2005-05-02 12:04:43 EDT
Created attachment 20597 [details]
test case project

launch app

press Ctrl+Shift+L
Comment 7 Sebastian Davids CLA 2005-05-02 12:09:08 EDT
Actually you can leave the action set out.

The only important thing is that
ApplicationWorkbenchAdvisor#getInitialWindowPerspectiveId returns null (which is
allowed by spec).
Comment 8 Michael Van Meekeren CLA 2006-04-21 13:14:12 EDT
Moving Dougs bugs
Comment 9 Paul Webster CLA 2006-09-28 15:14:43 EDT
Is this still a problem in 3.3?

PW
Comment 10 Denis Roy CLA 2007-06-22 09:32:53 EDT
Changes requested on bug 193523
Comment 11 Eclipse Webmaster CLA 2019-09-06 15:35:16 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.