Search in sources :

Example 1 with AuthCanceledException

use of com.microsoft.azuretools.adauth.AuthCanceledException in project azure-tools-for-java by Microsoft.

the class SignInDialog method signInAsync.

private void signInAsync() throws InvocationTargetException, InterruptedException {
    IRunnableWithProgress op = new IRunnableWithProgress() {

        @Override
        public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
            monitor.beginTask("Signing In...", IProgressMonitor.UNKNOWN);
            try {
                AdAuthManager.getInstance().signIn();
            } catch (AuthCanceledException ex) {
                System.out.println(ex.getMessage());
            } catch (IOException ex) {
                System.out.println("run@ProgressDialog@signInAsync@SingInDialog: " + ex.getMessage());
                //ex.printStackTrace();
                //LOG.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "run@ProgressDialog@signInAsync@SingInDialog", e));
                Display.getDefault().asyncExec(new Runnable() {

                    @Override
                    public void run() {
                        ErrorWindow.go(getShell(), ex.getMessage(), "Sign In Error");
                        ;
                    }
                });
            }
        }
    };
    new ProgressMonitorDialog(this.getShell()).run(true, false, op);
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) AuthCanceledException(com.microsoft.azuretools.adauth.AuthCanceledException) ProgressMonitorDialog(org.eclipse.jface.dialogs.ProgressMonitorDialog) IOException(java.io.IOException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress)

Aggregations

AuthCanceledException (com.microsoft.azuretools.adauth.AuthCanceledException)1 IOException (java.io.IOException)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 ProgressMonitorDialog (org.eclipse.jface.dialogs.ProgressMonitorDialog)1 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)1