Bug 341271 - UIMonitorUtility is not equipped to handle applications with more than one shell
Summary: UIMonitorUtility is not equipped to handle applications with more than one shell
Status: RESOLVED FIXED
Alias: None
Product: Subversive
Classification: Technology
Component: UI (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Igor Burilo CLA
QA Contact:
URL:
Whiteboard:
Keywords: ui
Depends on:
Blocks:
 
Reported: 2011-03-29 14:34 EDT by Dan O'Connor CLA
Modified: 2011-03-31 15:15 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dan O'Connor CLA 2011-03-29 14:34:50 EDT
Build Identifier: M20110210-1200

The product I am working on allows more than one workbench window to be opened at the same time. As a result during a sync operation the focus can be switched to the wrong workbench window inadvertently. The issue (or at least part of it) is because org.eclipse.team.svn.ui.utility.UIMonitorUtility does not check if the shell it is returning is the active shell:

org.eclipse.team.svn.ui.utility.UIMonitorUtility.java

public static Shell getShell() {
		Display display = UIMonitorUtility.getDisplay();
		// NEVER ! use the active shell because it could be disposed asynchronously by external thread
		for (Shell shell : display.getShells()) {
			if (shell.getParent() == null) {
				return shell;
			}
		}
		return new Shell(display, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
	}

This can easily return the wrong shell, and causes the wrong workbench window to be activated!

Reproducible: Always
Comment 1 Alexander Gurov CLA 2011-03-31 15:15:15 EDT
The method was reworked and its usage were enforced within the plug-in source code.