Skip to content

Commit 98ff46d

Browse files
committed
Merge pull request #77 from scijava/suppress-warning
Only warn about duplicate menu entries if priorities are equal
2 parents b80e7a0 + 12b1bea commit 98ff46d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/main/java/org/scijava/menu/ShadowMenu.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -530,8 +530,15 @@ private ShadowMenu addChild(final ModuleInfo info, final int depth) {
530530
if (!leaf) child.addChild(info, depth + 1);
531531
else if (existingChild != null) {
532532
if (log != null) {
533-
log.warn("ShadowMenu: menu item already exists:\n\texisting: " +
534-
existingChild.getModuleInfo() + "\n\t ignored: " + info);
533+
if (info.getPriority() == existingChild.getModuleInfo().getPriority()) {
534+
log.warn("ShadowMenu: menu item already exists:\n\texisting: " +
535+
existingChild.getModuleInfo() + "\n\t ignored: " + info);
536+
}
537+
else {
538+
log.debug("ShadowMenu: higher-priority menu item already exists:\n" +
539+
"\texisting: " + existingChild.getModuleInfo() + "\n\t ignored: " +
540+
info);
541+
}
535542
}
536543
}
537544
return child;

0 commit comments

Comments
 (0)