sclass SavedSessions extends Module { transient SS sessions; transient JTable table; transient new Var changed; void start { sessions = new FileBasedStringMap(javaxSavedSessionsDir()); } void triggerUpdate { changed.set(true); super.triggerUpdate(); } JComponent visualize() { table = sexyTable(); VF1 restore = voidfunc(int row) { S name = (S) getTableCell(table, row, 0); S text = sessions.get(name); if (text != null) restoreModulesSession(text); }; tablePopupMenuItemsThreaded(table, "Restore", restore); onDoubleClickThreaded(table, restore); triggerUpdate(); ret centerAndSouthWithMargins(table, jbutton("Save session...", r { inputText("Save session as", voidfunc(S name) { fS text = modulesSessionGrab(); sessions.put(or2(trim(name), "Unnamed Session") + " [" + localDateWithSeconds() + ", " + computerID() + ", OS: " + programID() + "]", text); triggerUpdate(); }); })); } void unvisualize2() { table = null; } void update() { if (atomicFlipVarToFalse(changed)) dataToTable_uneditable(table, listToMapsWithSingleKey("Session Name", sortedKeys(sessions))); } }