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

16
LINES

< > BotCompany Repo | #1001452 // Smart Editor: Apply Translator

JavaX fragment (include)

1  
if (s.startsWith("!")) {
2  
  S translator = s.substring(1);
3  
  if (isSnippetID(translator)) {
4  
    File x = tempDir();
5  
    S oldText = getText();
6  
    saveTextFile(new File(x, "main.java"), oldText);
7  
    ArrayList<File> libraries_out = new ArrayList<File>();
8  
    File y = cast call(getJavaX(), "applyTranslator", x, translator, "", libraries_out);
9  
    S text = loadTextFile(new File(y, "main.java"));
10  
    if (text == null)
11  
      ret "hm.";
12  
    boolean same = eq(oldText, text);
13  
    setText(text);
14  
    ret same ? "OK - no change" : "OK, applied !" + translator;
15  
  }
16  
}

Author comment

Began life as a copy of #1001451

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1001452
Snippet name: Smart Editor: Apply Translator
Eternal ID of this version: #1001452/1
Text MD5: 11ddda82ef8b3b1b7e468b4989e7ecf0
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-10-16 20:05:12
Source code size: 578 bytes / 16 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 667 / 910
Referenced in: [show references]