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

39
LINES

< > BotCompany Repo | #1016593 // stefansOS_addDynamicModuleDialog2

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

svoid stefansOS_addDynamicModuleDialog2(fS snippetID) {
  stefansOS_addDynamicModuleDialog2(snippetID, false);
}

svoid stefansOS_addDynamicModuleDialog2(fS snippetID, final bool reuseExisting) {
  systemQ.add(r {
    if (reuseExisting) {
      DynamicModule dm = findConcept(DynamicModule, moduleID := snippetID);
      if (dm != null) ret with showModule(dm);
    }

    temp tempBusyAnimation("Loading Module");

    // TODO: Merge this with code sharing?
    Class c = hotwireModule(snippetID);
    L<S> names = (L) callOpt(c, 'myInnerClasses);
    if (names == null)
      names = nonNulls(map getClassDeclarationName(innerClassesOfMain(getServerTranspiledWithoutLibs(snippetID))));
      
    print(+names);
    // only show the usable ones
    try {
      print(mcName := mainClassNameForClassLoader(c.getClassLoader()));
      names = shortClassNames(nonAbstractClassesInRealmWithSuperclassShortNamed(c, "DynModule", names));
      print(+names);
    } catch print e {
      names = null;
    }
    
    if (empty(names))
      stefansOS_showNewDynamicModule(snippetID, null, c);
    else if (l(names) == 1)
      stefansOS_showNewDynamicModule(snippetID, c.getName() + "$" + first(names), c);
    else
      selectFromList("Class to use", concatLists(ll("None"), names), voidfunc(S className) {
        stefansOS_showNewDynamicModule(snippetID, eq(className, "None") ? null : c.getName() + "$" + className, c);
      });
  });
}

Author comment

Began life as a copy of #1016267

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1016593
Snippet name: stefansOS_addDynamicModuleDialog2
Eternal ID of this version: #1016593/10
Text MD5: 17d8dcd051390027c8590843b8dfebb1
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-05 01:16:14
Source code size: 1475 bytes / 39 lines
Pitched / IR pitched: No / No
Views / Downloads: 364 / 434
Version history: 9 change(s)
Referenced in: [show references]