sclass G22ScriptsFromAllDBsPanel { G22Utils g22utils; // Each script is registered to a non-persistent Concepts object // loaded temporarily but connected to the appropriate db dir JObjectTable table; ReliableSingleThread rstUpdate = new(r _updateTable); transient SingleComponentPanel scpDetail = singleComponentPanel(); *(G22Utils *g22utils) {} visualize { table = new JObjectTable; swap method table.itemToMap(script) to { ret joinMaps(litorderedmap( "Project" := fileName(scriptToDBDir(script)), "ID" := str(script.id)), g22utils.scriptToMap(script)); } var tbl = table.visualize(); rstUpdate!; tablePopupMenuItem_top(table.table, "Open database", rThread { g22utils.masterStuff.openDatabase(table.selected()._concepts.conceptsDir()); }); table.onSelect(script -> { if (script == null) scpDetail.clear(); else { var tabs = jtabs(); S editedText = script.editedText(); if (editedText != null) addTab(tabs, "Editing", makeDisabledTextArea(editedText)); if (script.text != null) addTab(tabs, "Saved", makeDisabledTextArea(script.text)); S codeForAutoRun = script.codeForAutoRun(); if (codeForAutoRun != null) addTab(tabs, "Clear for auto-run", makeDisabledTextArea(codeForAutoRun)); scpDetail.set(tabs); } }); ret withTopAndBottomMargin(jCenteredRaisedSection("Scripts from all databases", jvsplit( withRightAlignedButtons(tbl, "Show all scripts as one long text", rThread showHugeText, ), scpDetail))); } File scriptToDBDir(G22LeftArrowScript script) { ret script == null ?: script._concepts.conceptsDir(); } JComponent makeDisabledTextArea(S text) { var ta = g22utils.newSyntaxTextArea(); ta.setText(text); uneditableBlack(ta.textArea()); ret ta.visualize(); } void _updateTable { table.setData_force(concatLists( mapCloseables_pcall(g22utils.peekAllProjectsConcepts(), cc -> list(cc, G22LeftArrowScript)))); } S makeHugeText() { ret g22utils.evalRegisteredCode("Make text from all scripts", -> { rstUpdate.waitUntilDone(); ret new G22ScriptUtil(g22utils).makeHugeText(table.getList()); }); } void showHugeText { S text = makeHugeText(); showFrame("Scripts from all DBs", g22utils.newSyntaxTextArea(text)); } }