use of org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardMarkResolvedPage in project subclipse by subclipse.
the class ResolveActionWithChoices method execute.
protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
boolean folderSelected = false;
boolean propertyConflicts = false;
boolean textConflicts = false;
boolean treeConflicts = false;
boolean treeConflictDialogShown = false;
IResource[] resources = getSelectedResources();
for (int i = 0; i < resources.length; i++) {
if (resources[i] instanceof IContainer) {
folderSelected = true;
}
if (!propertyConflicts || !textConflicts || !treeConflicts) {
ISVNLocalResource resource = SVNWorkspaceRoot.getSVNResourceFor(resources[i]);
try {
LocalResourceStatus status = resource.getStatus();
if (status != null && status.isPropConflicted())
propertyConflicts = true;
if (status != null && status.isTextConflicted())
textConflicts = true;
if (status != null && status.hasTreeConflict())
treeConflicts = true;
} catch (SVNException e) {
SVNUIPlugin.log(IStatus.ERROR, e.getMessage(), e);
}
}
}
if (resources.length == 1 && treeConflicts && !propertyConflicts && !textConflicts) {
treeConflict = getTreeConflict(resources[0]);
if (treeConflict != null) {
ResolveTreeConflictWizard wizard = new ResolveTreeConflictWizard(treeConflict, getTargetPart());
WizardDialog dialog = new SizePersistedWizardDialog(Display.getDefault().getActiveShell(), wizard, // $NON-NLS-1$
"ResolveTreeConflict");
if (dialog.open() != WizardDialog.OK)
return;
treeConflictDialogShown = true;
}
}
if (resources.length > 1 && treeConflicts) {
if (!MessageDialog.openConfirm(getShell(), Policy.bind("ResolveOperation.taskName"), Policy.bind("ResolveAction.confirmTreeConflicts")))
// $NON-NLS-1$ //$NON-NLS-2$
return;
setResolution(ISVNConflictResolver.Choice.chooseMerged);
} else if (!treeConflictDialogShown) {
SvnWizardMarkResolvedPage markResolvedPage = new SvnWizardMarkResolvedPage(resources);
markResolvedPage.setPropertyConflicts(propertyConflicts);
markResolvedPage.setTreeConflicts(treeConflicts);
SvnWizard wizard = new SvnWizard(markResolvedPage);
SvnWizardDialog dialog = new SvnWizardDialog(getShell(), wizard);
wizard.setParentDialog(dialog);
if (dialog.open() == SvnWizardDialog.CANCEL)
return;
setResolution(markResolvedPage.getResolution());
}
if (!treeConflictDialogShown)
super.execute(action);
}
use of org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardMarkResolvedPage in project subclipse by subclipse.
the class ResolveSynchronizeOperation method run.
protected void run(SVNTeamProvider provider, SyncInfoSet set, IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
boolean folderSelected = false;
propertyConflicts = false;
textConflicts = false;
treeConflicts = false;
canceled = false;
final IResource[] resources = set.getResources();
for (int i = 0; i < resources.length; i++) {
if (resources[i] instanceof IContainer) {
folderSelected = true;
break;
}
if (!propertyConflicts || !textConflicts || !treeConflicts) {
ISVNLocalResource resource = SVNWorkspaceRoot.getSVNResourceFor(resources[i]);
try {
LocalResourceStatus status = resource.getStatus();
if (status != null && status.isPropConflicted())
propertyConflicts = true;
if (status != null && status.isTextConflicted())
textConflicts = true;
if (status != null && status.hasTreeConflict())
treeConflicts = true;
} catch (SVNException e) {
SVNUIPlugin.log(IStatus.ERROR, e.getMessage(), e);
}
}
}
if (folderSelected) {
selectedResolution = ISVNConflictResolver.Choice.chooseMerged;
} else {
Display.getDefault().syncExec(new Runnable() {
public void run() {
if (propertyConflicts && !textConflicts) {
String message;
if (resources.length > 1)
// $NON-NLS-1$
message = Policy.bind("ResolveAction.confirmMultiple");
else
message = Policy.bind("ResolveAction.confirm", // $NON-NLS-1$
resources[0].getName());
if (!MessageDialog.openConfirm(getShell(), Policy.bind("ResolveOperation.taskName"), message)) {
// $NON-NLS-1$
canceled = true;
return;
}
selectedResolution = ISVNConflictResolver.Choice.chooseMerged;
} else {
SvnWizardMarkResolvedPage markResolvedPage = new SvnWizardMarkResolvedPage(resources);
markResolvedPage.setPropertyConflicts(propertyConflicts);
markResolvedPage.setTreeConflicts(treeConflicts);
SvnWizard wizard = new SvnWizard(markResolvedPage);
SvnWizardDialog dialog = new SvnWizardDialog(getShell(), wizard);
wizard.setParentDialog(dialog);
if (dialog.open() == SvnWizardDialog.CANCEL) {
canceled = true;
return;
}
selectedResolution = markResolvedPage.getResolution();
}
}
});
}
if (canceled)
return;
run(new WorkspaceModifyOperation() {
public void execute(IProgressMonitor monitor) throws InvocationTargetException {
ISVNRepositoryLocation repository = null;
ISVNClientAdapter svnClient = null;
try {
for (int i = 0; i < resources.length; i++) {
ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resources[i]);
repository = svnResource.getRepository();
svnClient = repository.getSVNClient();
svnClient.resolve(resources[i].getLocation().toFile(), selectedResolution);
repository.returnSVNClient(svnClient);
repository = null;
svnClient = null;
// for some reason, just refreshing the file won't cut it.
resources[i].getParent().refreshLocal(IResource.DEPTH_INFINITE, monitor);
}
} catch (TeamException e) {
throw new InvocationTargetException(e);
} catch (CoreException e) {
throw new InvocationTargetException(e);
} catch (SVNClientException e) {
throw new InvocationTargetException(e);
} finally {
if (repository != null) {
repository.returnSVNClient(svnClient);
}
}
}
}, false, /* cancelable */
PROGRESS_BUSYCURSOR);
}
Aggregations