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

26
LINES

< > BotCompany Repo | #1023194 // dm_stefansAssistant_offerSFOnSnippetCreated (if recent user activity)

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (21718L/142K).

svoid dm_stefansAssistant_offerSFOnSnippetCreated() {
  DynModule mod = dm_current_mandatory();
  dm_onSnippetCreated(voidfunc(S snippetID) {
    print("New snippet! " + snippetID);
    if (!dm_hadUserActivityInLastNMinutes(1)) ret with print("No user activity, skipping popup dialog");
    
    if (getSnippetType(snippetID) == snippetType_JavaXInclude()) {
      S text = loadSnippet(snippetID);
      S sfName = first(findFunctionDefsAtCurlyLevel(0, text));
      if (sfName != null)
        // call activateFrame to bring window to foreground reliably on Windows?
        disposeWindowAfter(30.0, /*activateFrameAndReturnComponent*/(showPackedFrameInBottomRightCorner(
          centerAndSouthWithMargins(jlabel("Add standard function: "
            + sfName + "?"),
            hgridWithSpacing(
              jThreadedButton("OK", r {
                temp dm_enter(mod);
                disposeWindow(heldInstance(JButton));
                addStandardFunctionWithAnimation(snippetID);
              }),
              jCancelButton("No")
            )
        ))));
    }
  });
}

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: 362 / 474
Version history: 9 change(s)
Referenced in: [show references]