diff options
author | Michael Valenta | 2003-08-21 20:49:09 +0000 |
---|---|---|
committer | Michael Valenta | 2003-08-21 20:49:09 +0000 |
commit | b1334a23e7e909395988c4f1316cf22ce4d9de80 (patch) | |
tree | c06be6df9f4263109e37ee765c8d80aaa5edb5cb | |
parent | 883922a4778383673a81a911cf2a6b3cb6377fef (diff) | |
download | eclipse.platform.team-b1334a23e7e909395988c4f1316cf22ce4d9de80.tar.gz eclipse.platform.team-b1334a23e7e909395988c4f1316cf22ce4d9de80.tar.xz eclipse.platform.team-b1334a23e7e909395988c4f1316cf22ce4d9de80.zip |
Abort comparison if caching of contents failes
-rw-r--r-- | bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/OpenInCompareAction.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/OpenInCompareAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/OpenInCompareAction.java index 546439888..364d12b96 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/OpenInCompareAction.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/OpenInCompareAction.java @@ -54,7 +54,7 @@ public class OpenInCompareAction extends Action { private void openEditor() { CompareEditorInput input = getCompareInput(); if(input != null) { - prefetchFileContents(); + if (!prefetchFileContents()) return; IEditorPart editor = reuseCompareEditor((SyncInfoCompareInput)input); if(editor != null && editor instanceof IReusableEditor) { CompareUI.openCompareEditor(input); @@ -71,13 +71,14 @@ public class OpenInCompareAction extends Action { /* * Prefetching the file contents will cache them for use by the compare editor */ - private void prefetchFileContents() { + private boolean prefetchFileContents() { ISelection selection = viewer.getViewer().getSelection(); Object obj = ((IStructuredSelection)selection).getFirstElement(); SyncInfo info = getSyncInfo(obj); final IRemoteResource remote = info.getRemote(); final IRemoteResource base = info.getBase(); if (remote != null || base != null) { + final boolean[] ok = new boolean[] { true }; viewer.run(new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { @@ -88,13 +89,17 @@ public class OpenInCompareAction extends Action { base.getContents(Policy.subMonitorFor(monitor, 100)); monitor.done(); } catch (TeamException e) { + ok[0] = false; + // The sync viewer will show the error to the user so we need only abort the action throw new InvocationTargetException(e); } } }); + return ok[0]; } + return true; } - + private CompareEditorInput getCompareInput() { ISelection selection = viewer.getViewer().getSelection(); Object obj = ((IStructuredSelection)selection).getFirstElement(); |