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

Bug 313461

Summary: DirectoryDialog Shell Cannot be Centered
Product: [Eclipse Project] Platform Reporter: Missing name <buko.obele>
Component: SWTAssignee: Project Inbox <swt-triaged>
Status: CLOSED WONTFIX QA Contact: Felipe Heidrich <eclipse.felipe>
Severity: normal    
Priority: P3 CC: eclipse.felipe, gheorghe
Version: 4.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Missing name CLA 2010-05-19 00:26:35 EDT
Build Identifier: 

The DirectoryDialog produces a Window whose placement on the screen seems to be quasi-random. There seems to be no way to get a reference to the underlying Window so that it can be centered on the screen. This leads to a poor user experience.

Reproducible: Always
Comment 1 Felipe Heidrich CLA 2010-05-19 11:30:36 EDT
The position is determined by the OS.

Adding setLocation only for one dialog (DirectoryDialog) doesn't make sense, we need to add to all others. We would need to know if setLocation() is possible for all dialogs on all platforms.
Moreover, setLocation() alone is useless. If you want to center the dialog, you would also need getSize(). So, for the API to be consistent we would need to add to all dialogs:

setLocation()
getLocation()
setSize()
getSize()
setBounds()
getBounds()


Which I know is not possible on all platforms. On windows, for example, you can only get the size of the dialog after you open it (or not at all, ain't sure).

I'm closing this request as won't fix. Sorry.

Let the OS determine the location of the dialog for you, that is what all application using DirectoryDialog (on windows) are doing.