Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 360708 - Simple e4 app requires "addons" or NPE results
Summary: Simple e4 app requires "addons" or NPE results
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.2   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-12 14:02 EDT by David Williams CLA
Modified: 2019-11-14 03:08 EST (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Williams CLA 2011-10-12 14:02:27 EDT
This issue has been raised before, such as 
in bug 332712 and bug 332701 and a few forum posts, such as 
http://www.eclipse.org/forums/index.php/m/701076/

I was trying to make my way through the "Lars Tutorial" at 
http://www.vogella.de/articles/EclipseE4/article.html

Due to there being no M2 build, I ended up using M1. 

The first "wizard app" worked fine, but the "from scratch" e4 app did not run, since, it turns out, there were missing addOns. Trying to run it, resulted in
 
java.lang.NullPointerException
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.processHierarchy(E4Workbench.java:198) ...


Through the helpful forum posts, I found I could add the 6 "default addOns" and it'd work. 

Through trial and error, and found I only needed one, for it work, namely

  <addons xmi:id="_qmAY9PQVEeC_Bv5sFtucTQ" elementId="org.eclipse.e4.core.commands.service" contributionURI="platform:/plugin/org.eclipse.e4.core.commands/org.eclipse.e4.core.commands.CommandServiceAddon"/>
 
Obviously, the tutorial could be "fixed" to mention the addOns needed, but ... I'm opening this bug since a) its unclear why I'd need one at all and in particular this one for the CommandService and b) seems a NPE should never happen ... either a default should be assumed or at least a better error message given (such as "a required service was not found", or something). 
 
So, let me know (or close as "wontfix") if this has already been discussed and considered just too fringe of a case since it is such a trivial app, or there are good reasons to not assume a default, or if already fixed and I just have an old M1 build :) but seems NPEs should be avoided whenever possible.
Comment 1 Remy Suen CLA 2011-10-14 13:42:14 EDT
You're certainly right, David. The fact that these "add ons" are actually requirements and not optional have certainly caused our users a lot of grief.
Comment 2 Thomas Schindl CLA 2011-10-14 14:01:09 EDT
You might be interested by the e4-dev thread [1] where I made suggestions how those "required" addons could be handled if the plugin that depends on it simply contributes a ModelProcessor.

http://dev.eclipse.org/mhonarc/lists/e4-dev/msg04163.html
Comment 3 Paul Webster CLA 2011-10-14 14:44:16 EDT
We also have another bug open about this (it escapes me at the moment).

The reason it is like this currently (as annoying as it is) is to avoid the org.eclipse.ui.ide problem.  Right now any RCP app that pulls in ui.ide just because they would like some of the resource support classes gets a lot of things registered that they cannot undo.

If we make them specify the addons, they can order them, customize them, etc, fixing a *long* standing complaint with our 3.x RCP story. But as you've noticed, it doesn't help the simple case.

PW
Comment 4 David Williams CLA 2011-10-16 23:33:23 EDT
I don't know enough about it to comment on what's the "best" solution (or Tom's post referenced in comment #2) but my main concern was just throwing a NullPointerException if a "handler" is not there. Seems framework code should never (or, seldom) throw an NPE ... would be better to have some moderately descriptive message, such as "a required service was not found, indicating an issue with setup or installation of 'addOns'" (or, something better). An NPE makes the code look buggy and/or gives newbies like me a lot of doubt if I'm missing something essential in my dev. environment.
Comment 5 Paul Webster CLA 2011-11-02 13:24:57 EDT
See bug 357652 as well for a discussion on who creates what parts of the model when.

But it's possible we need to provide some sort of hook somewhere:

1) if the addOns are available, do nothing
2) if these required addOns are not there, add them to the model in the default order we would specify.

PW
Comment 6 Lars Vogel CLA 2019-11-14 03:08:01 EST
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.

If the bug is still relevant, please remove the "stalebug" whiteboard tag.