use of org.tigris.subversion.svnclientadapter.SVNRevision in project subclipse by subclipse.
the class MergeAction method execute.
protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
if (action != null && !action.isEnabled()) {
action.setEnabled(true);
} else {
IResource[] resources = getSelectedResources();
for (int i = 0; i < resources.length; i++) {
MergeDialog dialog = new MergeDialog(getShell(), resources[i]);
if (dialog.open() == MergeDialog.CANCEL)
break;
SVNUrl svnUrl1 = dialog.getFromUrl();
SVNRevision svnRevision1 = dialog.getFromRevision();
SVNUrl svnUrl2 = dialog.getToUrl();
SVNRevision svnRevision2 = dialog.getToRevision();
MergeOperation mergeOperation = new MergeOperation(getTargetPart(), getSelectedResources(), svnUrl1, svnRevision1, svnUrl2, svnRevision2);
mergeOperation.setForce(dialog.isForce());
mergeOperation.setIgnoreAncestry(dialog.isIgnoreAncestry());
mergeOperation.run();
}
}
}
use of org.tigris.subversion.svnclientadapter.SVNRevision 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.svnclientadapter.SVNRevision 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);
}
}
}
use of org.tigris.subversion.svnclientadapter.SVNRevision in project subclipse by subclipse.
the class SwitchAction method execute.
protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
if (action != null && !action.isEnabled()) {
action.setEnabled(true);
} else {
IResource[] resources = getSelectedResources();
// Use different wizard page name if multiple resources selected so that
// page size and location will be saved and restored separately for
// single selection switch and multiple selection switch.
String pageName;
if (resources.length > 1)
pageName = "SwitchDialogWithConflictHandling.multiple";
else
// $NON-NLS-1$
pageName = "SwitchDialogWithConflictHandling";
SvnWizardSwitchPage switchPage = new SvnWizardSwitchPage(pageName, resources);
SvnWizard wizard = new SvnWizard(switchPage);
SvnWizardDialog dialog = new SvnWizardDialog(getShell(), wizard);
wizard.setParentDialog(dialog);
if (dialog.open() == SvnWizardDialog.OK) {
SVNUrl[] svnUrls = switchPage.getUrls();
SVNRevision svnRevision = switchPage.getRevision();
SwitchOperation switchOperation = new SwitchOperation(getTargetPart(), resources, svnUrls, svnRevision);
switchOperation.setDepth(switchPage.getDepth());
switchOperation.setSetDepth(switchPage.isSetDepth());
switchOperation.setIgnoreExternals(switchPage.isIgnoreExternals());
switchOperation.setForce(switchPage.isForce());
switchOperation.setIgnoreAncestry(switchPage.isIgnoreAncestry());
switchOperation.setCanRunAsJob(canRunAsJob);
switchOperation.setConflictResolver(switchPage.getConflictResolver());
switchOperation.run();
}
}
}
use of org.tigris.subversion.svnclientadapter.SVNRevision in project subclipse by subclipse.
the class RefreshNodeAction method run.
public void run() {
IResource resource = ((RevisionGraphEditorInput) editor.getEditorInput()).getResource();
ISVNRemoteResource remoteResource = ((RevisionGraphEditorInput) editor.getEditorInput()).getRemoteResource();
GraphBackgroundTask task;
if (resource == null)
task = new GraphBackgroundTask(SVNUIPlugin.getActivePage().getActivePart(), editor.getViewer(), editor, remoteResource);
else
task = new GraphBackgroundTask(SVNUIPlugin.getActivePage().getActivePart(), editor.getViewer(), editor, resource);
task.setGetNewRevisions(false);
SVNRevision[] revisions = new SVNRevision[selectedRevisions.size()];
Node[] nodes = new Node[selectedRevisions.size()];
for (int i = 0; i < selectedRevisions.size(); i++) {
nodes[i] = (Node) ((RevisionEditPart) selectedRevisions.get(i)).getModel();
revisions[i] = new SVNRevision.Number(nodes[i].getRevision());
}
task.setRefreshRevisions(revisions, nodes);
try {
task.run();
} catch (Exception e) {
MessageDialog.openError(Display.getDefault().getActiveShell(), Policy.bind("RefreshNodeAction.title"), // $NON-NLS-1$
e.getMessage());
}
}
Aggregations