Search in sources :

Example 1 with SignInDialog

use of com.microsoft.azuretools.core.ui.SignInDialog in project azure-tools-for-java by Microsoft.

the class SignInCommandHandler method doSignIn.

public static boolean doSignIn(Shell shell) {
    try {
        AuthMethodManager authMethodManager = AuthMethodManager.getInstance();
        boolean isSignIn = authMethodManager.isSignedIn();
        if (isSignIn)
            return true;
        SignInDialog d = SignInDialog.go(shell, authMethodManager.getAuthMethodDetails());
        if (null != d) {
            AuthMethodDetails authMethodDetailsUpdated = d.getAuthMethodDetails();
            authMethodManager.setAuthMethodDetails(authMethodDetailsUpdated);
            SelectSubsriptionsCommandHandler.onSelectSubscriptions(shell);
            authMethodManager.notifySignInEventListener();
        }
        return authMethodManager.isSignedIn();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return false;
}
Also used : AuthMethodDetails(com.microsoft.azuretools.authmanage.models.AuthMethodDetails) SignInDialog(com.microsoft.azuretools.core.ui.SignInDialog) ExecutionException(org.eclipse.core.commands.ExecutionException) AuthMethodManager(com.microsoft.azuretools.authmanage.AuthMethodManager)

Aggregations

AuthMethodManager (com.microsoft.azuretools.authmanage.AuthMethodManager)1 AuthMethodDetails (com.microsoft.azuretools.authmanage.models.AuthMethodDetails)1 SignInDialog (com.microsoft.azuretools.core.ui.SignInDialog)1 ExecutionException (org.eclipse.core.commands.ExecutionException)1