use of org.tigris.subversion.subclipse.ui.compare.SVNLocalCompareInput in project subclipse by subclipse.
the class SvnWizardCommitPage method addResourcesArea.
private void addResourcesArea(Composite composite) {
// get the toolbar actions from any contributing plug-in
final SVNPluginAction[] toolbarActions = SVNUIPlugin.getCommitDialogToolBarActions();
final SVNPluginAction[] alternateCompareActions = SVNUIPlugin.getCommitDialogCompareActions();
ResourceSelectionTree.IToolbarControlCreator toolbarControlCreator = new ResourceSelectionTree.IToolbarControlCreator() {
public void createToolbarControls(ToolBarManager toolbarManager) {
toolbarManager.add(new // $NON-NLS-1$
ControlContribution(// $NON-NLS-1$
"ignoreUnversioned") {
protected Control createControl(Composite parent) {
includeUnversionedButton = new Button(parent, SWT.CHECK);
includeUnversionedButton.setText(// $NON-NLS-1$
Policy.bind("CommitDialog.includeUnversioned"));
includeUnversionedButton.setSelection(includeUnversioned);
includeUnversionedButton.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
includeUnversioned = includeUnversionedButton.getSelection();
includeUnversionedAction.setChecked(includeUnversioned);
toggleIncludeUnversioned();
}
public void widgetDefaultSelected(SelectionEvent e) {
}
});
return includeUnversionedButton;
}
});
toolbarManager.add(new ControlContribution("keepLocks") {
protected Control createControl(Composite parent) {
keepLocksButton = new Button(parent, SWT.CHECK);
// $NON-NLS-1$
keepLocksButton.setText(Policy.bind("CommitDialog.keepLocks"));
keepLocksButton.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
keepLocks = keepLocksButton.getSelection();
keepLocksAction.setChecked(keepLocksButton.getSelection());
}
public void widgetDefaultSelected(SelectionEvent e) {
}
});
return keepLocksButton;
}
});
toolbarManager.add(new Separator());
toolbarManager.add(new ControlContribution("showCompare") {
protected Control createControl(Composite parent) {
showCompareButton = new Button(parent, SWT.TOGGLE | SWT.FLAT);
showCompareButton.setImage(// $NON-NLS-1$
SVNUIPlugin.getImage(ISVNUIConstants.IMG_SYNCPANE));
showCompareButton.setToolTipText(Policy.bind("CommitDialog.showCompare"));
showCompareButton.setSelection(showCompare);
showCompareButton.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
showComparePane(!showCompare);
if (showCompare) {
IStructuredSelection selection = (IStructuredSelection) resourceSelectionTree.getTreeViewer().getSelection();
if (!selection.isEmpty()) {
Object sel0 = selection.getFirstElement();
if (sel0 instanceof IFile) {
final ISVNLocalResource localResource = SVNWorkspaceRoot.getSVNResourceFor((IFile) sel0);
try {
// compare dialog
if (alternateCompareActions.length > 0) {
StructuredSelection localResourceSelection = new StructuredSelection(localResource);
for (int i = 0; i < alternateCompareActions.length; i++) {
// make sure the selection is up to date
alternateCompareActions[i].selectionChanged(localResourceSelection);
alternateCompareActions[i].run();
}
} else {
setCompareInput(new SVNLocalCompareInput(localResource, SVNRevision.BASE, true));
}
} catch (Exception e1) {
}
}
}
}
}
public void widgetDefaultSelected(SelectionEvent e) {
}
});
return showCompareButton;
}
});
// add any contributing actions from the extension point
if (toolbarActions.length > 0) {
toolbarManager.add(new Separator());
for (int i = 0; i < toolbarActions.length; i++) {
SVNPluginAction action = toolbarActions[i];
toolbarManager.add(action);
}
}
}
public int getControlCount() {
return 1;
}
};
resourceSelectionTree = new ResourceSelectionTree(composite, SWT.NONE, Policy.bind("GenerateSVNDiff.Changes"), ResourceSelectionTree.dedupeResources(resourcesToCommit), statusMap, null, true, toolbarControlCreator, // $NON-NLS-1$
syncInfoSet);
if (!resourceSelectionTree.showIncludeUnversionedButton())
includeUnversionedButton.setVisible(false);
resourceSelectionTree.setCustomOptions(getCustomOptions());
resourceSelectionTree.setRemoveFromViewValidator(new ResourceSelectionTree.IRemoveFromViewValidator() {
public boolean canRemove(ArrayList resourceList, IStructuredSelection selection) {
return removalOk(resourceList, selection);
}
public String getErrorMessage() {
return removalError;
// return Policy.bind("CommitDialog.unselectedPropChangeChildren"); //$NON-NLS-1$
}
});
resourceSelectionTree.getTreeViewer().getTree().addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
selectedResources = resourceSelectionTree.getSelectedResources();
// need to update the toolbar actions too - but we use the tree viewer's selection
IStructuredSelection selection = (IStructuredSelection) resourceSelectionTree.getTreeViewer().getSelection();
if (toolbarActions.length > 0) {
for (int i = 0; i < toolbarActions.length; i++) {
SVNPluginAction action = toolbarActions[i];
action.selectionChanged(selection);
}
}
if (showCompare) {
Object sel0 = selection.getFirstElement();
if (sel0 instanceof IFile) {
final ISVNLocalResource localResource = SVNWorkspaceRoot.getSVNResourceFor((IFile) sel0);
try {
// then call those actions instead of showing the default compare dialog
if (alternateCompareActions.length > 0) {
StructuredSelection localResourceSelection = new StructuredSelection(localResource);
for (int i = 0; i < alternateCompareActions.length; i++) {
// make sure the selection is up to date
alternateCompareActions[i].selectionChanged(localResourceSelection);
alternateCompareActions[i].run();
}
} else {
setCompareInput(new SVNLocalCompareInput(localResource, SVNRevision.BASE, true));
}
} catch (Exception e1) {
}
}
}
}
});
((CheckboxTreeViewer) resourceSelectionTree.getTreeViewer()).addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent event) {
selectedResources = resourceSelectionTree.getSelectedResources();
}
});
resourceSelectionTree.getTreeViewer().addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
IStructuredSelection sel = (IStructuredSelection) event.getSelection();
Object sel0 = sel.getFirstElement();
if (sel0 instanceof IFile) {
final ISVNLocalResource localResource = SVNWorkspaceRoot.getSVNResourceFor((IFile) sel0);
try {
// then call those actions instead of showing the default compare dialog
if (alternateCompareActions.length > 0) {
StructuredSelection selection = new StructuredSelection(localResource);
for (int i = 0; i < alternateCompareActions.length; i++) {
// make sure the selection is up to date
alternateCompareActions[i].selectionChanged(selection);
alternateCompareActions[i].run();
}
} else {
setCompareInput(new SVNLocalCompareInput(localResource, SVNRevision.BASE, true));
showComparePane(true);
showCompareButton.setSelection(true);
}
} catch (Exception e1) {
}
}
}
});
if (!includeUnversioned) {
resourceSelectionTree.removeUnversioned();
}
selectedResources = resourceSelectionTree.getSelectedResources();
setPageComplete(canFinish());
}
use of org.tigris.subversion.subclipse.ui.compare.SVNLocalCompareInput in project subclipse by subclipse.
the class SvnWizardRevertPage method createControls.
public void createControls(Composite outerContainer) {
Composite composite = new Composite(outerContainer, SWT.NULL);
GridLayout layout = new GridLayout(1, false);
layout.marginHeight = 0;
layout.marginWidth = 0;
composite.setLayout(layout);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
ResourceSelectionTree.IToolbarControlCreator toolbarControlCreator = new ResourceSelectionTree.IToolbarControlCreator() {
public void createToolbarControls(ToolBarManager toolbarManager) {
toolbarManager.add(new // $NON-NLS-1$
ControlContribution(// $NON-NLS-1$
"ignoreUnversioned") {
protected Control createControl(Composite parent) {
includeUnversionedButton = new Button(parent, SWT.CHECK);
includeUnversionedButton.setText(// $NON-NLS-1$
Policy.bind("CommitDialog.includeUnversioned"));
includeUnversionedButton.setSelection(includeUnversioned);
includeUnversionedButton.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
includeUnversioned = includeUnversionedButton.getSelection();
if (!includeUnversioned) {
resourceSelectionTree.removeUnversioned();
} else {
resourceSelectionTree.addUnversioned();
}
selectedResources = resourceSelectionTree.getSelectedResources();
setPageComplete(canFinish());
if (!fromSyncView)
updatePreference(includeUnversioned);
}
public void widgetDefaultSelected(SelectionEvent e) {
}
});
return includeUnversionedButton;
}
});
}
public int getControlCount() {
return 1;
}
};
IResource[] dedupedResourcesToRevert = ResourceSelectionTree.dedupeResources(resourcesToRevert);
if (dedupedResourcesToRevert.length != resourcesToRevert.length) {
resourceRemoved = true;
}
resourceSelectionTree = new ResourceSelectionTree(composite, SWT.NONE, Policy.bind("GenerateSVNDiff.Changes"), dedupedResourcesToRevert, statusMap, null, true, toolbarControlCreator, // $NON-NLS-1$
null);
if (!resourceSelectionTree.showIncludeUnversionedButton())
includeUnversionedButton.setVisible(false);
// resourceSelectionTree.getTreeViewer().setAllChecked(true);
resourceSelectionTree.getTreeViewer().addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
selectedResources = resourceSelectionTree.getSelectedResources();
}
});
((CheckboxTreeViewer) resourceSelectionTree.getTreeViewer()).addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent event) {
selectedResources = resourceSelectionTree.getSelectedResources();
}
});
resourceSelectionTree.getTreeViewer().addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
IStructuredSelection sel = (IStructuredSelection) event.getSelection();
Object sel0 = sel.getFirstElement();
if (sel0 instanceof IFile) {
final ISVNLocalResource localResource = SVNWorkspaceRoot.getSVNResourceFor((IFile) sel0);
try {
new CompareDialog(getShell(), new SVNLocalCompareInput(localResource, SVNRevision.BASE, true)).open();
} catch (Exception e1) {
}
}
}
});
if (!includeUnversioned) {
resourceSelectionTree.removeUnversioned();
}
resourceSelectionTree.getTreeViewer().getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
// Composite composite_1 = new Composite(composite, SWT.NONE);
// composite_1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
// composite_1.setLayout(new GridLayout());
selectedResources = resourceSelectionTree.getSelectedResources();
setPageComplete(canFinish());
PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.REVERT_DIALOG);
}
use of org.tigris.subversion.subclipse.ui.compare.SVNLocalCompareInput 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());
}
}
}
use of org.tigris.subversion.subclipse.ui.compare.SVNLocalCompareInput in project subclipse by subclipse.
the class CompareWithRemoteAction method execute.
public void execute(IAction action) {
refresh = false;
fileSelected = false;
final IResource[] resources = getSelectedResources();
if (resources.length != 1 && !SVNRevision.BASE.equals(revision) && !SVNRevision.HEAD.equals(revision)) {
return;
}
for (int i = 0; i < resources.length; i++) {
if (resources[i] instanceof IFile) {
fileSelected = true;
if (!resources[i].isSynchronized(Depth.immediates)) {
refresh = MessageDialog.openQuestion(getShell(), Policy.bind("DifferencesDialog.compare"), Policy.bind("CompareWithRemoteAction.fileChanged"));
break;
}
}
}
try {
final ISVNLocalResource[] localResources = new ISVNLocalResource[resources.length];
for (int i = 0; i < resources.length; i++) {
localResources[i] = SVNWorkspaceRoot.getSVNResourceFor(resources[i]);
}
final ISVNLocalResource localResource = localResources[0];
run(new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) {
try {
if (refresh) {
for (int i = 0; i < localResources.length; i++) {
if (resources[i] instanceof IFile) {
localResources[i].getResource().refreshLocal(Depth.immediates, monitor);
}
}
}
if (SVNRevision.BASE.equals(revision)) {
if (localResources.length == 1 && localResource.getResource() instanceof IFile) {
SVNLocalCompareInput compareInput = new SVNLocalCompareInput(localResource, revision);
CompareUI.openCompareEditorOnPage(compareInput, getTargetPage());
} else {
SVNLocalBaseCompareInput compareInput = new SVNLocalBaseCompareInput(localResources, revision);
CompareUI.openCompareEditorOnPage(compareInput, getTargetPage());
}
} else {
if (!fileSelected) {
SVNLocalCompareSummaryInput compareInput = new SVNLocalCompareSummaryInput(localResources, revision);
CompareUI.openCompareEditorOnPage(compareInput, getTargetPage());
} else {
ISVNRemoteFile remoteFile = new RemoteFile(localResource.getRepository(), localResource.getUrl(), revision);
((RemoteFile) remoteFile).setPegRevision(revision);
SVNLocalCompareInput compareInput = new SVNLocalCompareInput(localResource, remoteFile);
ShowDifferencesAsUnifiedDiffOperationWC operation = null;
if (SVNRevision.HEAD.equals(revision)) {
File file = File.createTempFile("revision", ".diff");
file.deleteOnExit();
operation = new ShowDifferencesAsUnifiedDiffOperationWC(getTargetPart(), localResource.getFile(), localResource.getUrl(), SVNRevision.HEAD, file);
operation.setGraphicalCompare(true);
operation.run();
}
compareInput.setDiffOperation(operation);
CompareUI.openCompareEditorOnPage(compareInput, getTargetPage());
}
}
} catch (Exception e) {
handle(e, null, null);
}
}
}, false, /* cancelable */
PROGRESS_BUSYCURSOR);
} catch (Exception e) {
handle(e, null, null);
}
}
use of org.tigris.subversion.subclipse.ui.compare.SVNLocalCompareInput in project subclipse by subclipse.
the class ResolveTreeConflictWizard method performFinish.
public boolean performFinish() {
if (mainPage.getReplace()) {
mergeException = null;
try {
BusyIndicator.showWhile(Display.getDefault(), new Runnable() {
public void run() {
try {
svnClient = svnResource.getRepository().getSVNClient();
File file = svnResource.getResource().getLocation().toFile();
svnClient.remove(new File[] { file }, true);
SVNUrl url = new SVNUrl(treeConflict.getConflictDescriptor().getSrcRightVersion().getReposURL() + "/" + treeConflict.getConflictDescriptor().getSrcRightVersion().getPathInRepos());
SVNRevision revision;
int index = treeConflict.getConflictDescriptor().getSrcRightVersion().toString().lastIndexOf(// $NON-NLS-1$
"@");
if (index == -1) {
revision = SVNRevision.HEAD;
} else {
long number = Long.parseLong(treeConflict.getConflictDescriptor().getSrcRightVersion().toString().substring(index + 1));
revision = new SVNRevision.Number(number);
}
svnClient.copy(url, file, revision);
} catch (Exception e) {
mergeException = e;
}
}
});
if (mergeException != null) {
SVNUIPlugin.log(IStatus.ERROR, mergeException.getMessage(), mergeException);
MessageDialog.openError(getShell(), Messages.ResolveTreeConflictWizard_2, mergeException.getMessage());
return false;
}
svnResource.getResource().refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
} catch (Exception e) {
SVNUIPlugin.log(IStatus.ERROR, e.getMessage(), e);
MessageDialog.openError(getShell(), Messages.ResolveTreeConflictWizard_2, e.getMessage());
return false;
}
return true;
}
compare = mainPage.getCompare();
if (mainPage.getMergeFromRepository()) {
try {
final SVNUrl url = new SVNUrl(mainPage.getMergeFromUrl());
SVNRevision revision1;
if (treeConflict.getConflictDescriptor().getSrcLeftVersion().getPegRevision() == treeConflict.getConflictDescriptor().getSrcRightVersion().getPegRevision())
revision1 = new SVNRevision.Number(treeConflict.getConflictDescriptor().getSrcLeftVersion().getPegRevision() - 1);
else
revision1 = new SVNRevision.Number(treeConflict.getConflictDescriptor().getSrcLeftVersion().getPegRevision());
final SVNRevision revision2 = new SVNRevision.Number(treeConflict.getConflictDescriptor().getSrcRightVersion().getPegRevision());
if (treeConflict.getConflictDescriptor().getSrcLeftVersion().getPegRevision() == treeConflict.getConflictDescriptor().getSrcRightVersion().getPegRevision())
revision1 = new SVNRevision.Number(treeConflict.getConflictDescriptor().getSrcLeftVersion().getPegRevision() - 1);
final IResource mergeTarget = mainPage.getMergeTarget();
final SVNRevision rev1 = revision1;
svnClient = svnResource.getRepository().getSVNClient();
mergeException = null;
BusyIndicator.showWhile(Display.getDefault(), new Runnable() {
public void run() {
try {
mergePath = mergeTarget.getLocation().toFile();
svnClient.merge(url, rev1, url, revision2, mergePath, true, false, false, true);
try {
// Refresh the resource after merge
if (mergeTarget.getParent() != null)
mergeTarget.getParent().refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
else
mergeTarget.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
} catch (CoreException e1) {
}
} catch (Exception e) {
mergeException = e;
}
}
});
if (mergeException != null) {
SVNUIPlugin.log(IStatus.ERROR, mergeException.getMessage(), mergeException);
MessageDialog.openError(getShell(), Messages.ResolveTreeConflictWizard_mergeError, mergeException.getMessage());
return false;
}
} catch (Exception e) {
SVNUIPlugin.log(IStatus.ERROR, e.getMessage(), e);
MessageDialog.openError(getShell(), Messages.ResolveTreeConflictWizard_mergeError, e.getMessage());
return false;
} finally {
svnResource.getRepository().returnSVNClient(svnClient);
}
}
if (mainPage.getCompare()) {
if (mainPage.getCompareResource2() == null) {
ISVNLocalResource svnCompareResource = mainPage.getSvnCompareResource();
if (svnCompareResource == null)
svnCompareResource = svnResource;
ISVNRemoteResource remoteResource = mainPage.getRemoteResource();
try {
// $NON-NLS-1$ //$NON-NLS-2$
File file = File.createTempFile("revision", ".diff");
file.deleteOnExit();
File path = new File(svnCompareResource.getResource().getLocation().toString());
SVNUrl toUrl = remoteResource.getUrl();
SVNRevision toRevision = remoteResource.getRevision();
ShowDifferencesAsUnifiedDiffOperationWC operation = new ShowDifferencesAsUnifiedDiffOperationWC(targetPart, path, toUrl, toRevision, file);
SVNLocalCompareInput compareInput = new SVNLocalCompareInput(svnCompareResource, remoteResource);
compareInput.setDiffOperation(operation);
CompareUI.openCompareEditorOnPage(compareInput, targetPart.getSite().getPage());
CompareCloseListener closeListener = new CompareCloseListener(Messages.ResolveTreeConflictWizard_compare + svnCompareResource.getName() + // $NON-NLS-1$
" <workspace>");
targetPart.getSite().getPage().addPartListener(closeListener);
} catch (Exception e) {
SVNUIPlugin.log(IStatus.ERROR, e.getMessage(), e);
MessageDialog.openError(getShell(), Messages.ResolveTreeConflictWizard_compareError, e.getMessage());
return false;
}
} else {
ISelection selection = new IStructuredSelection() {
public Object getFirstElement() {
return mainPage.getCompareResource1();
}
public Iterator iterator() {
return toList().iterator();
}
public int size() {
return 2;
}
public Object[] toArray() {
IResource[] compareResources = { mainPage.getCompareResource1(), mainPage.getCompareResource2() };
return compareResources;
}
public List toList() {
List compareList = new ArrayList();
compareList.add(mainPage.getCompareResource1());
compareList.add(mainPage.getCompareResource2());
return compareList;
}
public boolean isEmpty() {
return false;
}
};
CompareAction compareAction = new CompareAction();
compareAction.setActivePart(null, targetPart);
IAction action = new Action() {
};
compareAction.selectionChanged(action, selection);
compareAction.run(selection);
CompareCloseListener closeListener = new CompareCloseListener(Messages.ResolveTreeConflictWizard_compare2 + mainPage.getCompareResource1().getName() + "' - '" + mainPage.getCompareResource2().getName() + // $NON-NLS-1$ //$NON-NLS-2$
"')");
targetPart.getSite().getPage().addPartListener(closeListener);
}
}
if (mainPage.getRevertResource() != null) {
revertException = null;
BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
public void run() {
try {
IResource[] revertResources = { mainPage.getRevertResource() };
RevertResourcesCommand revertCommand = new RevertResourcesCommand(svnResource.getWorkspaceRoot(), revertResources);
revertCommand.run(new NullProgressMonitor());
} catch (Exception e) {
revertException = e;
}
}
});
if (revertException != null) {
SVNUIPlugin.log(IStatus.ERROR, revertException.getMessage(), revertException);
MessageDialog.openError(getShell(), Messages.ResolveTreeConflictWizard_revertError, revertException.getMessage());
return false;
}
}
if (mainPage.getDeleteResource() != null) {
try {
mainPage.getDeleteResource().delete(true, new NullProgressMonitor());
} catch (CoreException e) {
SVNUIPlugin.log(IStatus.ERROR, e.getMessage(), e);
MessageDialog.openError(getShell(), Messages.ResolveTreeConflictWizard_deleteError, e.getMessage());
return false;
}
}
if (mainPage.getMarkResolved() || mainPage.refreshConflicts()) {
try {
if (mainPage.getMarkResolved()) {
IResource[] resolvedResources = { treeConflict.getResource() };
ResolveOperation resolveOperation = new ResolveOperation(targetPart, resolvedResources, ISVNConflictResolver.Choice.chooseMerged) {
protected boolean canRunAsJob() {
return false;
}
};
resolveOperation.run();
}
if (mainPage.refreshConflicts()) {
IResource[] refreshResources = { svnResource.getResource() };
TreeConflictsView.refresh(refreshResources);
}
} catch (Exception e) {
SVNUIPlugin.log(IStatus.ERROR, e.getMessage(), e);
MessageDialog.openError(getShell(), Messages.ResolveTreeConflictWizard_markResolvedError, e.getMessage());
return false;
}
}
return true;
}
Aggregations