use of com.intellij.cvsSupport2.connections.login.CvsLoginWorker in project intellij-community by JetBrains.
the class Cvs2SettingsEditPanel method testConnection.
private static void testConnection(final CvsRootConfiguration configuration, final Component component, Project project) {
final CvsLoginWorker loginWorker = configuration.getLoginWorker(project);
final Ref<Boolean> success = new Ref<>();
ProgressManager.getInstance().run(new Task.Modal(project, CvsBundle.message("message.connecting.to.cvs.server"), false) {
@Override
public void run(@NotNull ProgressIndicator indicator) {
indicator.setText2(CvsBundle.message("message.current.global.timeout.setting", CvsApplicationLevelConfiguration.getInstance().TIMEOUT));
try {
final ThreeState result = LoginPerformer.checkLoginWorker(loginWorker, true);
if (ThreeState.NO == result) {
showConnectionFailedMessage(component, CvsBundle.message("test.connection.login.failed.text"));
} else if (ThreeState.UNSURE == result) {
showConnectionFailedMessage(component, CvsBundle.message("error.message.authentication.canceled"));
} else {
success.set(Boolean.TRUE);
}
} catch (ProcessCanceledException ignore) {
} catch (final Exception e) {
showConnectionFailedMessage(component, e.getLocalizedMessage());
}
}
});
if (success.get() != Boolean.TRUE)
return;
try {
configuration.testConnection(project);
showSuccessfulConnectionMessage(component);
} catch (ProcessCanceledException ignore) {
} catch (final Exception e) {
showConnectionFailedMessage(component, e.getLocalizedMessage());
}
}
Aggregations