sclass G22NetworksFromAllDBsPanel { 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; table.itemToMap = script -> litorderedmap( "Network" := script.description, "Project" := fileName(networkToDBDir(script)), "ID in original project" := str(script.id), ); var tbl = table.visualize(); rstUpdate!; tablePopupMenuItem_top(table.table, "Open project", rThread { g22utils.masterStuff.openDatabase(table.selected()._concepts.conceptsDir()); }); tablePopupMenuItem_top(table.table, "Import network", rThread { var network = table.selected(); var clonedNetwork = (G22Network) g22utils.restructure(network); registerConcept(g22utils.concepts(), clonedNetwork); g22utils.projectActions().openObjectInProject(clonedNetwork.id); }); table.onSelect(network -> { if (network == null) scpDetail.clear(); else { scpDetail.set(makeDetailView(network)); } }); ret withTopAndBottomMargin(jCenteredRaisedSection("Networks from all projects", jvsplit(tbl, scpDetail))); } JComponent makeDetailView(G22Network network) { ret JG22Network(g22utils, network).visualize(); } File networkToDBDir(G22Network network) { ret network == null ?: network._concepts.conceptsDir(); } 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, G22Network); }))); } }