Show Swing dialog if console not available (for compilation from IDEs).

Based on the code from https://www.timroes.de/2014/01/19/using-password-prompts-with-gradle-build-files/