Skip to content

Commit

Permalink
Avoid duplicate quick access entry (fixes #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 authored and akurtakov committed Mar 20, 2024
1 parent 0de600a commit 344f1d1
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,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 344f1d1

Please sign in to comment.