Search code examples
eclipsepasswordsdialogrequired

How to disable programmatically Eclipse "Password Required" dialog?


I get "Password Required" eclipse dialog when i try to connect to some remote server with wrong user name and password.

The strange thing is that the Eclipse platform first gets my response and show the dialog and only then it reaches my try/catch block.

I just want to disable this dialog manually or programmatically.


Solution

  • Use this code before you send a request:

    // use default authenticator in order to catch
    // all connectivity exceptions and provide appropriate
    // error message
    // prevents eclipse from displaying "Password Required" dialog
    Authenticator.setDefault(new Authenticator() 
    {
    });