else {
openLoginDialog = fLoginDialogLock.tryLock();
}
/* Open Login Dialog */
final AuthenticationRequiredException authEx = (AuthenticationRequiredException) e;
if (openLoginDialog) {
try {
JobRunner.runSyncedInUIThread(shellAr[0], new Runnable() {
public void run() {
/* Return on Cancelation or shutdown or deletion */
if (!shouldProceedReloading(monitor, bookmark))
return;
/* Credentials might have been provided meanwhile in another dialog */
if (!isSynchronizedFeed) {
try {
URI normalizedUri = URIUtils.normalizeUri(feedLink, true);
if (Owl.getConnectionService().getAuthCredentials(normalizedUri, authEx.getRealm()) != null) {
reloadQueued(bookmark, null, shellAr[0]);
return;
}
} catch (CredentialsException exe) {
Activator.getDefault().getLog().log(exe.getStatus());
}
}
/* Show Login Dialog */
int status = -1;
if (isSynchronizedFeed)
status = OwlUI.openSyncLogin(shellAr[0]);
else
status = new LoginDialog(shellAr[0], feedLink, authEx.getRealm()).open();
/* Remember time when user hit cancel from a Google Reader login challenge */
if (status == Window.CANCEL && isSynchronizedFeed)
fLastGoogleLoginCancel.set(System.currentTimeMillis());
/* Trigger another Reload if credentials have been provided */
if (status == Window.OK && shouldProceedReloading(monitor, bookmark)) {
/* Store info about Realm in Bookmark */
if (StringUtils.isSet(authEx.getRealm())) {
bookmark.setProperty(BM_REALM_PROPERTY, authEx.getRealm());
fBookMarkDAO.save(bookmark);
}
/* Re-Reload Bookmark */
reloadQueued(bookmark, null, shellAr[0]);