Ejemplo n.º 1
0
 @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;
   }
 }
Ejemplo n.º 2
0
 private boolean fillStatementParameters(final List<SQLQueryParameter> parameters) {
   final RunnableWithResult<Boolean> binder =
       new RunnableWithResult<Boolean>() {
         @Override
         public void run() {
           SQLQueryParameterBindDialog dialog =
               new SQLQueryParameterBindDialog(partSite, getExecutionContext(), parameters);
           result = (dialog.open() == IDialogConstants.OK_ID);
         }
       };
   UIUtils.runInUI(partSite.getShell(), binder);
   Boolean result = binder.getResult();
   return result != null && result;
 }
Ejemplo n.º 3
0
 public static boolean confirmAction(
     final Shell shell, final String title, final String question) {
   RunnableWithResult<Boolean> confirmer =
       new RunnableWithResult<Boolean>() {
         @Override
         public void run() {
           MessageBox messageBox = new MessageBox(shell, SWT.ICON_WARNING | SWT.YES | SWT.NO);
           messageBox.setMessage(question);
           messageBox.setText(title);
           int response = messageBox.open();
           result = (response == SWT.YES);
         }
       };
   runInUI(shell, confirmer);
   return confirmer.getResult();
 }