Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Schindl2016-02-19 07:24:41 -0500
committerTom Schindl2016-02-19 07:24:41 -0500
commit346918c4c741ae2c2fd05285a22cfb95020a8176 (patch)
tree20859b501813675c4d8db9d43589042dd0fa52b1
parent1cdd6f814c0e3f32fde5fe41a11062ec610a8e8f (diff)
downloadorg.eclipse.efxclipse-346918c4c741ae2c2fd05285a22cfb95020a8176.tar.gz
org.eclipse.efxclipse-346918c4c741ae2c2fd05285a22cfb95020a8176.tar.xz
org.eclipse.efxclipse-346918c4c741ae2c2fd05285a22cfb95020a8176.zip
Bug 488008 - StyledTextArea annotation support
-rw-r--r--bundles/runtime/org.eclipse.fx.ui.controls/src/org/eclipse/fx/ui/controls/styledtext/internal/TextNode.java22
1 files changed, 17 insertions, 5 deletions
diff --git a/bundles/runtime/org.eclipse.fx.ui.controls/src/org/eclipse/fx/ui/controls/styledtext/internal/TextNode.java b/bundles/runtime/org.eclipse.fx.ui.controls/src/org/eclipse/fx/ui/controls/styledtext/internal/TextNode.java
index 335a1ea2a..a5d9a356e 100644
--- a/bundles/runtime/org.eclipse.fx.ui.controls/src/org/eclipse/fx/ui/controls/styledtext/internal/TextNode.java
+++ b/bundles/runtime/org.eclipse.fx.ui.controls/src/org/eclipse/fx/ui/controls/styledtext/internal/TextNode.java
@@ -5,17 +5,13 @@ import java.util.Collections;
import java.util.List;
import java.util.Optional;
-import org.eclipse.fx.ui.controls.styledtext.NodeCachePane;
import org.eclipse.fx.ui.controls.styledtext.ReuseCache;
-import org.eclipse.fx.ui.controls.styledtext.internal.LineNode.TextLayer;
import org.eclipse.jdt.annotation.NonNull;
import com.sun.javafx.css.converters.PaintConverter;
-import com.sun.javafx.geom.AreaOp.AddOp;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.ObjectProperty;
-import javafx.beans.value.ObservableValue;
import javafx.collections.ObservableList;
import javafx.css.CssMetaData;
import javafx.css.SimpleStyleableIntegerProperty;
@@ -90,6 +86,22 @@ public class TextNode extends HBox {
@NonNull
final ObjectProperty<@NonNull Paint> fill = new SimpleStyleableObjectProperty<>(FILL, this, "fill", Color.BLACK); //$NON-NLS-1$
+ private static String[] BASIC_STRING_CACHE = new String[256];
+
+ private static String toString(char c) {
+ String rv = null;
+ if( c < BASIC_STRING_CACHE.length ) {
+ rv = BASIC_STRING_CACHE[c];
+ if( rv == null ) {
+ BASIC_STRING_CACHE[c] = String.valueOf(c);
+ }
+ }
+ if( rv == null ) {
+ rv = String.valueOf(c);
+ }
+ return rv;
+ }
+
/**
* The paint used to fill the text
*
@@ -321,7 +333,7 @@ public class TextNode extends HBox {
this.activeLetters.clear();
for( char c : processText(text).toCharArray() ) {
Text textNode = cache.getElement();
- textNode.setText(c+"");
+ textNode.setText(toString(c));
this.activeLetters.add(textNode);
}
}

Back to the top