Uses 911K of libraries. Click here for Pure Java version (5262L/27K).
1 | !7 |
2 | |
3 | compact module ListMethodsOfActiveModule > DynTextArea { |
4 | transient O module; |
5 | transient JButton btnCall; |
6 | |
7 | void start { |
8 | dm_updateMeOnNewActiveModule(); |
9 | } |
10 | |
11 | S methodToCall() { |
12 | S s = trim(lineAtCaret(textArea)), m; |
13 | ret endsWith(s, "!") && isIdentifier(m = dropLast(s)) ? m : null; |
14 | } |
15 | |
16 | JComponent visualize() { |
17 | JComponent c = super.visualize(); |
18 | onCaretAndNow(textArea, r { |
19 | S m = methodToCall(); |
20 | setEnabledAndText(btnCall, m != null, m != null ? "Call method " + singleQuote(m) : "Move cursor to call a method"); |
21 | }); |
22 | ret centerAndSouth(c, |
23 | withMargin(jcenteredline(btnCall = jbutton("Call method", r-thread { |
24 | S m = methodToCall(); |
25 | if (m != null) { |
26 | print("Calling method " + m + " on " + module); |
27 | call(module, m); |
28 | } |
29 | })))); |
30 | } |
31 | |
32 | void update { |
33 | O _m = dm_activeModule(); |
34 | if (dm_isOtherModule(_m) && setField(module := _m)) { |
35 | setText("Active Module: " + dm_moduleName(module) + "\n"); |
36 | new StringBuilder buf; |
37 | L<Method> l = allLiveMethods_skipOverridden_sortByNameWithinClass(module); |
38 | new L<S> lines; |
39 | Class c = null; |
40 | for (Method m : l) { |
41 | if (m.getDeclaringClass() != c) { |
42 | c = m.getDeclaringClass(); |
43 | lines.add("\nclass " + shortClassName(c) + "\n"); |
44 | } |
45 | Class<?>[] args = m.getParameterTypes(); |
46 | Class<?> returns = m.getReturnType(); |
47 | lines.add(" " + m.getName() + |
48 | (typeIsVoid(returns) && empty(args) ? "!" |
49 | : trim(": " + joinWithComma(shortClassNames(args))) + " -> " + shortClassName(returns)); |
50 | } |
51 | setText(getText() + lines(lines)); |
52 | } |
53 | } |
54 | } |
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1016490 |
Snippet name: | List methods of active module |
Eternal ID of this version: | #1016490/34 |
Text MD5: | b30bb2c823a6c69367f8a50283e56020 |
Transpilation MD5: | 778071d18ad30fb7d929f8666460975a |
Author: | stefan |
Category: | javax / stefan's os |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-01-09 23:04:55 |
Source code size: | 1737 bytes / 54 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 587 / 6575 |
Version history: | 33 change(s) |
Referenced in: | [show references] |