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).

!752

static JTable tbl;
static int delay = 3000;

p-substance {
  tbl = showTable("All Injections");
  tablePopupMenu(tbl, voidfunc(JPopupMenu menu, final int row) {
    menu.add(jmenuItem("Kill VM", r {
      S port = str(getTableLineAsMap(tbl, row).get("VM"));
      if (isInteger(port))
        killVM(parseInt(port));
    }));
  });
  installTimer(tbl, runnable { updateList(); }, delay, 0);
  hideConsole();
}

static new MonoThread update;

static void updateList() {
  update.run(r {
    new L l;
    for (DialogIO vm : talkToAllVMs()) {
      pcall {
        int vmPort = vm.getPort();
        S x = vm.ask("get injections");
        print("VM " + vmPort + " injections: " + x);
        L injections = cast safeUnstructure(x);

        for (O inj : injections) {
          S progID = formatSnippetID((S) get(inj, "progID"));
          l.add(litorderedmap(
            "Program name", getSnippetTitle(progID),
            "Program ID", progID,
            "VM", vmPort,
            "Injection ID", get(inj, "injectionID"),
            "More info", (boolean) get(inj, "mainDone") ? "main done" : "main running"));
        }
      }
      vm.close();
    }
    
    dataToTable(tbl, l);
    setFrameTitle(tbl, n(countDistinct(l, "VM"), "VMs") + " / " + n(l(l), "injections"));
  });
}

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: 577 / 1956
Referenced in: [show references]