Skip to content

Commit

Permalink
Deduplicate launch configs
Browse files Browse the repository at this point in the history
The same launch config might be returned by multiple
LaunchShortcutExtension and is then shown twice.

This simply filter items that where already seen to deduplicate such
entries.

Fix eclipse-platform#527
  • Loading branch information
laeubi committed Nov 2, 2023
1 parent 4fd12ad commit 0a9a954
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

import org.eclipse.core.expressions.Expression;
import org.eclipse.core.expressions.IEvaluationContext;
Expand Down Expand Up @@ -280,9 +282,12 @@ protected void fillMenu(Menu menu) {
}
}
// now add collected launches
Set<ILaunchConfiguration> added = new HashSet<>();
for (Entry<LaunchShortcutExtension, ILaunchConfiguration[]> entry : launchConfigurations.entrySet()) {
for (ILaunchConfiguration configuration : entry.getValue()) {
populateMenuItem(fMode, entry.getKey(), menu, configuration, accelerator++, null);
if (added.add(configuration)) {
populateMenuItem(fMode, entry.getKey(), menu, configuration, accelerator++, null);
}
}
}

Expand Down

0 comments on commit 0a9a954

Please sign in to comment.