use of org.jboss.tools.foundation.core.jobs.DelegatingProgressMonitor in project jbosstools-openshift by jbosstools.
the class ConnectionWizardPage method connect.
public boolean connect() {
try {
ConnectJob connectJob = new ConnectJob();
WizardUtils.runInWizard(connectJob, new DelegatingProgressMonitor(), getContainer(), getDatabindingContext());
boolean connected = JobUtils.isOk(connectJob.getConnectionStatus());
if (connected) {
// update the connection and save it
advConnectionEditors.saveChanges(pageModel);
boolean result = pageModel.saveConnection();
if (result) {
SecureStoreException e = pageModel.getRecentSecureStoreException();
if (e != null && e.getCause() instanceof StorageException) {
result = false;
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
String message = "Connection is successful, but access to secure storage is denied.\n" + "Please change save password/token settings and try again.\n" + "Be aware, that if you select 'Cancel' at this point, you will " + "be prompted for secure storage at each request for resources.";
MessageDialog.openWarning(getWizard().getContainer().getShell(), "Warning", message);
}
});
}
}
return result;
} else {
return false;
}
} catch (InterruptedException e) {
OpenShiftCommonUIActivator.log(NLS.bind("Failed to authenticate user on server at {1}", pageModel.getHost()), e);
return false;
} catch (InvocationTargetException e) {
OpenShiftCommonUIActivator.log(NLS.bind("Failed to authenticate user on server at {1}", pageModel.getHost()), e);
return false;
}
}
Aggregations