Skip to content

Commit 747fb4e

Browse files
committed
ModuleSearchResult: format menu paths consistently
1 parent 49162d6 commit 747fb4e

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/main/java/org/scijava/search/module/ModuleSearchResult.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ public ModuleSearchResult(final ModuleInfo info, final String baseDir) {
5555

5656
props = new LinkedHashMap<>();
5757
final MenuPath menuPath = info.getMenuPath();
58-
if (menuPath != null) {
59-
props.put("Menu path", menuPath.getMenuString(false));
58+
if (menuPath != null && !menuPath.isEmpty()) {
59+
props.put("Menu path", getMenuPath(false));
6060
final MenuEntry menuLeaf = menuPath.getLeaf();
6161
if (menuLeaf != null) {
6262
final Accelerator accelerator = menuLeaf.getAccelerator();
@@ -80,8 +80,7 @@ public String name() {
8080

8181
@Override
8282
public String identifier() {
83-
final String menuPath = info.getMenuPath().getMenuString().replace(">",
84-
"\u203a");
83+
final String menuPath = getMenuPath(true);
8584
return menuPath.isEmpty() ? name() : menuPath;
8685
}
8786

@@ -110,4 +109,10 @@ private String getLocation() {
110109
}
111110
return path;
112111
}
112+
113+
private String getMenuPath(boolean includeLeaf) {
114+
final MenuPath menuPath = info.getMenuPath();
115+
if (menuPath == null) return "";
116+
return menuPath.getMenuString(includeLeaf).replace(">", "\u203a");
117+
}
113118
}

0 commit comments

Comments
 (0)