]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Option to edit TextNode's text externally 01/2401/1 private/balas4
authorJussi Koskela <jussi.koskela@semantum.fi>
Wed, 24 Oct 2018 12:29:05 +0000 (15:29 +0300)
committerJussi Koskela <jussi.koskela@semantum.fi>
Tue, 30 Oct 2018 13:27:45 +0000 (15:27 +0200)
Change-Id: I6e454e667b52192e3b3d1e2ffe244d5eec799b03

bundles/org.simantics.diagram/src/org/simantics/diagram/elements/TextNode.java

index 0b33ae3c4f65dda2250adf361cfeb7868d872056..2991d234c462bdb09e150e7d81892e7c18013f2c 100644 (file)
@@ -857,6 +857,18 @@ public class TextNode extends G2DNode implements IDynamicSelectionPainterNode, L
     protected void renderSelectedHover(Graphics2D g, boolean isSelected, boolean isHovering) {
     }
 
+    public String editText(String text) {
+
+        String error = validator != null ? validator.apply(text) : null;
+        if (error == null) {
+            this.text = text;
+            if (textListener != null) {
+                textListener.textEditingEnded();
+            }
+        }
+        return error;
+    }
+
     /**
      * Replaces the current selection with the content or inserts
      * the content at caret. After the insertion the caret