Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 312676

Summary: [Compatibility] Editor parent context is the window instead of the perspective
Product: [Eclipse Project] e4 Reporter: Remy Suen <remy.suen>
Component: UIAssignee: Project Inbox <e4.ui-inbox>
Status: RESOLVED WORKSFORME QA Contact:
Severity: major    
Priority: P3    
Version: 1.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Remy Suen CLA 2010-05-12 13:54:20 EDT
1. Put a breakpoint in PartServiceImpl's activate(MPart) method.
2. Start your inner.
3. Click the 'Package Explorer' to activate it.
4. Context menu > New > Untitled Text File
5. The editor's parent context is the window. :(
Comment 1 Remy Suen CLA 2010-05-12 13:57:35 EDT
We get the window's context here. It seems there is a problem with the renderer here.

Thread [main] (Suspended (breakpoint at line 266 in EclipseContext))	
	EclipseContext.<init>(IEclipseContext, ILookupStrategy) line: 266	
	EclipseContext.createChild() line: 739	
	EclipseContext.createChild(String) line: 743	
	PartRenderingEngine.createGui(MUIElement, Object) line: 286	
	PartRenderingEngine.createGui(MUIElement) line: 407	
	StackRenderer.showTab(MUIElement) line: 457	
	LazyStackRenderer$1.handleEvent(Event) line: 66	
	UIEventHandler.handleEvent(Event) line: 41	
	EventHandlerWrapper.handleEvent(Event, Permission) line: 188	
	EventHandlerTracker.dispatchEvent(Object, Object, int, Object) line: 198	
	EventManager.dispatchEvent(Set, EventDispatcher, int, Object) line: 227	
	ListenerQueue.dispatchEventSynchronous(int, Object) line: 149	
	EventAdminImpl.dispatchEvent(Event, boolean) line: 139	
	EventAdminImpl.sendEvent(Event) line: 78	
	EventComponent.sendEvent(Event) line: 39	
	EventBroker.send(String, Object) line: 76	
	UIEventPublisher.notifyChanged(Notification) line: 58	
	PartStackImpl(BasicNotifierImpl).eNotify(Notification) line: 380	
	PartStackImpl(ElementContainerImpl<T>).setSelectedElement(T) line: 165	
	PartServiceImpl.internalBringToTop(MPart) line: 227	
	PartServiceImpl.bringToTop(MPart) line: 219	
	PartServiceImpl.showPart(EPartService$PartState, MPart, MPart) line: 472	
	PartServiceImpl.showPart(MPart, EPartService$PartState) line: 509	
	WorkbenchPage.busyOpenEditor(IEditorInput, String, boolean, int, IMemento) line: 1829	
	WorkbenchPage.access$9(WorkbenchPage, IEditorInput, String, boolean, int, IMemento) line: 1796	
	WorkbenchPage$5.run() line: 1778	
	BusyIndicator.showWhile(Display, Runnable) line: 70	
	WorkbenchPage.openEditor(IEditorInput, String, boolean, int, IMemento) line: 1774	
	WorkbenchPage.openEditor(IEditorInput, String, boolean, int) line: 1758	
	WorkbenchPage.openEditor(IEditorInput, String) line: 1741	
	UntitledTextFileWizard.performFinish() line: 80
Comment 2 Remy Suen CLA 2010-05-12 14:00:07 EDT
PartRenderingEngine's getContext(MElementContainer<MUIElement>) method is bad.

When we have a PartSashContainer (the "editor area"), we invoke eContainer() which gives us the window. What we want is the perspective here.
Comment 3 Remy Suen CLA 2010-05-14 16:14:00 EDT
Note that this is still broken as of the latest code delivered today for bug 284610.
Comment 4 Eric Moffatt CLA 2010-05-17 15:00:46 EDT
Almost certainly the result of the LSR's 'showElementRecursive' setting the 'phContext' to null after a single set. It should instead set a flag to null it once the current set of children has been processed. We're likely only re-parenting the context of the first editor rather than all of them.
Comment 5 Remy Suen CLA 2010-05-25 10:27:36 EDT
Fixed by changes to bug 284610.