Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

45
LINES

< > BotCompany Repo | #1006326 // jInjectionsTable

JavaX fragment (include)

1  
static int jInjectionsTable_updateInterval = 3000;
2  
3  
static JTable jInjectionsTable() {
4  
  final JTable tbl = sexyTable();
5  
  
6  
  tablePopupMenu(tbl, voidfunc(JPopupMenu menu, final Int row) {
7  
    final int port = parseIntOpt(str(getTableLineAsMap(tbl, row).get("VM")));
8  
    if (port != 0) {
9  
      addMenuItem(menu, "Kill VM", r-thread { killVM(port) });
10  
      addMenuItem(menu, "Restart Program", r-thread { restartVM(port) });
11  
      addMenuItem(menu, "Show VM Output", r-thread {
12  
        thread "Show VM Output" {
13  
          showText("Output of VM " + port, unquote(sendToLocalBot(port, "get output")));
14  
        }
15  
      });
16  
      addMenuItem(menu, "Hide VM", r-thread {
17  
        send(port, "hidden vm yes")
18  
      });
19  
      addMenuItem(menu, "Un-Hide VM / Show Console", r-thread {
20  
        send(port, "show console");
21  
        send(port, "hidden vm no")
22  
      });
23  
      addMenuItem(menu, "Dump heap...", r {
24  
        inputFilePath("Dump heap to where?", new File(javaxCachesDir(), "heap.bin"), voidfunc(File f) {
25  
          pcall-messagebox {
26  
            assertOK(send(port, "dump heap to *", f2s(f)));
27  
            infoBox("Heap dumped to " + fileNamePlusMSize(f));
28  
            if (confirmOKCancel("Start jhat (heap analysis server running on localhost:7000)?")) {
29  
              nohupJavax("#1007494 " + f2s(f));
30  
              infoBox("Tried to start jhat.");
31  
            }
32  
          }
33  
        });
34  
      });
35  
      addMenuItem(menu, "Garbage Collect", r-thread {
36  
        send(port, "gc")
37  
      });
38  
    }
39  
  });
40  
  
41  
  awtCalcRegularly(tbl, jInjectionsTable_updateInterval, 0, r {
42  
    dataToTable(tbl, computerInjectionsData());
43  
  });
44  
  ret tbl;
45  
}

Author comment

Began life as a copy of #1001744

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1006326
Snippet name: jInjectionsTable
Eternal ID of this version: #1006326/21
Text MD5: ee66a79d4a052de21d0bc37e6ff5bc31
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-09-30 12:56:06
Source code size: 1680 bytes / 45 lines
Pitched / IR pitched: No / No
Views / Downloads: 507 / 497
Version history: 20 change(s)
Referenced in: [show references]