Uses 1113K of libraries. Click here for Pure Java version (12201L/61K).
!7 cmodule2 ServerModuleSearch > DynQuickSearch { Map<Long, RecommendedModule> recommendedModules; start { moduleDescForSearch = "Loadable"; dm_snippetsDB(); doEvery(5.0, 3600.0, r { setField(recommendedModules := mapKeys psI( (Map<S, RecommendedModule>) indexByField moduleID( stefansOS_parseRecommendedModulesList(mL("Recommended Modules")))); }); quickSearchParams = new O[] { defaultAction := voidfunc(fS s) enter { dm_addDynamicModuleDialog2(beforeSpace(s), true); dm_hideQuickSearchModules(); }, popupItems := new O[] { "Edit", voidfunc(S s) enter { dm_openSnippetInEditor(beforeSpace(s)); }, "Make New", voidfunc(S s) enter { dm_addDynamicModuleDialog2(beforeSpace(s), false); dm_hideQuickSearchModules(); }, "---", "Send to machine...", voidfunc(S s) enter { dm_sendModuleToOtherMachineDialog(beforeSpace(s)) } } }; } afterVisualize { listPopupMenuThreaded(list, (O[]) optPar(quickSearchParams, 'popupItems)); onDoubleClickOrEnterThreaded(list, (VF1<S>) optPar(quickSearchParams, 'defaultAction)); } L<S> calc_impl() { ret searchImpl(query); } L sortSnippets(L snippets) { ret sortByCalculatedFieldDesc(snippets, func(O snippet) -> Int { long id = getLong(snippet, 'snippetID); RecommendedModule rm = mapGet(recommendedModules, id); if (rm != null) ret rm.prio+1; S title = getString(snippet, 'title); ret contains(title, "dev.") ? -1 : 0; }); } // API LS searchImpl(S query) { L snippets = dm_dynModulesOnServer(); // L<CSnippet> snippets = sortSnippets(snippets); // TODO: don't do this every time ret scoredSearch_eachTerm(query, map(snippets, func(fO snippet) -> S { long id = getLong(snippet, 'snippetID); ret fsI(id) + " - " + (containsKey(recommendedModules, id) ? unicode_whiteStar() + " " : "") + _get(snippet, 'title); })); } }
Began life as a copy of #1016702
download show line numbers debug dex old transpilations
Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, hpgrupgrauku, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1016932 |
Snippet name: | Server Module Search [Dyn Module] |
Eternal ID of this version: | #1016932/57 |
Text MD5: | d98f3ae1e46d510c287e7a3c74293d70 |
Transpilation MD5: | d0bc2052963cc2655d081fed4c34ce10 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-01-05 13:45:35 |
Source code size: | 2129 bytes / 66 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 639 / 611828 |
Version history: | 56 change(s) |
Referenced in: | #1016478 - Stefan's OS v6 #1019999 - Local Programs Search [Dyn Module] #1022729 - Stefan's OS v6 - copy for transpiler test #1024922 - programPackager_standardExcludedSnippets #1024932 - Stefan's OS v7 [LIVE] #1026752 - dm_requireServerModuleSearch #1031320 - Stefan's OS v7 [backup before allowing dynamic main classes] |