From 44b3ebb55aec76ee0b583fef45f7215f2ee5d26a Mon Sep 17 00:00:00 2001 From: Jussi Koskela Date: Wed, 24 Oct 2018 15:29:05 +0300 Subject: [PATCH] Option to edit TextNode's text externally Change-Id: I6e454e667b52192e3b3d1e2ffe244d5eec799b03 --- .../src/org/simantics/diagram/elements/TextNode.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/elements/TextNode.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/elements/TextNode.java index 0b33ae3c4..2991d234c 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/elements/TextNode.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/elements/TextNode.java @@ -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 -- 2.47.1