use of org.tigris.subversion.subclipse.ui.conflicts.SVNConflictResolver in project subclipse by subclipse.
the class SwitchOperation method execute.
protected void execute(SVNTeamProvider provider, IResource[] resources, IProgressMonitor monitor) throws SVNException, InterruptedException {
monitor.beginTask("Switch to Branch/Tag", resources.length);
try {
final List<IProject> projectList = new ArrayList<IProject>();
for (int i = 0; i < resources.length; i++) {
monitor.subTask("Switching " + resources[i].getName() + ". . .");
SVNUrl svnUrl = (SVNUrl) urlMap.get(resources[i]);
if (conflictResolver != null && conflictResolver instanceof SVNConflictResolver) {
((SVNConflictResolver) conflictResolver).setPart(getPart());
}
SVNWorkspaceSubscriber.getInstance().updateRemote(resources);
SwitchToUrlCommand command = new SwitchToUrlCommand(provider.getSVNWorkspaceRoot(), resources[i], svnUrl, svnRevision);
command.setDepth(depth);
command.setSetDepth(setDepth);
command.setIgnoreExternals(ignoreExternals);
command.setForce(force);
command.setIgnoreAncestry(ignoreAncestry);
command.setConflictResolver(conflictResolver);
command.run(monitor);
monitor.worked(1);
if (resources[i].getProject() != null && !projectList.contains(resources[i].getProject())) {
projectList.add(resources[i].getProject());
}
}
// Trigger lightweight refresh of decorators for project. This is needed because refreshLocal
// is not triggering a refresh for unchanged
// resources in Project Explorer.
Display.getDefault().asyncExec(new Runnable() {
public void run() {
SVNLightweightDecorator decorator = (SVNLightweightDecorator) SVNUIPlugin.getPlugin().getWorkbench().getDecoratorManager().getBaseLabelProvider(SVNUIPlugin.DECORATOR_ID);
for (IProject project : projectList) {
decorator.refresh(project);
}
}
});
} catch (SVNException e) {
if (e.operationInterrupted()) {
showCancelledMessage();
} else {
collectStatus(e.getStatus());
}
} catch (TeamException e) {
collectStatus(e.getStatus());
} finally {
monitor.done();
}
}
use of org.tigris.subversion.subclipse.ui.conflicts.SVNConflictResolver in project subclipse by subclipse.
the class SvnWizardSwitchPage method performFinish.
public boolean performFinish() {
try {
if (showUrl) {
urlCombo.saveUrl();
if (urlStrings.length > 1) {
urls = new SVNUrl[switchResources.length];
for (int i = 0; i < switchResources.length; i++) {
if (// $NON-NLS-1$
urlCombo.getText().endsWith("/"))
urls[i] = new SVNUrl(urlCombo.getText() + switchResources[i].getPartialPath());
else
urls[i] = new SVNUrl(urlCombo.getText() + "/" + // $NON-NLS-1$
switchResources[i].getPartialPath());
}
} else {
urls = new SVNUrl[1];
urls[0] = new SVNUrl(urlCombo.getText());
}
if (headButton.getSelection())
revision = SVNRevision.HEAD;
else {
try {
revision = SVNRevision.getRevision(revisionText.getText().trim());
} catch (ParseException e1) {
MessageDialog.openError(getShell(), Policy.bind("SwitchDialog.title"), // $NON-NLS-1$ //$NON-NLS-2$
Policy.bind("SwitchDialog.invalid"));
return false;
}
}
}
setDepth = setDepthButton.getSelection();
ignoreExternals = ignoreExternalsButton.getSelection();
force = forceButton.getSelection();
ignoreAncestry = ignoreAncestryButton.getSelection();
depth = DepthComboHelper.getDepth(depthCombo);
conflictResolver = new SVNConflictResolver(resources[0], getTextConflictHandling(), getBinaryConflictHandling(), getPropertyConflictHandling(), getTreeConflictHandling());
} catch (MalformedURLException e) {
MessageDialog.openError(getShell(), Policy.bind("SwitchDialog.title"), // $NON-NLS-1$
e.getMessage());
return false;
}
return true;
}
use of org.tigris.subversion.subclipse.ui.conflicts.SVNConflictResolver in project subclipse by subclipse.
the class SvnWizardUpdatePage method performFinish.
public boolean performFinish() {
if (headButton.getSelection())
revision = SVNRevision.HEAD;
else {
try {
revision = SVNRevision.getRevision(revisionText.getText().trim());
} catch (ParseException e1) {
MessageDialog.openError(getShell(), Policy.bind("UpdateDialog.title"), // $NON-NLS-1$ //$NON-NLS-2$
Policy.bind("UpdateDialog.invalid"));
return false;
}
}
setDepth = setDepthButton.getSelection();
ignoreExternals = ignoreExternalsButton.getSelection();
force = forceButton.getSelection();
depth = DepthComboHelper.getDepth(depthCombo);
conflictResolver = new SVNConflictResolver(resources[0], getTextConflictHandling(), getBinaryConflictHandling(), getPropertyConflictHandling(), getTreeConflictHandling());
return true;
}
use of org.tigris.subversion.subclipse.ui.conflicts.SVNConflictResolver 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.conflicts.SVNConflictResolver in project subclipse by subclipse.
the class UpdateSynchronizeOperation method doUpdate.
private void doUpdate(SVNTeamProvider provider, IProgressMonitor monitor, IResource[] resourceArray, SVNRevision revision) {
try {
SVNWorkspaceSubscriber.getInstance().updateRemote(resourceArray);
if (changeSetSelected) {
List<IResource> existingResources = new ArrayList<IResource>();
for (IResource resource : resourceArray) {
if (resource.exists()) {
existingResources.add(resource);
} else {
UpdateResourcesCommand command = new UpdateResourcesCommand(provider.getSVNWorkspaceRoot(), new IResource[] { resource }, revision);
command.setConflictResolver(new SVNConflictResolver());
command.run(Policy.subMonitorFor(monitor, 100));
}
}
if (!existingResources.isEmpty()) {
IResource[] existingResourceArray = new IResource[existingResources.size()];
existingResources.toArray(existingResourceArray);
UpdateResourcesCommand command = new UpdateResourcesCommand(provider.getSVNWorkspaceRoot(), existingResourceArray, revision);
command.setDepth(Depth.empty);
command.setSetDepth(false);
command.setConflictResolver(new SVNConflictResolver());
command.run(Policy.subMonitorFor(monitor, 100));
}
} else {
UpdateResourcesCommand command = new UpdateResourcesCommand(provider.getSVNWorkspaceRoot(), resourceArray, revision);
command.setConflictResolver(new SVNConflictResolver());
command.run(Policy.subMonitorFor(monitor, 100));
}
} catch (SVNException e) {
if (!e.operationInterrupted()) {
collectStatus(e.getStatus());
}
} catch (TeamException e) {
collectStatus(e.getStatus());
} finally {
monitor.done();
}
}
Aggregations