use of org.tigris.subversion.svnclientadapter.SVNRevision in project subclipse by subclipse.
the class SVNCompareEditorInput method getLabel.
/**
* Returns the label for the given input element (which is a ResourceEditionNode).
*/
private String getLabel(ITypedElement element) {
if (element instanceof ResourceEditionNode) {
ISVNRemoteResource edition = ((ResourceEditionNode) element).getRemoteResource();
SVNRevision revision = edition.getLastChangedRevision();
if (revision == null) {
revision = edition.getRevision();
}
if (edition instanceof ISVNRemoteFile) {
return Policy.bind("nameAndRevision", edition.getName(), // $NON-NLS-1$
revision.toString());
}
if (edition.isContainer()) {
// $NON-NLS-1$
return Policy.bind("SVNCompareEditorInput.inHead", edition.getName());
} else {
return Policy.bind("SVNCompareEditorInput.repository", // $NON-NLS-1$
new Object[] { edition.getName(), revision.toString() });
}
}
return element.getName();
}
use of org.tigris.subversion.svnclientadapter.SVNRevision in project subclipse by subclipse.
the class SVNCompareEditorInput method getVersionLabel.
/**
* Returns the label for the given input element. (which is a ResourceEditionNode)
*/
private String getVersionLabel(ITypedElement element) {
if (element instanceof ResourceEditionNode) {
ISVNRemoteResource edition = ((ResourceEditionNode) element).getRemoteResource();
SVNRevision revision = edition.getLastChangedRevision();
if (revision == null) {
revision = edition.getRevision();
}
if (edition.isContainer()) {
// $NON-NLS-1$
return Policy.bind("SVNCompareEditorInput.headLabel");
} else {
return revision.toString();
}
}
return element.getName();
}
use of org.tigris.subversion.svnclientadapter.SVNRevision in project subclipse by subclipse.
the class MergeWizardUnblockRevisionsPage method getLogEntries.
private void getLogEntries() {
entryArray = new ArrayList();
IRunnableWithProgress runnable = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try {
monitor.setTaskName(Messages.MergeWizardUnblockRevisionsPage_retrievingRevisionLogInfo);
monitor.beginTask(Messages.MergeWizardUnblockRevisionsPage_retrievingRevisionLogInfo, 3);
if (SVNUIPlugin.getPlugin().getPreferenceStore().getBoolean(ISVNUIConstants.PREF_SHOW_TAGS_IN_REMOTE))
tagManager = new AliasManager(remoteResource.getUrl());
SVNRevision pegRevision = remoteResource.getRevision();
monitor.worked(1);
for (int i = 0; i < revisionRanges.length; i++) {
rangeEntries = getLogEntries(pegRevision, revisionRanges[i].getFromRevision(), revisionRanges[i].getToRevision(), true, 0, tagManager, true);
monitor.worked(1);
for (int j = 0; j < rangeEntries.length; j++) {
entryArray.add(rangeEntries[j]);
}
}
entries = new ILogEntry[entryArray.size()];
entryArray.toArray(entries);
} catch (Exception e) {
setErrorMessage(e.getMessage());
entries = new ILogEntry[0];
}
monitor.worked(1);
monitor.done();
}
};
try {
getContainer().run(false, false, runnable);
} catch (Exception e1) {
Activator.handleError(e1);
}
setErrorMessage(standardPage.getErrorMessage());
}
use of org.tigris.subversion.svnclientadapter.SVNRevision in project subclipse by subclipse.
the class UpdateDialogAction method execute.
public void execute(IAction action) throws InterruptedException, InvocationTargetException {
if (action != null && !action.isEnabled()) {
action.setEnabled(true);
} else {
IResource[] resources = getSelectedResources();
String pageName;
if (resources.length > 1)
// $NON-NLS-1$
pageName = "UpdateDialogWithConflictHandling.multiple";
else
// $NON-NLS-1$
pageName = "UpdateDialogWithConflictHandling";
SvnWizardUpdatePage updatePage = new SvnWizardUpdatePage(pageName, resources);
updatePage.setDefaultRevision(revision);
updatePage.setDepth(depth);
updatePage.setSetDepth(setDepth);
SvnWizard wizard = new SvnWizard(updatePage);
SvnWizardDialog dialog = new SvnWizardDialog(getShell(), wizard);
wizard.setParentDialog(dialog);
if (dialog.open() == SvnWizardDialog.OK) {
SVNRevision svnRevision = updatePage.getRevision();
UpdateOperation updateOperation = new UpdateOperation(getTargetPart(), resources, svnRevision);
updateOperation.setDepth(updatePage.getDepth());
updateOperation.setSetDepth(updatePage.isSetDepth());
updateOperation.setForce(updatePage.isForce());
updateOperation.setIgnoreExternals(updatePage.isIgnoreExternals());
updateOperation.setCanRunAsJob(canRunAsJob);
updateOperation.setConflictResolver(updatePage.getConflictResolver());
updateOperation.run();
}
}
}
use of org.tigris.subversion.svnclientadapter.SVNRevision in project subclipse by subclipse.
the class ShowDifferencesAsUnifiedDiffActionWC method execute.
protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
IResource[] resources = getSelectedResources();
boolean refreshFile = false;
for (int i = 0; i < resources.length; i++) {
if (resources[i] instanceof IFile && !resources[i].isSynchronized(Depth.immediates)) {
if (refreshFile || MessageDialog.openQuestion(getShell(), Policy.bind("DifferencesDialog.compare"), Policy.bind("CompareWithRemoteAction.fileChanged"))) {
refreshFile = true;
try {
resources[i].refreshLocal(Depth.immediates, new NullProgressMonitor());
} catch (CoreException e) {
throw new InvocationTargetException(e);
}
} else {
break;
}
}
}
if (resources.length > 1) {
SvnWizardCompareMultipleResourcesWithBranchTagPage comparePage = new SvnWizardCompareMultipleResourcesWithBranchTagPage(resources);
SvnWizard wizard = new SvnWizard(comparePage);
SvnWizardDialog dialog = new SvnWizardDialog(getShell(), wizard);
if (dialog.open() == SvnWizardDialog.OK) {
ISVNLocalResource[] localResources = new ISVNLocalResource[resources.length];
for (int i = 0; i < resources.length; i++) {
localResources[i] = SVNWorkspaceRoot.getSVNResourceFor(resources[i]);
}
try {
SVNLocalBranchTagCompareInput compareInput = new SVNLocalBranchTagCompareInput(localResources, comparePage.getUrls(), comparePage.getRevision(), getTargetPart());
CompareUI.openCompareEditorOnPage(compareInput, getTargetPage());
} catch (SVNException e) {
MessageDialog.openError(getShell(), Policy.bind("ShowDifferencesAsUnifiedDiffDialog.branchTag"), e.getMessage());
}
}
return;
}
ShowDifferencesAsUnifiedDiffDialogWC dialog = new ShowDifferencesAsUnifiedDiffDialogWC(getShell(), resources[0], getTargetPart());
if (dialog.open() == ShowDifferencesAsUnifiedDiffDialogWC.OK) {
try {
if (dialog.isDiffToOutputFile())
dialog.getOperation().run();
if (!dialog.isDiffToOutputFile()) {
SVNRevision pegRevision = dialog.getPegRevision();
if (pegRevision == null) {
pegRevision = SVNRevision.HEAD;
}
if (resources[0] instanceof IContainer) {
ISVNRemoteFolder remoteFolder = new RemoteFolder(dialog.getSvnResource().getRepository(), dialog.getToUrl(), dialog.getToRevision());
((RemoteFolder) remoteFolder).setPegRevision(pegRevision);
SVNLocalCompareInput compareInput = new SVNLocalCompareInput(dialog.getSvnResource(), remoteFolder, pegRevision);
compareInput.setDiffOperation(dialog.getOperation());
CompareUI.openCompareEditorOnPage(compareInput, getTargetPage());
} else {
ISVNRemoteFile remoteFile = new RemoteFile(dialog.getSvnResource().getRepository(), dialog.getToUrl(), dialog.getToRevision());
((RemoteFile) remoteFile).setPegRevision(pegRevision);
SVNLocalCompareInput compareInput = new SVNLocalCompareInput(dialog.getSvnResource(), remoteFile, pegRevision);
CompareUI.openCompareEditorOnPage(compareInput, getTargetPage());
}
}
} catch (SVNException e) {
MessageDialog.openError(getShell(), Policy.bind("ShowDifferencesAsUnifiedDiffDialog.branchTag"), e.getMessage());
}
}
}
Aggregations