use of org.tigris.subversion.subclipse.core.ISVNRepositoryLocation in project subclipse by subclipse.
the class UndoMergeCommand method run.
public void run(IProgressMonitor monitor) throws SVNException {
ISVNClientAdapter svnClient = null;
ISVNRepositoryLocation repository = null;
try {
final OperationManager operationManager = OperationManager.getInstance();
ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
repository = svnResource.getRepository();
svnClient = repository.getSVNClient();
svnClient.addNotifyListener(operationResourceCollector);
operationManager.beginOperation(svnClient);
LocalResourceStatus status = SVNWorkspaceRoot.getSVNResourceFor(resource).getStatus();
if (!status.isManaged()) {
try {
resource.delete(true, monitor);
} catch (CoreException ex) {
throw SVNException.wrapException(ex);
}
} else {
File path = resource.getLocation().toFile();
svnClient.revert(path, true);
if (resource.getType() != IResource.FILE)
operationManager.onNotify(path, SVNNodeKind.UNKNOWN);
monitor.worked(100);
}
} catch (SVNClientException e) {
throw SVNException.wrapException(e);
} finally {
if (repository != null) {
repository.returnSVNClient(svnClient);
}
OperationManager.getInstance().endOperation(true, operationResourceCollector.getOperationResources());
monitor.done();
}
}
use of org.tigris.subversion.subclipse.core.ISVNRepositoryLocation in project subclipse by subclipse.
the class MergeAction method isEnabledForMultipleResources.
/*
* (non-Javadoc)
* @see org.tigris.subversion.subclipse.ui.actions.WorkspaceAction#isEnabledForMultipleResources()
*/
protected boolean isEnabledForMultipleResources() {
try {
// Must all be from same repository.
ISVNRepositoryLocation repository = null;
IResource[] selectedResources = getSelectedResources();
for (int i = 0; i < selectedResources.length; i++) {
ISVNRepositoryLocation compareToRepository = null;
ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(selectedResources[i]);
if (svnResource == null || !svnResource.isManaged()) {
return false;
}
LocalResourceStatus status = svnResource.getStatusFromCache();
if (status != null) {
compareToRepository = status.getRepository();
}
if (compareToRepository == null) {
return false;
}
if (repository != null && !compareToRepository.equals(repository)) {
return false;
}
repository = compareToRepository;
}
return true;
} catch (Exception e) {
return false;
}
}
use of org.tigris.subversion.subclipse.core.ISVNRepositoryLocation in project subclipse by subclipse.
the class RemoteAnnotationStorage method getFullPath.
/*
* (non-Javadoc)
* @see org.eclipse.core.resources.IStorage#getFullPath()
*/
public IPath getFullPath() {
ISVNRepositoryLocation location = file.getRepository();
SVNUrl repositoryUrl = location.getRepositoryRoot();
String[] segments = repositoryUrl.getPathSegments();
IPath path = new Path(null, "/");
for (int i = 0; i < segments.length; i++) {
path = path.append(segments[i]);
}
path = path.setDevice(repositoryUrl.getHost() + IPath.DEVICE_SEPARATOR);
path = path.append(file.getRepositoryRelativePath());
return path;
}
use of org.tigris.subversion.subclipse.core.ISVNRepositoryLocation in project subclipse by subclipse.
the class RemoteResourceTransfer method fromByteArray.
public Object fromByteArray(byte[] buffer) {
try {
ByteArrayInputStream in = new ByteArrayInputStream(buffer);
DataInputStream readIn = new DataInputStream(in);
boolean isFolder = readIn.readBoolean();
// first, we read the url of the remote resource
SVNUrl urlResource = new SVNUrl(readIn.readUTF());
// then we read the url of the repository
String location = readIn.readUTF();
// we read the revision
SVNRevision revision = SVNRevision.getRevision(readIn.readUTF());
// we read the last changed revision
SVNRevision.Number lastChangedRevision = (Number) SVNRevision.getRevision(readIn.readUTF());
Date date = new Date(readIn.readLong());
String author = null;
try {
author = readIn.readUTF();
} catch (Exception e) {
// Ignore null author
}
ISVNRepositoryLocation repositoryLocation = SVNProviderPlugin.getPlugin().getRepository(location);
if (isFolder) {
return new RemoteFolder(null, repositoryLocation, urlResource, revision, lastChangedRevision, date, author);
}
return new RemoteFile(null, repositoryLocation, urlResource, revision, lastChangedRevision, date, author);
} catch (Exception ex) {
return null;
}
}
use of org.tigris.subversion.subclipse.core.ISVNRepositoryLocation in project subclipse by subclipse.
the class RepositoryBranchTagAction method execute.
protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
ISVNRemoteResource[] resources = getSelectedRemoteResources();
BranchTagWizard wizard = new BranchTagWizard(resources);
WizardDialog dialog = // $NON-NLS-1$
new SizePersistedWizardDialog(getShell(), wizard, "BranchTag");
if (dialog.open() == WizardDialog.OK) {
SVNUrl[] sourceUrls = wizard.getUrls();
SVNUrl destinationUrl = wizard.getToUrl();
String message = wizard.getComment();
SVNRevision revision = wizard.getRevision();
boolean makeParents = wizard.isMakeParents();
ISVNClientAdapter client = null;
try {
ISVNRepositoryLocation repository = SVNProviderPlugin.getPlugin().getRepository(sourceUrls[0].toString());
if (repository != null)
client = repository.getSVNClient();
if (client == null)
client = SVNProviderPlugin.getPlugin().getSVNClientManager().getSVNClient();
RepositoryBranchTagOperation branchTagOperation = new RepositoryBranchTagOperation(getTargetPart(), client, sourceUrls, destinationUrl, revision, message, makeParents);
branchTagOperation.setMultipleTransactions(wizard.isSameStructure());
branchTagOperation.run();
} catch (Exception e) {
MessageDialog.openError(getShell(), Policy.bind("BranchTagDialog.title"), e.getMessage());
} finally {
// BranchTagCommand will dispose.
// SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(client);
}
}
}
Aggregations