use of org.tigris.subversion.subclipse.core.SVNProviderPlugin in project subclipse by subclipse.
the class RemoveRootAction method run.
public void run() {
ISVNRepositoryLocation[] roots = getSelectedRemoteRoots();
if (roots.length == 0)
return;
SVNProviderPlugin provider = SVNProviderPlugin.getPlugin();
for (int i = 0; i < roots.length; i++) {
try {
// Check if any projects are shared with the repository
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
final ArrayList shared = new ArrayList();
for (int j = 0; j < projects.length; j++) {
RepositoryProvider teamProvider = RepositoryProvider.getProvider(projects[j], SVNProviderPlugin.getTypeId());
if (teamProvider != null) {
try {
SVNTeamProvider svnProvider = (SVNTeamProvider) teamProvider;
if (svnProvider.getSVNWorkspaceRoot().getRepository().equals(roots[i])) {
shared.add(projects[j]);
}
} catch (Exception e) {
// Don't let any exception prevent from
// continuing
}
}
}
// This will notify the RepositoryManager of the removal
if (!shared.isEmpty()) {
final String location = roots[i].getLocation();
shell.getDisplay().syncExec(new Runnable() {
public void run() {
DetailsDialogWithProjects dialog = new DetailsDialogWithProjects(shell, Policy.bind(// $NON-NLS-1$
"RemoteRootAction.Unable_to_Discard_Location_1"), Policy.bind("RemoteRootAction.Projects_in_the_local_workspace_are_shared_with__2", // $NON-NLS-1$
location), Policy.bind(// $NON-NLS-1$
"RemoteRootAction.The_projects_that_are_shared_with_the_above_repository_are__4"), (IProject[]) shared.toArray(new IProject[shared.size()]), false, SVNUIPlugin.getStandardDisplay().getSystemImage(SWT.ICON_ERROR));
dialog.open();
}
});
} else {
provider.getRepositories().disposeRepository(roots[i]);
}
} catch (SVNException e) {
SVNUIPlugin.openError(shell, null, null, e);
SVNUIPlugin.log(e);
}
}
}
use of org.tigris.subversion.subclipse.core.SVNProviderPlugin in project subclipse by subclipse.
the class SvnWizardNewRepositoryPage method performFinish.
public boolean performFinish() {
success = true;
BusyIndicator.showWhile(Display.getDefault(), new Runnable() {
public void run() {
ISVNClientAdapter svnClient = null;
try {
SVNProviderPlugin provider = SVNProviderPlugin.getPlugin();
String url = getUrl();
if (provider.getRepositories().isKnownRepository(url, true)) {
MessageDialog.openError(getShell(), Policy.bind("NewRepositoryDialog.title"), // $NON-NLS-1$
Policy.bind("NewRepositoryDialog.alreadyExists"));
success = false;
return;
}
svnClient = SVNProviderPlugin.getPlugin().getSVNClient();
File path = new File(folderText.getText().trim());
if (!path.exists())
path.mkdirs();
svnClient.createRepository(path, ISVNClientAdapter.REPOSITORY_FSTYPE_FSFS);
if (connectionButton.getSelection()) {
Properties properties = new Properties();
// $NON-NLS-1$
properties.setProperty("url", url);
ISVNRepositoryLocation repository = provider.getRepositories().createRepository(properties);
provider.getRepositories().addOrUpdateRepository(repository);
}
} catch (Exception e) {
MessageDialog.openError(getShell(), Policy.bind("NewRepositoryDialog.title"), // $NON-NLS-1$
e.getLocalizedMessage());
success = false;
} finally {
SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(svnClient);
}
}
});
return success;
}
use of org.tigris.subversion.subclipse.core.SVNProviderPlugin in project subclipse by subclipse.
the class CheckoutWizard method createLocation.
private ISVNRepositoryLocation createLocation() {
createLocationPage.finish(new NullProgressMonitor());
Properties properties = createLocationPage.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());
}
}
}
String url = properties.getProperty("url");
if (createdRepositoryUrls.contains(url)) {
return null;
}
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);
}
}
});
createdRepositoryUrls.add(url);
} catch (InterruptedException e) {
return null;
} 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 null;
} 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 null;
}
if (keep)
return root[0];
}
}
return root[0];
}
use of org.tigris.subversion.subclipse.core.SVNProviderPlugin in project subclipse by subclipse.
the class Preferences method setSvnClientConfigDir.
/**
* set the svn client config dir
*
* @param configDir
*/
private void setSvnClientConfigDir(String configDir) {
if (SVNUIPlugin.getPlugin().passwordStoresConfiguredOnLinux() && !SVNUIPlugin.getPlugin().getDialogSettings().getBoolean(UnsupportedPasswordStoresDialog.SETTING_DO_NOT_SHOW_AGAIN)) {
if (!SVNUIPlugin.TEST_MODE) {
ISVNClientWrapper clientWrapper = Activator.getDefault().getClientWrapper("javahl");
String version = null;
if (clientWrapper != null) {
version = clientWrapper.getVersionString();
}
boolean bugFixed = version != null && new SvnVersion(version).isNewerThanOrEqualTo(SvnVersion.VERSION_1_8_11);
if (!bugFixed) {
Display.getDefault().syncExec(new Runnable() {
public void run() {
UnsupportedPasswordStoresDialog dialog = new UnsupportedPasswordStoresDialog(Display.getDefault().getActiveShell());
if (dialog.open() == UnsupportedPasswordStoresDialog.OK) {
try {
SVNUIPlugin.getPlugin().clearPasswordStoresFromConfiguration(false);
} catch (Exception e) {
SVNUIPlugin.log(IStatus.ERROR, e.getMessage(), e);
MessageDialog.openError(Display.getDefault().getActiveShell(), Messages.Preferences_0, e.getMessage());
}
} else {
SVNUIPlugin.getPlugin().getDialogSettings().put(UnsupportedPasswordStoresDialog.SETTING_DO_NOT_SHOW_AGAIN, dialog.isDoNotShowAgain());
}
}
});
}
}
}
SVNProviderPlugin plugin = SVNProviderPlugin.getPlugin();
SVNClientManager svnClientManager = plugin.getSVNClientManager();
if (configDir == null || "".equals(configDir)) {
// $NON-NLS-1$
svnClientManager.setConfigDir(null);
} else {
File configDirFile = new File(configDir);
svnClientManager.setConfigDir(configDirFile);
}
}
use of org.tigris.subversion.subclipse.core.SVNProviderPlugin in project subclipse by subclipse.
the class Preferences method setSvnChangePathOnDemand.
/**
* @param fetchChangePathOnDemand
*/
private void setSvnChangePathOnDemand(boolean fetchChangePathOnDemand) {
SVNProviderPlugin plugin = SVNProviderPlugin.getPlugin();
SVNClientManager svnClientManager = plugin.getSVNClientManager();
svnClientManager.setFetchChangePathOnDemand(fetchChangePathOnDemand);
}
Aggregations