Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 328078 - DND code should unset parent's 'selectedElement' feature if the element is being dragged away
Summary: DND code should unset parent's 'selectedElement' feature if the element is be...
Status: RESOLVED WORKSFORME
Alias: None
Product: e4
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 1.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-18 17:00 EDT by Remy Suen CLA
Modified: 2019-09-02 15:02 EDT (History)
0 users

See Also:


Attachments
EPartService patch v1 (5.21 KB, patch)
2010-10-18 21:39 EDT, Remy Suen CLA
no flags Details | Diff
EPartService patch v2 (6.00 KB, patch)
2010-10-19 08:23 EDT, Remy Suen CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Remy Suen CLA 2010-10-18 17:00:50 EDT
1. Open a file.
2. Make it dirty.
3. Drag the editor outside the shared area into another stack.
4. Window > Open Perspective > Debug
5. Right-click on the 'Java' perspective > Close
6. When promped, click 'No'.
7. Open the same file.

Caused by: java.lang.NullPointerException
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.getParentWithContext(PartServiceImpl.java:227)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.internalFixContext(PartServiceImpl.java:275)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.bringToTop(PartServiceImpl.java:251)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.showPart(PartServiceImpl.java:774)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.showPart(PartServiceImpl.java:827)
	at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2210)
	at org.eclipse.ui.internal.WorkbenchPage.access$14(WorkbenchPage.java:2177)
	at org.eclipse.ui.internal.WorkbenchPage$6.run(WorkbenchPage.java:2159)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2155)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2139)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2130)
	at org.eclipse.ui.ide.IDE.openEditor(IDE.java:651)
	at org.eclipse.ui.ide.IDE.openEditor(IDE.java:610)
	at org.eclipse.ui.internal.ide.handlers.OpenResourceHandler.execute(OpenResourceHandler.java:129)
	at org.eclipse.ui.internal.ide.handlers.OpenResourceHandler.run(OpenResourceHandler.java:181)
	at org.eclipse.ui.internal.handlers.ActionDelegateHandlerProxy.execute(ActionDelegateHandlerProxy.java:289)
Comment 1 Remy Suen CLA 2010-10-18 17:05:05 EDT
When the DND operation was performed in step 3, the part stack in the editor area does not appear to have set its selected element to null.
Comment 2 Remy Suen CLA 2010-10-18 21:39:50 EDT
Created attachment 181142 [details]
EPartService patch v1

Shortened steps as follows:
1. Open a file.
2. Drag the editor outside the shared area into another stack.
3. Window > Open Perspective > Debug
4. Right-click on the 'Java' perspective > Close
5. Open the same file.

The patch resolves the problem in the EPartService implementation to handle a container's selected element not being one of its children. However, there is of course still the problem in the DND code in that it leaves the model in an inconsistent state.
Comment 3 Remy Suen CLA 2010-10-19 08:23:53 EDT
Created attachment 181175 [details]
EPartService patch v2

Added some comments to the code.
Comment 4 Remy Suen CLA 2010-10-19 08:26:58 EDT
Shortened steps as follows:
1. Open a file.
2. Drag the editor outside the shared area into another stack.
3. Close it.
4. Open another file.

(In reply to comment #3)
> Created an attachment (id=181175) [details]
> EPartService patch v2

Patch released to HEAD. The DND code still needs to be changed though. However, since the fix in the EPS has been delivered, the problem will no longer be reproducible.
Comment 5 Remy Suen CLA 2010-11-02 10:53:25 EDT
(In reply to comment #4)
> The DND code still needs to be changed though.

The code auto-corrects itself now due to the changes from bug 328499 though it still kind of feels to me as though the DND code should be compensating for this itself instead of letting the rendering engine handle it.

Thread [main] (Suspended (breakpoint at line 157 in ElementContainerImpl))	
	PartStackImpl(ElementContainerImpl<T>).setSelectedElement(T) line: 157	
	PartRenderingEngine$4.handleEvent(Event) line: 263	
	UIEventHandler.handleEvent(Event) line: 41	
	EventHandlerWrapper.handleEvent(Event, Permission) line: 197	
	EventHandlerTracker.dispatchEvent(EventHandlerWrapper, Permission, int, Event) line: 197	
	EventHandlerTracker.dispatchEvent(Object, Object, int, Object) line: 1	
	EventManager.dispatchEvent(Set<Entry<K,V>>, EventDispatcher<K,V,E>, int, E) line: 230	
	ListenerQueue<K,V,E>.dispatchEventSynchronous(int, E) line: 148	
	EventAdminImpl.dispatchEvent(Event, boolean) line: 135	
	EventAdminImpl.sendEvent(Event) line: 78	
	EventComponent.sendEvent(Event) line: 39	
	EventBroker.send(String, Object) line: 73	
	UIEventPublisher.notifyChanged(Notification) line: 58	
	PartStackImpl(BasicNotifierImpl).eNotify(Notification) line: 380	
	ENotificationImpl(NotificationImpl).dispatch() line: 1033	
	ENotificationImpl(NotificationImpl).dispatch() line: 1038	
	ElementContainerImpl$1(NotifyingListImpl<E>).remove(int) line: 724	
	ElementContainerImpl$1(AbstractEList<E>).remove(Object) line: 466	
	StackDropAgent.drop(MUIElement, CursorInfo) line: 119	
	DnDManager.startDrag(CursorInfo) line: 201	
	DnDManager$3.handleEvent(Event) line: 112
Comment 6 Eclipse Genie CLA 2019-05-30 00:13:24 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 7 Lars Vogel CLA 2019-09-02 15:02:08 EDT
This bug was marked as stalebug a while ago. Marking as worksforme.

If this report is still relevant for the current release, please reopen and remove the stalebug whiteboard tag.