Community
Participate
Working Groups
When calling ActionFactory.INTRO.create(window) the IntroAction constructor causes a NullPointerException when there is no product intro binding set. The line IntroDescriptor introDescriptor = ((Workbench) workbenchWindow.getWorkbench()).getIntroDescriptor(); returns null. Subsequent calls using this null descriptor result in NullPointerExceptions. Interestingly the workbench dies silently and only starting the application using the -console parameter reveals this NPE on the console. No logfile is written.
Created attachment 106317 [details] Patch to check against a null introDescriptor in ctor
Please allow me to add a two-line stacktrace so that others are able to find this bug by method calls. Exception in thread "Thread-1" java.lang.NullPointerException at org.eclipse.ui.internal.IntroAction.<init>(IntroAction.java:60) at org.eclipse.ui.actions.ActionFactory$11.create(ActionFactory.java:338)
I just got this on my computer. :/
There is no point in creating an Intro action if there is no intro part (it pops up an error dialog and has other methods that will fail). We use code like this in IDE: if (window.getWorkbench().getIntroManager().hasIntro()) { introAction = ActionFactory.INTRO.create(window); register(introAction); } I can either do nothing or update the ActionFactory.INTRO javadoc to point out that you shouldn't create this action if there is no intro (with sample code as above). PW
ok, what about the declerative IntroAction (command) if such even exist. In my app I am not using Actions directly anymore, just the "new" menu contribution extension to create my menus. If there is no intro command than your code would indeed be the way (and the updated Java doc) to handle this bug.
So do the conversion to commands and handlers? That certainly sounds do-able, but it would be in M5 PW
(In reply to comment #6) > So do the conversion to commands and handlers? Are you planning to add a visibleWhen with a property tester for testing whether hasIntro() returns true or false?
I've added the snippet to the javadoc, and I'll consider if I can do the command stuff. PW
I currently use: pre. try { register(ActionFactory.INTRO.create(window)); } catch (final Exception e) { } Should we close this bug now, or will there be a fix inside the action itself?
This is the suggested code: if (window.getWorkbench().getIntroManager().hasIntro()) { introAction = ActionFactory.INTRO.create(window); register(introAction); } and is now in the javadoc. I had left this open to consider if this should be changed to a command/handler. PW
*** Bug 295941 has been marked as a duplicate of this bug. ***
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. -- The automated Eclipse Genie.