Skip to content

Commit

Permalink
More work on #2967. Previous solution was actually not working.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexisDrogoul committed Apr 27, 2021
1 parent 93941a9 commit 59dd46b
Showing 1 changed file with 10 additions and 2 deletions.
Expand Up @@ -44,6 +44,7 @@
import ummisco.gama.ui.resources.GamaColors;
import ummisco.gama.ui.resources.GamaIcons;
import ummisco.gama.ui.resources.IGamaIcons;
import ummisco.gama.ui.utils.PlatformHelper;
import ummisco.gama.ui.utils.SwtGui;

public class AgentsMenu extends ContributionItem {
Expand Down Expand Up @@ -311,14 +312,21 @@ public static void fillPopulationSubMenu(final Menu menu, final Collection<? ext
cascadingAgentMenuItem(menu, agent, agent.getName(), actions);
}
} else {
final int nb = size / subMenuSize + 1;
int nb = size / subMenuSize + 1;
if (PlatformHelper.isWindows()) {
// See Issue #2967
if (nb > 90) {
// Absolutely no idea about the reality of this hard-coded limit
nb = 90;
subMenuSize = size / nb;
}
}
for (int i = 0; i < nb; i++) {
final int begin = i * subMenuSize;
final int end = Math.min((i + 1) * subMenuSize, size);
if (begin >= end) { break; }
try {
final MenuItem rangeItem = new MenuItem(menu, SWT.CASCADE);

final Menu rangeMenu = new Menu(rangeItem);
rangeItem.setMenu(rangeMenu);
rangeItem.setText("" + begin + " to " + (end - 1));
Expand Down

0 comments on commit 59dd46b

Please sign in to comment.