use of org.tigris.subversion.subclipse.core.SVNProviderPlugin in project subclipse by subclipse.
the class NewLocationWizard method performFinish.
/*
* @see IWizard#performFinish
*/
public boolean performFinish() {
mainPage.finish(new NullProgressMonitor());
Properties properties = mainPage.getProperties();
if (repositorySourceProviderPage != null) {
ISVNRepositorySourceProvider selectedRepositorySourceProvider = repositorySourceProviderPage.getSelectedRepositorySourceProvider();
if (selectedRepositorySourceProvider != null) {
SVNRepositoryProviderWizardPage wizardPage = wizardPageMap.get(selectedRepositorySourceProvider);
if (wizardPage != null) {
// $NON-NLS-1$
properties.setProperty("url", wizardPage.getSelectedUrl());
}
}
}
final ISVNRepositoryLocation[] root = new ISVNRepositoryLocation[1];
SVNProviderPlugin provider = SVNProviderPlugin.getPlugin();
try {
root[0] = provider.getRepositories().createRepository(properties);
// Validate the connection info. This process also determines the rootURL
try {
new ProgressMonitorDialog(getShell()).run(true, true, new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException {
try {
root[0].validateConnection(monitor);
} catch (TeamException e) {
throw new InvocationTargetException(e);
}
}
});
} catch (InterruptedException e) {
return false;
} catch (InvocationTargetException e) {
Throwable t = e.getTargetException();
if (t instanceof TeamException) {
throw (TeamException) t;
}
}
provider.getRepositories().addOrUpdateRepository(root[0]);
} catch (TeamException e) {
if (root[0] == null) {
// Exception creating the root, we cannot continue
SVNUIPlugin.openError(getContainer().getShell(), Policy.bind("NewLocationWizard.exception"), null, // $NON-NLS-1$
e);
return false;
} else {
// Exception validating. We can continue if the user wishes.
IStatus error = e.getStatus();
if (error.isMultiStatus() && error.getChildren().length == 1) {
error = error.getChildren()[0];
}
boolean keep = false;
if (error.isMultiStatus()) {
SVNUIPlugin.openError(getContainer().getShell(), Policy.bind("NewLocationWizard.validationFailedTitle"), null, // $NON-NLS-1$
e);
} else {
keep = MessageDialog.openQuestion(getContainer().getShell(), // $NON-NLS-1$
Policy.bind("NewLocationWizard.validationFailedTitle"), Policy.bind("NewLocationWizard.validationFailedText", // $NON-NLS-1$
new Object[] { error.getMessage() }));
}
try {
if (keep) {
provider.getRepositories().addOrUpdateRepository(root[0]);
} else {
provider.getRepositories().disposeRepository(root[0]);
}
} catch (TeamException e1) {
SVNUIPlugin.openError(getContainer().getShell(), Policy.bind("exception"), null, // $NON-NLS-1$
e1);
return false;
}
return keep;
}
}
return true;
}
Aggregations