diff --git a/team/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java b/team/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java index 52ef72f1ba1..99a089aa5de 100644 --- a/team/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java +++ b/team/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java @@ -824,14 +824,18 @@ private UnifiedDiffSource prepareUnifiedDiff(CompareEditorInput input, IProgress || !(right instanceof IStreamContentAccessor rightSource)) { return null; } - // The side that is not shown in the editor supplies the diff source, so it is - // read here instead of on the UI thread. + // The overlay needs a workspace file to sit on; an editor opened on anything + // else, a revision for example, comes up empty. The other side supplies the + // diff source and is read here rather than on the UI thread. if (leftEditorInput instanceof IFileEditorInput) { return new UnifiedDiffSource(compareInput, leftEditorInput, left, UnifiedDiffMode.REVERT_MODE, getSourceOf(rightSource)); } - return new UnifiedDiffSource(compareInput, rightEditorInput, right, UnifiedDiffMode.OVERLAY_READ_ONLY_MODE, - getSourceOf(leftSource)); + if (rightEditorInput instanceof IFileEditorInput) { + return new UnifiedDiffSource(compareInput, rightEditorInput, right, UnifiedDiffMode.OVERLAY_READ_ONLY_MODE, + getSourceOf(leftSource)); + } + return null; } private static IEditorInput documentKeyOf(ITypedElement element) {