Exemplo n.º 1
0
 /**
  * The method shows a login dialog for a given URI. The user field is taken from the URI if a user
  * is present in the URI. In this case the user is not editable.
  *
  * @param parent
  * @param uri
  * @return credentials, <code>null</code> if the user canceled the dialog.
  */
 public static UserPasswordCredentials login(Shell parent, URIish uri) {
   LoginDialog dialog = new LoginDialog(parent, uri);
   if (dialog.open() == Window.OK) {
     UserPasswordCredentials credentials = dialog.getCredentials();
     if (credentials != null && dialog.getStoreInSecureStore())
       SecureStoreUtils.storeCredentials(credentials, uri);
     return credentials;
   }
   return null;
 }
Exemplo n.º 2
0
 @Override
 public boolean performFinish() {
   try {
     if (cloneSource.getStoreInSecureStore()) {
       if (!SecureStoreUtils.storeCredentials(
           cloneSource.getCredentials(), cloneSource.getSelection().getURI())) return false;
     }
     return performClone();
   } finally {
     setWindowTitle(UIText.GitCloneWizard_title);
   }
 }
Exemplo n.º 3
0
 /**
  * The method shows a change credentials dialog for a given URI. The user field is taken from the
  * URI if a user is present in the URI. In this case the user is not editable.
  *
  * @param parent
  * @param uri
  * @return credentials, <code>null</code> if the user canceled the dialog.
  */
 public static UserPasswordCredentials changeCredentials(Shell parent, URIish uri) {
   LoginDialog dialog = new LoginDialog(parent, uri);
   dialog.setChangeCredentials(true);
   UserPasswordCredentials oldCredentials = SecureStoreUtils.getCredentials(uri);
   if (oldCredentials != null) dialog.setOldUser(oldCredentials.getUser());
   if (dialog.open() == Window.OK) {
     UserPasswordCredentials credentials = dialog.getCredentials();
     if (credentials != null) SecureStoreUtils.storeCredentials(credentials, uri);
     return credentials;
   }
   return null;
 }