Skip to content

Commit

Permalink
Clean up code in findEditorLinkedDescriptors()
Browse files Browse the repository at this point in the history
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
  • Loading branch information
iloveeclipse committed Jul 2, 2024
1 parent b3e6786 commit 0f64336
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1118,12 +1118,11 @@ private static void ensureTextIsLast(LinkedHashSet<ViewerDescriptor> result) {
*/
Set<ViewerDescriptor> findEditorLinkedDescriptors(String fileName, IContentType contentType,
boolean firstIsEnough) {
if (fileName == null) {
if (contentType == null) {
contentType = fgContentTypeManager.findContentTypeFor(fileName);
} else {
return Collections.emptySet();
}
if (fileName == null && contentType == null) {
return Collections.emptySet();
}
if (contentType == null) {
contentType = fgContentTypeManager.findContentTypeFor(fileName);
}

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

0 comments on commit 0f64336

Please sign in to comment.