use of org.tigris.subversion.svnclientadapter.ISVNClientAdapter in project subclipse by subclipse.
the class ShowDifferencesAsUnifiedDiffOperationWC method execute.
protected void execute(IProgressMonitor monitor) throws SVNException, InterruptedException {
ISVNClientAdapter client = null;
ISVNRepositoryLocation repository = SVNProviderPlugin.getPlugin().getRepository(toUrl.toString());
if (repository != null)
client = repository.getSVNClient();
if (client == null)
client = SVNProviderPlugin.getPlugin().getSVNClientManager().getSVNClient();
try {
client.diff(path, toUrl, toRevision, file, true);
if (monitor.isCanceled())
canceled = true;
} catch (SVNClientException e) {
throw SVNException.wrapException(e);
} finally {
monitor.done();
SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(client);
}
}
use of org.tigris.subversion.svnclientadapter.ISVNClientAdapter in project subclipse by subclipse.
the class CommitOperation method execute.
protected void execute(IProgressMonitor monitor) throws SVNException, InterruptedException {
postCommitError = null;
monitor.beginTask(null, resourcesToAdd.length + resourcesToDelete.length + resourcesToCommit.length);
try {
svnClient = SVNProviderPlugin.getPlugin().getSVNClientManager().getSVNClient();
if (resourcesToAdd.length > 0) {
Map<SVNTeamProvider, List<IResource>> table = getProviderMapping(resourcesToAdd);
if (table.get(null) != null) {
throw new SVNException(// $NON-NLS-1$
Policy.bind("RepositoryManager.addErrorNotAssociated"));
}
Set<SVNTeamProvider> keySet = table.keySet();
for (SVNTeamProvider provider : keySet) {
List<IResource> list = table.get(provider);
IResource[] providerResources = list.toArray(new IResource[list.size()]);
provider.add(providerResources, IResource.DEPTH_ZERO, Policy.subMonitorFor(monitor, resourcesToAdd.length));
}
}
if (resourcesToDelete.length > 0) {
// use an adapter that will log to console
ISVNClientAdapter svnDeleteClient = null;
try {
Map<SVNTeamProvider, List<IResource>> table = getProviderMapping(resourcesToDelete);
if (table.get(null) != null) {
throw new SVNException(// $NON-NLS-1$
Policy.bind("RepositoryManager.addErrorNotAssociated"));
}
Set<SVNTeamProvider> keySet = table.keySet();
for (SVNTeamProvider provider : keySet) {
List<IResource> list = table.get(provider);
File[] files = new File[list.size()];
int i = 0;
for (IResource resource : list) {
ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
if (svnDeleteClient == null)
svnDeleteClient = svnResource.getRepository().getSVNClient();
files[i] = svnResource.getFile();
i++;
}
svnDeleteClient.remove(files, true);
}
} catch (SVNClientException e) {
throw new TeamException(e.getMessage());
} finally {
SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(svnDeleteClient);
}
}
setAtomicCommitMode();
Map<ProjectAndRepository, List<IResource>> table = getCommitProviderMapping(resourcesToCommit);
Set<ProjectAndRepository> keySet = table.keySet();
for (ProjectAndRepository mapKey : keySet) {
SVNTeamProvider provider = mapKey.getTeamProvider();
List<IResource> list = table.get(mapKey);
IResource[] providerResources = new IResource[list.size()];
list.toArray(providerResources);
postCommitError = provider.checkin(providerResources, commitComment, keepLocks, IResource.DEPTH_ZERO, Policy.subMonitorFor(monitor, providerResources.length));
for (IResource providerResource : providerResources) {
if (!providerResource.exists()) {
SVNProviderPlugin.getPlugin().getStatusCacheManager().removeStatus(providerResource);
}
}
if (postCommitError != null) {
Display.getDefault().syncExec(new Runnable() {
public void run() {
MessageDialog.openError(Display.getDefault().getActiveShell(), Policy.bind("CommitDialog.title"), postCommitError);
}
});
}
}
} catch (TeamException e) {
throw SVNException.wrapException(e);
} finally {
monitor.done();
SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(svnClient);
// refresh the Synch view
SVNProviderPlugin.broadcastModificationStateChanges(resourcesToCommit);
}
}
use of org.tigris.subversion.svnclientadapter.ISVNClientAdapter in project subclipse by subclipse.
the class ExportOperation method execute.
protected void execute(SVNTeamProvider provider, IResource[] resources, IProgressMonitor monitor) throws SVNException, InterruptedException {
ISVNClientAdapter client = null;
ISVNRepositoryLocation repository = null;
try {
for (int i = 0; i < resources.length; i++) {
if (client == null) {
repository = SVNWorkspaceRoot.getSVNResourceFor(resources[i]).getRepository();
client = repository.getSVNClient();
}
File srcPath = new File(resources[i].getLocation().toString());
File destPath = new File(directory + File.separator + resources[i].getName());
try {
client.doExport(srcPath, destPath, true);
} catch (SVNClientException e) {
throw SVNException.wrapException(e);
}
}
} catch (SVNException e) {
if (e.operationInterrupted()) {
showCancelledMessage();
} else {
collectStatus(e.getStatus());
}
} finally {
if (repository != null) {
repository.returnSVNClient(client);
}
monitor.done();
}
}
use of org.tigris.subversion.svnclientadapter.ISVNClientAdapter in project subclipse by subclipse.
the class ExportRemoteFolderOperation method execute.
protected void execute(IProgressMonitor monitor) throws SVNException, InterruptedException {
ISVNClientAdapter client = null;
try {
client = folder.getRepository().getSVNClient();
try {
client.doExport(folder.getUrl(), directory, revision, true);
} catch (SVNClientException e) {
throw SVNException.wrapException(e);
}
} catch (SVNException e) {
if (e.operationInterrupted()) {
showCancelledMessage();
} else {
collectStatus(e.getStatus());
}
} finally {
folder.getRepository().returnSVNClient(client);
monitor.done();
}
}
use of org.tigris.subversion.svnclientadapter.ISVNClientAdapter 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;
}
Aggregations