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

Bug 365580

Summary: StandardCredentialsProvider doesn't parent dialog from active shell and can be hidden
Product: [Tools] Target Management Reporter: Alan Staves <alan.staves>
Component: RSEAssignee: dsdp.tm.rse-inbox <tm.rse-inbox>
Status: NEW --- QA Contact: Martin Oberhuber <mober.at+eclipse>
Severity: normal    
Priority: P3 CC: dmcknigh
Version: 3.3   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Alan Staves CLA 2011-12-05 08:15:46 EST
Build Identifier: I20110613-1736

StanardCredentialsProvider.getShell() returns the shell associated with active workbench window but often there will be another shell active which is itself parented from the active workbench window. As a result the credentials dialog can occasionally not appear on top this active shell.

Suggested fix is to change getShell() to:

private Shell getShell() {

    Shell shell = null;
    IWorkbench workbench = PlatformUI.getWorkbench();
    if (workbench != null) {
        IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
        if (window != null) {
            shell = window.getShell()
        }
        // Get the active shell
        if (shell != null)
        { 
            shell = shell.getDisplay().getActiveShell();
        }
    }
    return shell;
}

Reproducible: Sometimes

Steps to Reproduce:
1. Create a connection to a remote machine but don't connect to it
2. Create a project
3. Use File menu->New->File
4. Click "Advanced >>" button
5. Click "Link to file in the file system" checkbox
6. Choose RSE in the dropdown box
7. Click Browse... button
8. Click My Home or Root to initiate the connection to the remote machine

The credentials dialog should pop up, but occasionally it will be hidden behind the Browse for File dialog with Eclipse apparently hanging. If you look at the shell the credentials dialog is parented from it is the top level Eclipse shell not the Browse For File shell (e.g. use SWTBot Spy to view the window parenting).
Comment 1 David McKnight CLA 2011-12-05 17:05:15 EST
Alan, could you submit your suggested fix as a patch?  The patch should update the copyright header and a legal disclaimer should be provided in the bug.  Thanks.
Comment 2 Alan Staves CLA 2011-12-22 12:19:13 EST
David, unfortunately I've now been told I can't create the patch - sorry.