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

Bug 532464

Summary: Opening a new window destroys/blocks tab dragging in first window
Product: [Eclipse Project] Platform Reporter: thomas menzel <dev.tom.menzel>
Component: UIAssignee: Andrey Loskutov <loskutov>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: P3 CC: 214535763, daniel_megert, loskutov
Version: 4.7   
Target Milestone: 4.11 RC1   
Hardware: All   
OS: All   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=498510
https://git.eclipse.org/r/137491
https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=af1739f0a419f059708841f6526b19d89e01bd59
Whiteboard:
Attachments:
Description Flags
shallow eclipse git repo with the analysis none

Description thomas menzel CLA 2018-03-14 17:04:00 EDT
Dual monitor setup

eclipse >= 4.7 <= 4.8m5
The following has been tested with 4.8m5 e.g. 
http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/photon/M5/eclipse-java-photon-M5-win32-x86_64.zip

1. Start eclipse on right display (Window 1, W1)
2. Goto workbench
3. Drag any view to another stack and drop it -> works
4. Create 2nd window W2 on right display
5. Maximize both
6. In W2: move a view as above -> works 
7. Goto W2
8. move a view as above -> dosnt work (sometimes u have to repeat step 6 a few times, so this fails)

the reproduction of this is issue not always 100% but if u do the above steps its often enough reproducible.

Making it work (great:) again:
• De-maximize W2 OR
• move it to the left display

other things i have noticed:
• I have my main display on the right but I tested it also on the left and doesn’t seem to have an influence
• U can switch W1 and W2 in the steps above but this lessens chance of reproducing the bug in my experience

This might be related to bug 509729 -- at least to my comment -- but since it's not getting any attention and somewhat different than the original problem it thought I make it an own bug and provide a reprod. guide.
Comment 1 thomas menzel CLA 2018-03-14 17:57:17 EDT
Version: Oxygen.2 (4.7.2)
Build id: M20171130-0510
started in debug as org.eclipse.platform.ide

the behavior is worse:

- the De-maximizing doesnt help but on left display it works
- for some views u dont even get the feedback that dragging started
Comment 2 Dani Megert CLA 2018-03-15 06:39:50 EDT
Is there anything in the .log?
Comment 3 thomas menzel CLA 2018-03-15 16:53:19 EDT
nope - at last nothing related:

!SESSION 2018-03-14 22:54:31.512 -----------------------------------------------
eclipse.buildId=4.7.2.M20171130-0510
java.version=1.8.0_91
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments:  -product org.eclipse.platform.ide
Command-line arguments:  ...

!ENTRY org.eclipse.egit.ui 2 0 2018-03-14 22:54:39.237
!MESSAGE Warning: The environment variable HOME is not set. The following directory will be used to store the Git
...

!ENTRY org.eclipse.core.net 4 0 2018-03-14 22:54:39.479
!MESSAGE WinHttp.DetectAutoProxyConfigUrl for wpad failed with error 'The Proxy Auto-configuration URL was not found.
' #12180.

!ENTRY org.eclipse.ui 4 4 2018-03-15 21:43:43.610
!MESSAGE Referenced part does not exist yet: org.eclipse.jdt.ui.PackageExplorer.
Comment 4 thomas menzel CLA 2018-03-23 04:21:19 EDT
can u point me into a direction where to look ? 
so far i have not much experience with eclipse RCP but my guess is it must be with the code that handles the DnD of the views/parts.

can u tell me where this is located in the code base?

another option is that this lies deeper somewhere in the SWT stuff. any pointers there?

who else can i ask? should i rather bring these questions to some forum?

i'm asking since i'd like to see this fixed ASAP, i'd like to contribute to this great IDE and have a bit of time left till the 4th april when my new project starts.
Comment 5 Dani Megert CLA 2018-04-03 10:41:27 EDT
(In reply to tmenzel from comment #4)
> can u point me into a direction where to look ? 
> so far i have not much experience with eclipse RCP but my guess is it must
> be with the code that handles the DnD of the views/parts.
> 
> can u tell me where this is located in the code base?

You could start with org.eclipse.e4.ui.workbench.addons.dndaddon.DnDManager.startDrag()
Comment 6 thomas menzel CLA 2018-10-02 04:34:23 EDT
FYI 2018-09/4.9 still has the problem
Comment 8 thomas menzel CLA 2018-12-25 00:10:00 EST
ok, found the problem: 

display.getCursorControl(); was replaced in 4.7 with DragAndDropUtil.findControl() which is not working IMO for >1 windows/shells.

for a more elaborate analysis see the readme in https://bitbucket.org/tomsit-incubator/eclipse.platform.ui

what next:
since i'm not that firm on why the code change was introduced (move a way from platform specific code?) and how it is done right, i can only hope that one of u can address the problem.
Comment 9 Andrey Loskutov CLA 2019-02-24 04:05:17 EST
*** Bug 544520 has been marked as a duplicate of this bug. ***
Comment 10 Andrey Loskutov CLA 2019-02-24 04:06:23 EST
From bug 544520 comment 9:

Here's a simple test case:
1. Start new workspace
2. Close Welcome page
3. Window > New Window
4. Go back to first window
5. Try to drag the Javadoc view tab
==> Does not work, drag is blocked!

This applies to all tabs in all stacks.
Comment 11 Dani Megert CLA 2019-02-24 08:30:09 EST
NOTE: Even a restart does not fix the problem!
Comment 12 Andrey Loskutov CLA 2019-02-24 09:07:03 EST
Regression is from bug 498510.

(In reply to Andrey Loskutov from comment #10)
> From bug 544520 comment 9:
> 
> Here's a simple test case:
> 1. Start new workspace
> 2. Close Welcome page
> 3. Window > New Window
> 4. Go back to first window
> 5. Try to drag the Javadoc view tab
> ==> Does not work, drag is blocked!

Note: this works only if the windows overlap (both maximized). Basically, DnD in first window does not work at all coordinates, which would also match widgets from the second window. For not overlapped widgets DnD still works.
Comment 13 Dani Megert CLA 2019-02-24 09:14:52 EST
(In reply to Andrey Loskutov from comment #12)
> > Here's a simple test case:
> > 1. Start new workspace
> > 2. Close Welcome page
> > 3. Window > New Window
> > 4. Go back to first window
> > 5. Try to drag the Javadoc view tab
> > ==> Does not work, drag is blocked!
> 
> Note: this works only if the windows overlap (both maximized). Basically,
> DnD in first window does not work at all coordinates, which would also match
> widgets from the second window. For not overlapped widgets DnD still works.
Good finding! Hover, it is not necessary that the windows are maximized. DnD is just blocked in the first window where the tab is overlapped (in the background) by the second one.
Comment 14 Andrey Loskutov CLA 2019-02-24 09:22:47 EST
(In reply to Andrey Loskutov from comment #12)
> Regression is from bug 498510.
> 
> (In reply to Andrey Loskutov from comment #10)
> > From bug 544520 comment 9:
> > 
> > Here's a simple test case:
> > 1. Start new workspace
> > 2. Close Welcome page
> > 3. Window > New Window
> > 4. Go back to first window
> > 5. Try to drag the Javadoc view tab
> > ==> Does not work, drag is blocked!
> 
> Note: this works only if the windows overlap (both maximized). Basically,
> DnD in first window does not work at all coordinates, which would also match
> widgets from the second window. For not overlapped widgets DnD still works.

Thanks to Tom's analysis in https://bitbucket.org/tomsit-incubator/eclipse.platform.ui/commits/872e2356f5d3e0c60762d6a7e127bd90c92df397 it is also easy to provide a fix: the search should start with the active (topmost) shell.
Comment 15 Dani Megert CLA 2019-02-24 09:35:42 EST
(In reply to Andrey Loskutov from comment #14)
> (In reply to Andrey Loskutov from comment #12)
> > Regression is from bug 498510.
> > 
> > (In reply to Andrey Loskutov from comment #10)
> > > From bug 544520 comment 9:
> > > 
> > > Here's a simple test case:
> > > 1. Start new workspace
> > > 2. Close Welcome page
> > > 3. Window > New Window
> > > 4. Go back to first window
> > > 5. Try to drag the Javadoc view tab
> > > ==> Does not work, drag is blocked!
> > 
> > Note: this works only if the windows overlap (both maximized). Basically,
> > DnD in first window does not work at all coordinates, which would also match
> > widgets from the second window. For not overlapped widgets DnD still works.
> 
> Thanks to Tom's analysis in
> https://bitbucket.org/tomsit-incubator/eclipse.platform.ui/commits/872e2356f5d3e0c60762d6a7e127bd90c92df397
> it is also easy to provide a fix: the search should start with the active
> (topmost) shell.
Can you do that?
Comment 16 Andrey Loskutov CLA 2019-02-24 09:38:20 EST
(In reply to Dani Megert from comment #15)
> > Thanks to Tom's analysis in
> > https://bitbucket.org/tomsit-incubator/eclipse.platform.ui/commits/872e2356f5d3e0c60762d6a7e127bd90c92df397
> > it is also easy to provide a fix: the search should start with the active
> > (topmost) shell.
> Can you do that?

I'm on it.
Comment 17 Eclipse Genie CLA 2019-02-24 09:59:38 EST
New Gerrit change created: https://git.eclipse.org/r/137491
Comment 19 Dani Megert CLA 2019-02-24 10:46:47 EST
Thanks Andrey!
Comment 20 Andrey Loskutov CLA 2019-02-24 10:48:28 EST
(In reply to Dani Megert from comment #19)
> Thanks Andrey!

Thanks to Tom. He found the root cause.
Comment 21 Dani Megert CLA 2019-02-25 04:30:35 EST
Verified in eclipse-SDK-I20190224-1800-win32-x86_64.
Comment 22 thomas menzel CLA 2020-01-02 13:22:36 EST
Created attachment 281368 [details]
shallow eclipse git repo with the analysis

attached the repos with my analysis b/c i'm cleaning up my private repos