use of org.tigris.subversion.subclipse.ui.operations.UpdateOperation in project subclipse by subclipse.
the class MarkMergedSynchronizeOperation method run.
protected void run(SVNTeamProvider provider, SyncInfoSet set, final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
final IResource[] resources = set.getResources();
run(new WorkspaceModifyOperation() {
protected void execute(IProgressMonitor mon) throws CoreException, InvocationTargetException, InterruptedException {
for (int i = 0; i < resources.length; i++) {
File tempFile = null;
try {
tempFile = copyToTempFile(resources[i]);
} catch (Exception e) {
SVNUIPlugin.log(e.getMessage());
showErrorMessage(e);
return;
}
if (monitor.isCanceled()) {
if (tempFile != null)
tempFile.delete();
return;
}
ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resources[i]);
if (svnResource instanceof LocalResource)
((LocalResource) svnResource).revert(false);
else
svnResource.revert();
new UpdateOperation(getPart(), resources[i], SVNRevision.HEAD).run(monitor);
if (monitor.isCanceled()) {
if (tempFile != null)
tempFile.delete();
return;
}
File file = new File(resources[i].getLocation().toString());
try {
copy(tempFile, file);
} catch (Exception e1) {
SVNUIPlugin.log(e1.getMessage());
showErrorMessage(e1);
}
if (tempFile != null)
tempFile.delete();
}
}
}, true, /* cancelable */
PROGRESS_BUSYCURSOR);
}
use of org.tigris.subversion.subclipse.ui.operations.UpdateOperation in project subclipse by subclipse.
the class UpdateAction method execute.
/*
* @see IActionDelegate#run(IAction)
*/
public void execute(IAction action) throws InterruptedException, InvocationTargetException {
if (action != null && !action.isEnabled()) {
action.setEnabled(true);
} else {
IPreferenceStore store = SVNUIPlugin.getPlugin().getPreferenceStore();
IResource[] resources = getSelectedResources();
SVNConflictResolver conflictResolver = new SVNConflictResolver(resources[0], store.getInt(ISVNUIConstants.PREF_UPDATE_TO_HEAD_CONFLICT_HANDLING_TEXT_FILES), store.getInt(ISVNUIConstants.PREF_UPDATE_TO_HEAD_CONFLICT_HANDLING_BINARY_FILES), store.getInt(ISVNUIConstants.PREF_UPDATE_TO_HEAD_CONFLICT_HANDLING_PROPERTIES), store.getInt(ISVNUIConstants.PREF_UPDATE_TO_HEAD_CONFLICT_HANDLING_TREE_CONFLICTS));
UpdateOperation updateOperation = new UpdateOperation(getTargetPart(), resources, SVNRevision.HEAD);
updateOperation.setDepth(depth);
updateOperation.setSetDepth(setDepth);
updateOperation.setForce(store.getBoolean(ISVNUIConstants.PREF_UPDATE_TO_HEAD_ALLOW_UNVERSIONED_OBSTRUCTIONS));
updateOperation.setIgnoreExternals(store.getBoolean(ISVNUIConstants.PREF_UPDATE_TO_HEAD_IGNORE_EXTERNALS));
updateOperation.setCanRunAsJob(canRunAsJob);
updateOperation.setConflictResolver(conflictResolver);
updateOperation.run();
}
}
use of org.tigris.subversion.subclipse.ui.operations.UpdateOperation 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.subclipse.ui.operations.UpdateOperation in project subclipse by subclipse.
the class SVNCompareRevisionsInput method initializeActions.
/**
* initialize the actions : - getContentsAction : get the contents for the selected revision -
* getRevisionAction : updates to the given revision
*/
private void initializeActions() {
getContentsAction = new // $NON-NLS-1$
Action(// $NON-NLS-1$
Policy.bind("HistoryView.getContentsAction"), // $NON-NLS-1$
null) {
public void run() {
try {
new ProgressMonitorDialog(shell).run(false, true, new WorkspaceModifyOperation() {
protected void execute(IProgressMonitor monitor) throws InvocationTargetException {
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
if (selection.size() != 1)
return;
VersionCompareDiffNode node = (VersionCompareDiffNode) selection.getFirstElement();
ResourceEditionNode right = (ResourceEditionNode) node.getRight();
ISVNRemoteResource edition = right.getRemoteResource();
// actually want to change the base.
try {
monitor.beginTask(null, 100);
InputStream in = ((IResourceVariant) edition).getStorage(new SubProgressMonitor(monitor, 50)).getContents();
resource.setContents(in, false, true, new SubProgressMonitor(monitor, 50));
} catch (TeamException e) {
throw new InvocationTargetException(e);
} catch (CoreException e) {
throw new InvocationTargetException(e);
} finally {
monitor.done();
}
}
});
} catch (InterruptedException e) {
// Do nothing
return;
} catch (InvocationTargetException e) {
handle(e);
}
// recompute the labels on the viewer
updateCurrentEdition();
viewer.refresh();
}
};
getRevisionAction = new // $NON-NLS-1$
Action(// $NON-NLS-1$
Policy.bind("HistoryView.getRevisionAction"), // $NON-NLS-1$
null) {
public void run() {
try {
new ProgressMonitorDialog(shell).run(false, true, new WorkspaceModifyOperation(null) {
protected void execute(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
if (selection.size() != 1)
return;
VersionCompareDiffNode node = (VersionCompareDiffNode) selection.getFirstElement();
ResourceEditionNode right = (ResourceEditionNode) node.getRight();
final ISVNRemoteFile edition = (ISVNRemoteFile) right.getRemoteResource();
new UpdateOperation(null, resource, edition.getLastChangedRevision()).run(monitor);
// recompute the labels on the viewer
getHistoryTableProvider().setRemoteResource(edition);
viewer.refresh();
}
});
} catch (InterruptedException e) {
// Do nothing
return;
} catch (InvocationTargetException e) {
handle(e);
}
}
};
}
Aggregations