Bug 572039

Summary: [MinMaxAddon] NPE on part stack minimize
Product: [Eclipse Project] Platform Reporter: Christoph Laeubrich <laeubi>
Component: UIAssignee: Platform-UI-Inbox <Platform-UI-Inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: loskutov, rolf.theunissen
Version: 4.20Keywords: needinfo
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Christoph Laeubrich CLA 2021-03-17 12:38:01 EDT
I have a partstack that is included via a placeholder. When one tries to minimize the part a NPE is thrown:

Caused by: java.lang.NullPointerException
	at org.eclipse.e4.ui.workbench.addons.minmax.MinMaxAddon.minimize(MinMaxAddon.java:670)
	at org.eclipse.e4.ui.workbench.addons.minmax.MinMaxAddon.subscribeTopicTagsChanged(MinMaxAddon.java:405)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:58)
	... 45 more
Comment 1 Christoph Laeubrich CLA 2021-03-17 12:44:30 EDT
Pressing the "maximize" button throws:

Caused by: java.lang.IllegalArgumentException: 
	at org.eclipse.core.runtime.Assert.isLegal(Assert.java:66)
	at org.eclipse.core.runtime.Assert.isLegal(Assert.java:50)
	at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.findElementsRecursive(ModelServiceImpl.java:175)
	at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.findElements(ModelServiceImpl.java:437)
	at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.findElements(ModelServiceImpl.java:430)
	at org.eclipse.e4.ui.workbench.addons.minmax.MinMaxAddon.findValidElementsToMinimize(MinMaxAddon.java:854)
	at org.eclipse.e4.ui.workbench.addons.minmax.MinMaxAddon.getElementsToMinimize(MinMaxAddon.java:797)
	at org.eclipse.e4.ui.workbench.addons.minmax.MinMaxAddon.maximize(MinMaxAddon.java:733)
	at org.eclipse.e4.ui.workbench.addons.minmax.MinMaxAddon.subscribeTopicTagsChanged(MinMaxAddon.java:407)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:58)
	... 45 more
Comment 2 Andrey Loskutov CLA 2021-03-17 13:00:33 EDT
Is this a regression in 4.20? Can you attach the code to reproduce?
Comment 3 Rolf Theunissen CLA 2021-03-19 08:58:12 EDT
This is the first time that I hear that a partstack is actually included with a placeholder, so far I only seen it used for MArea and MPart. I expect that this use-case is not well tested and could contain more bug.
In this case, MinMaxAddonUtil.getWindowFor(element) incorrectly returns null for partstack (or for any shared element).

The assumption documented in the code is incorrect:
 // We rely here on the fact that a DW's 'getParent' will return
 // null since it's not in the 'children' hierarchy

For a to be defined method on EModelService see Bug 562916.


The addition of unit tests for these cases would be highly valued.
Comment 4 Christoph Laeubrich CLA 2021-03-19 09:11:54 EDT
@Andrey

I don't think this is a regression, so no worries.

@Rolf 
I think you are right that this is very "unusual" I'm currently experimenting a bit with an E4 Application that allows to be extended by plugins beyond the usual eclipse way.

I first tried to use an MArea for that but that don't worked at all (the area was always empty, probably another uncovered area) and currently using a PartSash (what works but lacks the MinMax of course).