Community
Participate
Working Groups
If i put two Handlers to a TrimmedWindow and use only of it (attribut commandId of one of the both handlers isn't used) i get following error: !ENTRY org.eclipse.e4.ui.workbench 4 0 2012-04-06 15:04:44.918 !MESSAGE Exception occurred while rendering: org.eclipse.e4.ui.model.application.ui.basic.impl.TrimmedWindowImpl@c1a0eb (elementId: null, tags: null, contributorURI: platform:/plugin/net.teufel.e4.helloworld.ui) (widget: null, renderer: null, toBeRendered: true, onTop: false, visible: true, containerData: null, accessibilityPhrase: null) (label: Hello world, iconURI: null, tooltip: null, context: TrimmedWindowImplContext, variables: [], x: -2147483648, y: -2147483648, width: 640, height: 480) !STACK 0 java.lang.NullPointerException at org.eclipse.e4.ui.internal.workbench.E4Workbench.processHierarchy(E4Workbench.java:164) What is the idea behind putting Handlers to Window or TrimmedWindow? To get a better structure? When does it makes sense to collect more than one item in a window? Each handler has to be conntected to a command, why am i only able to define commands inside of Application? At the moment I have to connect each Handler to a command otherwise i get the error above so its not possible to hold two times a similar handler in a TrimmedWindow and decide during runtime wich of the two handlers gets active finally and will be connected to the Toolbaritem.
The model describes the starting state of the system, and currently it is required to be valid. That means your handlers must handle a command. If you are trying to decide which handler to use for a command at runtime, in Eclipse4, you would use the EHandlerService to activate the specific handler, or you would remove the existing handler from the model and then add the new one. Commands are global semantic abstractions. They're on the application because it doesn't make sense to scope them lower that than. There's only one Exit command or one Copy command ... Exit probably only has one handler, and Copy has many handlers. The handlers can be defined at the appropriate level to avoid the complex activeWhen core expressions used in 3.x, simply to have handlers at the window or part level. That being said, it still shouldn't NPE. That must be fixed. PW
Created attachment 213826 [details] Patch avoiding the NPE Patch which avoids the NPE on starting of an application with a handler without a command.
Fix released: http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=e2428b00de59080a4c5ce0e982f62419e9adefd1 Thanx Sopot PW
by inspection in I20120430-1800 PW