Skip to content

Commit

Permalink
Avoid duplicate quick access entry (fixes eclipse-platform#152)
Browse files Browse the repository at this point in the history
When you have used quick access previously, the dialog adds matching
entries from "previous" at the top. Afterwards the same entries may
appear from their "normal" provider (e.q. views, commands, ...).

Since the logic of adding entries seems quite complex, this change fixes
the duplicate entry by detecting the exact situation (same single entry
in first and second provider list), and then removes the duplicate entry
list.
  • Loading branch information
Bananeweizen committed Jun 17, 2022
1 parent 22c3963 commit 090dfb3
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,14 @@ public IStatus runInUIThread(IProgressMonitor monitor) {
QuickAccessEntry.MATCH_PERFECT)));
}
res.addAll(entriesPerProvider.values());

// if one category provides the same single entry like "previous", we can avoid
// showing the duplicate second list
if (res.size() >= 2 && res.get(0).size() == 1 && res.get(1).size() == 1
&& (res.get(0).get(0).element.equals(res.get(1).get(0).element))) {
res.remove(1);
}

return (List<QuickAccessEntry>[]) res.toArray(new List<?>[res.size()]);
}

Expand Down

0 comments on commit 090dfb3

Please sign in to comment.