Community
Participate
Working Groups
Created attachment 285613 [details] Test project that shows the issue When an E4 part in a mixed environment is instantiated multiple times (e.g. as an editor), null is returned for getActivePart on any other instance but the first. The E4PartWrapper logic is not initiated for multiple occurrences of the same part. Attached is a project where two instances of the same part are set up next to an E3 part. Each part contains a button that calls getActivePart and shows the result.
The root cause is that there is no secondary identifier set for parts created with the EModelService. That is, the MParts get all the same element identifier, it is not possible to distinguishes multiple instances of the descriptor. In the workbench, parts must have unique identifiers, otherwise view-references will not be created correctly: In WorkBench#createViewReference and WorkbenchPage#addViewReference, only the element identifier of the part is used. Therefore, there is no view reference created for the second instance of the E4part. Then in WorkbenchPage#getWorkbenchPart, there is no view reference for the second E4part. Although there was an active MPart, the corresponding IWorkbenchPart could not be found (it was never created).
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/176576