!7 DynTable > RecentlyDeletedModules { S moduleID; JComponent visualize() { JComponent c = super.visualize(); tablePopupMenuItemsThreaded(table, "Restore module", voidfunc(int row) { restore(row) }, "Show structure", voidfunc(int row) { showStructure(row) }); JTextField tfModuleID = jLiveValueTextField_bothWays(dm_fieldLiveValue('moduleID)); onEnter(tfModuleID, r actualUpdate); ret northAndCenter( centerAndEastWithMargin(withLabel("Module ID:", tfModuleID), jbutton("Search", r actualUpdate)), c); } L calc() { ret data; } void actualUpdate { temp enter(); setField(data := actualCalc(); } L actualCalc() { if (empty(moduleID)) null; print("Searching for deleted modules of type " + moduleID); ret reversed(map(scanLog_iterator(deletedModulesLogFile(moduleID)), func(S structure) -> Map { O mod = safeUnstructure(structure); // old layout: // "c DynamicModule(_className=\"main$TextArea\", created=1529499892012L, frameRect=Rect(h=66, w=130, x=618, y=339), id=384L, moduleID=\"#1016122\", on=t, visible=t)" // new layout: // "hm{deleted=123L, module := c DynamicModule(...)}" long deleted = 0; if (mod instanceof Map) { deleted = toLong(mod/Map.get("deleted")); mod = mod/Map.get("module"); } S className = dynShortName(mod); if (eq(className, "DynamicModule")) className = shortenClassName(getString(mod, '_className)); ret litorderedmap( "Module ID" := joinNempties("/", getString(mod, 'moduleID), className), //"Created" := formatLocalDateWithMinutes(getOptLong(mod, 'created)), "Deleted" := formatLocalDateWithMinutes(deleted), "Data Size" := toK(l(structure)) + " K", "[hidden] md5" := md5(structure)); })); } S findStructure(int row) { Map map = get(data, row); if (map == null) null; S md5 = (S) map.get("[hidden] md5"); for (S structure : scanLog_iterator(deletedModulesLogFile(moduleID))) { if (!eq(md5(structure), md5)) continue; print("Found row"); ret structure; } null; } void restore(int row) { S structure = findStructure(row); if (structure == null) ret; callCreator('restoreModule, structure); } void showStructure(int row) { S structure = findStructure(row); if (structure == null) ret; //dm_showNewTextArea(); showWrappedText("Deleted Module Structure", structure); } }