Skip to content

Commit 0f64336

Browse files
committed
Clean up code in findEditorLinkedDescriptors()
As noted on PR #1277, the code looks weird and I can't explain what I smoke while writing it. Fixed the code to do what actually was meant. This is mostly paranoia code, as usually input.getName() is not null. See #1277 See eclipse-platform/eclipse.platform.ui#1747
1 parent b3e6786 commit 0f64336

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

team/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,12 +1118,11 @@ private static void ensureTextIsLast(LinkedHashSet<ViewerDescriptor> result) {
11181118
*/
11191119
Set<ViewerDescriptor> findEditorLinkedDescriptors(String fileName, IContentType contentType,
11201120
boolean firstIsEnough) {
1121-
if (fileName == null) {
1122-
if (contentType == null) {
1123-
contentType = fgContentTypeManager.findContentTypeFor(fileName);
1124-
} else {
1125-
return Collections.emptySet();
1126-
}
1121+
if (fileName == null && contentType == null) {
1122+
return Collections.emptySet();
1123+
}
1124+
if (contentType == null) {
1125+
contentType = fgContentTypeManager.findContentTypeFor(fileName);
11271126
}
11281127

11291128
LinkedHashSet<ViewerDescriptor> viewers = fContentMergeViewers.getAll().stream()

0 commit comments

Comments
 (0)