selectionIncomplete(UIText.RepositorySelectionPage_UriMustNotHaveTrailingSpacesMessage);
return;
}
try {
final URIish finalURI = new URIish(uriText.getText().trim());
String proto = finalURI.getScheme();
if (proto == null && scheme.getSelectionIndex() >= 0)
proto = scheme.getItem(scheme.getSelectionIndex());
if (uri.getPath() == null) {
selectionIncomplete(NLS.bind(
UIText.RepositorySelectionPage_fieldRequired,
unamp(UIText.RepositorySelectionPage_promptPath),
proto));
return;
}
if (Protocol.FILE.handles(finalURI)) {
String badField = null;
if (uri.getHost() != null)
badField = UIText.RepositorySelectionPage_promptHost;
else if (uri.getUser() != null)
badField = UIText.RepositorySelectionPage_promptUser;
else if (uri.getPass() != null)
badField = UIText.RepositorySelectionPage_promptPassword;
if (badField != null) {
selectionIncomplete(NLS
.bind(
UIText.RepositorySelectionPage_fieldNotSupported,
unamp(badField), proto));
return;
}
final File d = FS.DETECTED.resolve(
new File("."), uri.getPath()); //$NON-NLS-1$
if (!d.exists()) {
selectionIncomplete(NLS.bind(
UIText.RepositorySelectionPage_fileNotFound,
d.getAbsolutePath()));
return;
}
selectionComplete(finalURI, null);
return;
}
if (uri.getHost() == null) {
selectionIncomplete(NLS.bind(
UIText.RepositorySelectionPage_fieldRequired,
unamp(UIText.RepositorySelectionPage_promptHost),
proto));
return;
}
if (Protocol.GIT.handles(finalURI)) {
String badField = null;
if (uri.getUser() != null)
badField = UIText.RepositorySelectionPage_promptUser;
else if (uri.getPass() != null)
badField = UIText.RepositorySelectionPage_promptPassword;
if (badField != null) {
selectionIncomplete(NLS
.bind(
UIText.RepositorySelectionPage_fieldNotSupported,
unamp(badField), proto));
return;
}
}
if (Protocol.HTTP.handles(finalURI)
|| Protocol.HTTPS.handles(finalURI)) {
UserPasswordCredentials credentials = SecureStoreUtils
.getCredentials(finalURI);
if (credentials != null) {
String u = credentials.getUser();
String p = credentials.getPassword();
String uriUser = finalURI.getUser();
if (uriUser == null) {
if (setSafeUser(u) && setSafePassword(p))
setStoreInSecureStore(true);
} else if (uriUser.length() != 0 && uriUser.equals(u)) {
if (setSafePassword(p))