So at the end of last week I blogged about my experiments to get a styled text viewer for (java) source using the new TextFlow-Support in JavaFX8, I did a short screencast and there you noticed that for larger source files the rendering speed was not acceptable anymore.
I’ve worked a bit on it last night and take a look at this result:
The really cool thing is that the API of my StyledTextArea is fairly the same than the one from SWT-StyledText (in fact also many of the inner workings are a shameless copy from SWT!) this will make it super easy to use and adjust the current text parsing infrastructure used by the Eclipse IDE.
public class StyledTextArea extends Control { public void setContent(StyledTextContent content) { // ... } public StyledTextContent getContent() { // ... } public ObjectProperty<StyledTextContent> contentProperty() { // ... } public void setStyleRange(StyleRange range) { // ... } public void setStyleRanges(int start, int length, int[] ranges, StyleRange[] styles) { // ... } public void setStyleRanges(int[] ranges, StyleRange[] styles) { // ... } public void setStyleRanges(StyleRange[] ranges) { // ... } public void replaceStyleRanges(int start, int length, StyleRange[] ranges) { // ... } public StyleRange[] getStyleRanges(int start, int length, boolean includeRanges) { // ... } }
Ok. This was the easy part, next is to somehow add editing functionality, I have no freaking idea on how to do it.
I don’t know: Often, when you say, you have no idea how to solve a problem, you miraculously come up with a solution only a short time later! 😉
Whatever: This is really nice to see and my hopes, that the Eclipse UI *might* one day be ported to JavaFX, are rising by the day…
Keep up the great work!
Guess you are right – today in the evening I had the idea how to make it work! See https://tomsondev.bestsolution.at/2013/02/20/from-styledtextviewer-to-a-styledtexteditor-with-javafx8/
Pingback: Interview with Tom Schindl // JavaFX News, Demos and Insight // FX Experience
Pingback: Java desktop links of the week, February 24 | Jonathan Giles
Pingback: JavaFX links of the week, February 24 // JavaFX News, Demos and Insight // FX Experience