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

47
LINES

< > BotCompany Repo | #1001744 // Swing: List VMs + injections

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (5456L/38K/125K).

1  
!752
2  
3  
static JTable tbl;
4  
static int delay = 3000;
5  
6  
p-substance {
7  
  tbl = showTable("All Injections");
8  
  tablePopupMenu(tbl, voidfunc(JPopupMenu menu, final int row) {
9  
    menu.add(jmenuItem("Kill VM", r {
10  
      S port = str(getTableLineAsMap(tbl, row).get("VM"));
11  
      if (isInteger(port))
12  
        killVM(parseInt(port));
13  
    }));
14  
  });
15  
  installTimer(tbl, runnable { updateList(); }, delay, 0);
16  
  hideConsole();
17  
}
18  
19  
static new MonoThread update;
20  
21  
static void updateList() {
22  
  update.run(r {
23  
    new L l;
24  
    for (DialogIO vm : talkToAllVMs()) {
25  
      pcall {
26  
        int vmPort = vm.getPort();
27  
        S x = vm.ask("get injections");
28  
        print("VM " + vmPort + " injections: " + x);
29  
        L injections = cast safeUnstructure(x);
30  
31  
        for (O inj : injections) {
32  
          S progID = formatSnippetID((S) get(inj, "progID"));
33  
          l.add(litorderedmap(
34  
            "Program name", getSnippetTitle(progID),
35  
            "Program ID", progID,
36  
            "VM", vmPort,
37  
            "Injection ID", get(inj, "injectionID"),
38  
            "More info", (boolean) get(inj, "mainDone") ? "main done" : "main running"));
39  
        }
40  
      }
41  
      vm.close();
42  
    }
43  
    
44  
    dataToTable(tbl, l);
45  
    setFrameTitle(tbl, n(countDistinct(l, "VM"), "VMs") + " / " + n(l(l), "injections"));
46  
  });
47  
}

Author comment

Began life as a copy of #1001720

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1001744
Snippet name: Swing: List VMs + injections
Eternal ID of this version: #1001744/1
Text MD5: c019b2193b34f013b83cfc712a49a887
Transpilation MD5: 9f3670da32bec35cfbb917cfce7e68ca
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-12-03 18:30:04
Source code size: 1336 bytes / 47 lines
Pitched / IR pitched: No / No
Views / Downloads: 517 / 1881
Referenced in: [show references]