sclass G22ScriptsFromAllDBsPanel { G22Utils g22utils; JObjectTable table; ReliableSingleThread rstUpdate = new(r _updateTable); transient SingleComponentPanel scpDetail = singleComponentPanel(); *(G22Utils *g22utils) {} visualize { table = swing(-> new JObjectTable); table.itemToMap = script -> joinMaps(litorderedmap( "DB" := fileName(script._concepts.conceptsDir()), "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(tbl, scpDetail))); } JComponent makeDisabledTextArea(S text) { ret visibleCaretOnDisabledTextArea(jDisabledTextArea_noUndo(text)); } void _updateTable { table.setData_force(concatLists( map_pcall(g22utils.gazelleDBs(), db -> { var classFinder = g22utils.masterStuff.makeClassFinder(); var cc = newConceptsWithClassFinder(db.conceptsFile(), classFinder); cc.loadFromDisk(); ret list(cc, G22LeftArrowScript); }))); } }