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).

svoid g22_adaptSyntaxTextAreaForHashRefs(RSyntaxTextArea ta, G22Utils g22utils) {
  delegate Token to org.fife.ui.rsyntaxtextarea.
  delegate Style to org.fife.ui.rsyntaxtextarea.

  onLeftClick(ta, (IVF1<Pt>) pt -> {
    int ofs = ta.viewToModel2D(toPoint(pt));
    LS tok = hashRefTok(ta.getText());
    int iTok = charToTokenIndex_left(tok, ofs);
    if (odd(iTok) && inRange(iTok, tok)) {
      S t = tok.get(iTok);
      S url = deRoundBracket(dropPrefix("#", t));
      g22utils.projectActions.openPathInProject(url);
      //infoBox("Link URL: " + url);
    }
  });
    
  ((RSyntaxDocument) ta.getDocument()).setSyntaxStyle(new HashRefTokenMaker);
      
  // Set the token types we use to black
  for (token : ll(Token.WHITESPACE, Token.IDENTIFIER))
    ta.getSyntaxScheme().setStyle(token, new Style(Color.black));
}

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: 126 / 194
Version history: 1 change(s)
Referenced in: [show references]