Libraryless. Click here for Pure Java version (21718L/142K).
1 | svoid dm_stefansAssistant_offerSFOnSnippetCreated() { |
2 | DynModule mod = dm_current_mandatory(); |
3 | dm_onSnippetCreated(voidfunc(S snippetID) { |
4 | print("New snippet! " + snippetID); |
5 | if (!dm_hadUserActivityInLastNMinutes(1)) ret with print("No user activity, skipping popup dialog"); |
6 | |
7 | if (getSnippetType(snippetID) == snippetType_JavaXInclude()) { |
8 | S text = loadSnippet(snippetID); |
9 | S sfName = first(findFunctionDefsAtCurlyLevel(0, text)); |
10 | if (sfName != null) |
11 | // call activateFrame to bring window to foreground reliably on Windows? |
12 | disposeWindowAfter(30.0, /*activateFrameAndReturnComponent*/(showPackedFrameInBottomRightCorner( |
13 | centerAndSouthWithMargins(jlabel("Add standard function: " |
14 | + sfName + "?"), |
15 | hgridWithSpacing( |
16 | jThreadedButton("OK", r { |
17 | temp dm_enter(mod); |
18 | disposeWindow(heldInstance(JButton)); |
19 | addStandardFunctionWithAnimation(snippetID); |
20 | }), |
21 | jCancelButton("No") |
22 | ) |
23 | )))); |
24 | } |
25 | }); |
26 | } |
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1023194 |
Snippet name: | dm_stefansAssistant_offerSFOnSnippetCreated (if recent user activity) |
Eternal ID of this version: | #1023194/10 |
Text MD5: | 3d6ed96c9493fc30600da48ef4cd8b6f |
Transpilation MD5: | c469ebefcf9af04c4c71342303723821 |
Author: | stefan |
Category: | javax / stefan's os |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-02-10 00:20:14 |
Source code size: | 1110 bytes / 26 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 363 / 476 |
Version history: | 9 change(s) |
Referenced in: | [show references] |