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

22
LINES

< > BotCompany Repo | #1034717 // g22_adaptSyntaxTextAreaForHashRefs

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

Uses 1485K of libraries. Click here for Pure Java version (33122L/216K).

1  
svoid g22_adaptSyntaxTextAreaForHashRefs(RSyntaxTextArea ta, G22Utils g22utils) {
2  
  delegate Token to org.fife.ui.rsyntaxtextarea.
3  
  delegate Style to org.fife.ui.rsyntaxtextarea.
4  
5  
  onLeftClick(ta, (IVF1<Pt>) pt -> {
6  
    int ofs = ta.viewToModel2D(toPoint(pt));
7  
    LS tok = hashRefTok(ta.getText());
8  
    int iTok = charToTokenIndex_left(tok, ofs);
9  
    if (odd(iTok) && inRange(iTok, tok)) {
10  
      S t = tok.get(iTok);
11  
      S url = deRoundBracket(dropPrefix("#", t));
12  
      g22utils.projectActions.openPathInProject(url);
13  
      //infoBox("Link URL: " + url);
14  
    }
15  
  });
16  
    
17  
  ((RSyntaxDocument) ta.getDocument()).setSyntaxStyle(new HashRefTokenMaker);
18  
      
19  
  // Set the token types we use to black
20  
  for (token : ll(Token.WHITESPACE, Token.IDENTIFIER))
21  
    ta.getSyntaxScheme().setStyle(token, new Style(Color.black));
22  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034717
Snippet name: g22_adaptSyntaxTextAreaForHashRefs
Eternal ID of this version: #1034717/2
Text MD5: dde491c0f46c4d0c49894c8acba38a11
Transpilation MD5: 0c610955fc73fa57b0f232e72d76e04c
Author: stefan
Category: javax / gazelle 22
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-03-07 14:42:47
Source code size: 847 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 83 / 137
Version history: 1 change(s)
Referenced in: [show references]