/** Builds the master list of available commands. */ private List<ModuleInfo> buildCommands(final ModuleService moduleService) { final List<ModuleInfo> list = new ArrayList<>(); list.addAll(moduleService.getModules()); Collections.sort(list); return list; }
/** Initializes {@link #rootMenus}. */ private synchronized void initRootMenus() { if (rootMenus != null) return; final HashMap<String, ShadowMenu> map = new HashMap<>(); final List<ModuleInfo> allModules = moduleService.getModules(); addModules(allModules, map); rootMenus = map; }
/** Initializes {@link #rootMenus}. */ private synchronized void initRootMenus() { if (rootMenus != null) return; final HashMap<String, ShadowMenu> map = new HashMap<>(); final List<ModuleInfo> allModules = moduleService.getModules(); addModules(allModules, map); rootMenus = map; }
@Override public List<SearchResult> search(final String text, final boolean fuzzy) { if (text.isEmpty()) return Collections.emptyList(); final String baseDir = // appService.getApp().getBaseDirectory().getAbsolutePath(); final LinkedHashSet<ModuleInfo> matches = new LinkedHashSet<>(); // Get the list of all modules for consideration. final List<ModuleInfo> modules = moduleService.getModules().stream() // .filter(this::isGoodModule) // .collect(Collectors.toList()); final String textLower = text.toLowerCase(); // First, add modules where title starts with the text. modules.stream() // .filter(info -> startsWith(info, textLower) ) // .forEach(matches::add); // Next, add modules where title has text inside somewhere. modules.stream() // .filter(info -> hasSubstring(info, textLower)) // .forEach(matches::add); // Finally, add modules where menu path has text inside somewhere. modules.stream() // .filter(info -> hasSubstring(info, textLower)) // .forEach(matches::add); // Wrap each matching ModuleInfo in a ModuleSearchResult. return matches.stream() // .map(info -> new ModuleSearchResult(info, baseDir)) // .collect(Collectors.toList()); }
void addModuleCompletions(ModuleService moduleService) { if (this.moduleService == moduleService) { return; } this.moduleService = moduleService; for (ModuleInfo info : moduleService.getModules()) { if(info.getMenuPath().getLeaf() != null) { String name = info.getMenuPath().getLeaf().getName().trim(); String headline = "run(\"" + name +"\")"; String description = "<b>" + headline + "</b><p>" + "<a href=\"https://imagej.net/Special:Search/" + name.replace(" ", "%20") + "\">Search imagej wiki for help</a>"; addCompletion(makeListEntry(this, headline, null, description)); } } } }
moduleService.getModules().stream() // .filter(info -> info.is("no-legacy")) // .collect(Collectors.toList());