srecord noeq G22ProjectStoryEditor(G22Utils g22utils) { JSyntaxTextFileEditor editor; File textFile() { ret g22utils.projectStoryTextFile(); } IVarWithNotify varText() { ret textFileAsVarWithNotify(textFile()); } cachedVisualize { editor = new JSyntaxTextFileEditor(textFile()).autoSave(true); // debug modelToToken editor.makeSyntaxTextAreaWithSearch = -> new RSyntaxTextAreaWithSearch(new RSyntaxTextArea(1, 10) { public org.fife.ui.rsyntaxtextarea.Token modelToToken(int ofs) { var token = super.modelToToken(ofs); printVars("modelToToken", +ofs, +token); ret token; } }); // react to HyperlinkEvent // problems: // -RSyntaxTextArea only fires these events when ctrl is pressed // -RSyntaxTextArea expects the token to be a url with protocol // So we'll have to make our own hyperlink mechanism... editor.adaptSyntaxTextArea = textArea -> { ((RSyntaxDocument) textArea.getDocument()).setSyntaxStyle(new HashRefTokenMaker); textArea.addHyperlinkListener(evt -> { print("Hyperlink event"); if (evt.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { infoBox("Link URL: " + evt.getURL()); } }); }; ret withTopAndBottomMargin(jRaisedCenteredSection("Project Story", editor.visualize() )); } }