public static DBeaverUI getInstance() { if (instance == null) { instance = new DBeaverUI(); instance.initialize(); } return instance; }
@Override public DBAAuthInfo promptUserCredentials(String prompt, String userName, String userPassword) { // Ask user final Shell shell = DBeaverUI.getActiveWorkbenchShell(); final BaseAuthDialog authDialog = new BaseAuthDialog(shell, prompt); authDialog.setUserName(userName); authDialog.setUserPassword(userPassword); final RunnableWithResult<Boolean> binder = new RunnableWithResult<Boolean>() { @Override public void run() { result = (authDialog.open() == IDialogConstants.OK_ID); } }; UIUtils.runInUI(shell, binder); if (binder.getResult() != null && binder.getResult()) { return authDialog.getAuthInfo(); } else { return null; } }
static void disposeUI() { if (instance != null) { instance.dispose(); } }