Bug 166483 - [Progress] Random shells come to the front when compare editor shows progress dialog
Summary: [Progress] Random shells come to the front when compare editor shows progress...
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.3 M5   Edit
Assignee: Steve Northover CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 35768 168516 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-12-01 09:09 EST by Boris Bokowski CLA
Modified: 2007-12-03 18:02 EST (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Boris Bokowski CLA 2006-12-01 09:09:17 EST
[I20061128-0800]

Sometimes, when opening a compare editor from the sync view, other random shells (e.g. Firefox, Notes...) come to the front.  This seems to be related to showing progress in a dialog.  It does not happen if the compare results are displayed fast enough.
Comment 1 Michael Valenta CLA 2006-12-19 08:30:18 EST
*** Bug 168516 has been marked as a duplicate of this bug. ***
Comment 2 Michael Valenta CLA 2006-12-21 11:39:11 EST
*** Bug 163078 has been marked as a duplicate of this bug. ***
Comment 3 Michael Valenta CLA 2006-12-22 14:57:34 EST
Boris and I tracked this down to the ProgressManager. The problem is that the Jobs progress monitor stays open after the job finished. The compare code then calls IProgressServive#busyCursorWhile which causes shell deactivation. This hits an SWT workaround which throws focus to an OS shell. I'm pasting the stack since I'm sure we'll forget all this by the time we get back from holidays.

Thread [main] (Suspended (breakpoint at line 746 in Control))	
	Shell(Control).fixFocus(Control) line: 746	
	Shell(Control).setEnabled(boolean) line: 2409	
	Shell.setEnabled(boolean) line: 1261	
	ProgressManager.setUserInterfaceActive(boolean) line: 1235	
	ProgressManager.access$4(ProgressManager, boolean) line: 1225	
	ProgressManager$3.run() line: 889	
	BusyIndicator.showWhile(Display, Runnable) line: 67	
	ProgressManager.busyCursorWhile(Runnable, ProgressMonitorJobsDialog) line: 925	
	ProgressManager.busyCursorWhile(IRunnableWithProgress) line: 900	
	ProgressManager.run(boolean, boolean, IRunnableWithProgress) line: 1108	
	CompareEditor$EditorCompareContainer(CompareContainer).run(boolean, boolean, IRunnableWithProgress) line: 81	
	ModelCompareEditorInput(CompareEditorInput).run(boolean, boolean, IRunnableWithProgress) line: 948	
	JavaMergeViewer(TextMergeViewer).doDiff() line: 2869	
	JavaMergeViewer(TextMergeViewer).update(boolean) line: 5068	
	JavaMergeViewer(TextMergeViewer).updateContent(Object, Object, Object) line: 2332	
	JavaMergeViewer(ContentMergeViewer).internalRefresh(Object) line: 703	
	JavaMergeViewer(ContentMergeViewer).inputChanged(Object, Object) line: 603	
	JavaMergeViewer(ContentViewer).setInput(Object) line: 251	
	JavaMergeViewer.setInput(Object) line: 134	
	CompareEditorInput$2(CompareViewerSwitchingPane).setInput(Object) line: 254	
	CompareEditorInput$12.run() line: 602	
	BusyIndicator.showWhile(Display, Runnable) line: 67	
	ModelCompareEditorInput(CompareEditorInput).feed1(ISelection) line: 597	
	ModelCompareEditorInput(CompareEditorInput).feedInput() line: 592	
	ModelCompareEditorInput(CompareEditorInput).createContents(Composite) line: 443	
	CompareEditor.createCompareControl() line: 347	
	CompareEditor.access$2(CompareEditor) line: 320	
	CompareEditor$3.run() line: 281	
	RunnableLock.run() line: 35	
	UISynchronizer(Synchronizer).runAsyncMessages(boolean) line: 123	
	Display.runAsyncMessages(boolean) line: 3442	
	Display.readAndDispatch() line: 3082	
	Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 1942	
	Workbench.runUI() line: 1906	
	Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 424	
	PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149	
	IDEApplication.run(Object) line: 95	
	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 85	
	NativeMethodAccessorImpl.invoke(Method, Object, Object[]) line: 58	
	DelegatingMethodAccessorImpl.invoke(Method, Object, Object[]) line: 60	
	Method.invoke(Object, Object[]) line: 391	
	EclipseAppContainer.callMethod(Object, String, Class[], Object[]) line: 522	
	EclipseAppHandle.run(Object) line: 147	
	EclipseAppLauncher.runApplication(Object) line: 104	
	EclipseAppLauncher.start(Object) line: 74	
	EclipseStarter.run(Object) line: 354	
	EclipseStarter.run(String[], Runnable) line: 170	
	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 85	
	NativeMethodAccessorImpl.invoke(Method, Object, Object[]) line: 58	
	DelegatingMethodAccessorImpl.invoke(Method, Object, Object[]) line: 60	
	Method.invoke(Object, Object[]) line: 391	
	Main.invokeFramework(String[], URL[]) line: 473	
	Main.basicRun(String[]) line: 417	
	Main.run(String[]) line: 1121	
	Main.main(String[]) line: 1096	
Comment 4 Steve Northover CLA 2007-02-01 14:30:44 EST
Mine!  I have a hack/fix for this.
Comment 5 Steve Northover CLA 2007-02-01 14:34:16 EST
Fixed > 20070201

Boris, I expect to go through a round of touch ups on this one.  Cross your fingers.
Comment 6 Steve Northover CLA 2007-02-01 14:50:53 EST
Wait. !#$%!@$#% Eclipse.org is down and won't accept my code.
Comment 7 Steve Northover CLA 2007-02-01 15:08:03 EST
Now it's in.
Comment 8 Steve Northover CLA 2007-02-05 18:49:19 EST
See bug 172888 for the first of the fallout.
Comment 9 Susan McCourt CLA 2007-06-28 15:00:58 EDT
*** Bug 35768 has been marked as a duplicate of this bug. ***
Comment 10 Randy Hudson CLA 2007-11-30 10:14:20 EST
I'm still seeing this problem in 3.3.1.1.
Comment 11 Steve Northover CLA 2007-12-02 11:50:29 EST
>  I expect to go through a round of touch ups on this one.

Ok, a touch up.  Does a random shell from another application come to the front or is it an Eclipse window?
Comment 12 Randy Hudson CLA 2007-12-03 11:28:18 EST
> Ok, a touch up.  Does a random shell from another application come to the front
> or is it an Eclipse window?

I was using something based on eclipse, and Lotus Notes V7 came to front.
Comment 13 Steve Northover CLA 2007-12-03 18:02:01 EST
You were using something based on Eclipse 3.3.1.1 and another application (Notes V7) came to the front.  The bug that we fixed happened when Windows chooses the next shell to bring to the front:

	/*
	* Feature in Windows.  When the active shell is disposed
	* or hidden, Windows normally makes the parent shell active
	* and assigns focus.  This does not happen when the parent
	* shell is disabled.  Instead, Windows assigns focus to the
	* next shell on the desktop (possibly a shell in another
	* application).  The fix is to activate the disabled parent
	* shell before disposing or hiding the active shell.
	*/

We have attempted to work around the scenario and must be missing a case.  It is also possible that your application is calling Shell.forceActive() (which calls the win32 API SetForegroundWindow() and this is forcing the window to the top).

Need more to go on to debug this.  Can you get a reproducable case?