Bug 568439

Summary: ApplicationPartServiceImpl#findPart violates contract
Product: [Eclipse Project] Platform Reporter: Karsten Thoms <karsten.thoms>
Component: UIAssignee: Platform-UI-Inbox <Platform-UI-Inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3    
Version: 4.18   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X   
Whiteboard:

Description Karsten Thoms CLA 2020-11-02 06:35:11 EST
This issue has been reported before as bug#462610.

I am observing this issue now in my customer application. In this context a job is running on startup. As a result of the job tool items are updated. This seems to happen too early. 

java.lang.IllegalStateException: Application does not have an active window
	at org.eclipse.e4.ui.internal.workbench.ApplicationPartServiceImpl.getActiveWindowService(ApplicationPartServiceImpl.java:42)
	at org.eclipse.e4.ui.internal.workbench.ApplicationPartServiceImpl.findPart(ApplicationPartServiceImpl.java:103)
	at (CUSTOM CODE)
	at org.eclipse.core.runtime.jobs.Job$2.run(Job.java:185)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

This might not be valid to call findPart at this time, but it shows that the contract is still violated. As originally proposed in the bug I think the ISE should be catched and return null. It may be argued that this should be logged as a warning, as it is likely covering an implementation problem.
Comment 1 Karsten Thoms CLA 2020-11-02 06:42:40 EST
This potentially affects other methods implemented from EPartService also. The all access getActiveWindowService() and will throw an ISE when called.