From 7802db6af7f030debd924c83385d8cc0f2eb7e18 Mon Sep 17 00:00:00 2001 From: miettinen Date: Tue, 24 Jun 2014 08:51:01 +0000 Subject: [PATCH] Fixing name validation issue with Sysdyn diagram elements (refs #5005). git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@29712 ac1ea38d-2e2b-0410-8846-a27921b304fc --- .../sysdyn/ui/elements/SysdynTextElementNoBounds.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/SysdynTextElementNoBounds.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/SysdynTextElementNoBounds.java index 3d6eda9e..3e2f4f52 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/SysdynTextElementNoBounds.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/SysdynTextElementNoBounds.java @@ -41,6 +41,7 @@ import org.simantics.modeling.ModelingResources; import org.simantics.modeling.ui.diagramEditor.DiagramEditor; import org.simantics.modeling.ui.diagramEditor.DiagramViewer; import org.simantics.scenegraph.g2d.G2DParentNode; +import org.simantics.scenegraph.g2d.events.MouseEvent; import org.simantics.sysdyn.SysdynResource; import org.simantics.sysdyn.ui.utils.SysdynWorkbenchUtils; import org.simantics.sysdyn.ui.utils.VariableNameValidator; @@ -145,6 +146,7 @@ public class SysdynTextElementNoBounds extends TextElementNoBounds { String text = node.getText(); if(!new VariableNameValidator().isValid(component, text, false)) { text = textBeforeEdit; + node.setEditMode(false); node.setText(text); if(new VariableNameValidator().isValid(component, text, false)) node.setColor(ElementUtils.getTextColor(e, Color.BLACK)); @@ -304,5 +306,13 @@ public class SysdynTextElementNoBounds extends TextElementNoBounds { unflipText(e); } + + @Override + public boolean handleMouseEvent(IElement e, final ICanvasContext ctx, MouseEvent me) { + //if (!(me instanceof MouseEnterEvent) && !(me instanceof MouseMovedEvent) && !(me instanceof MouseExitEvent)) + //System.out.println(me instanceof MouseDragBegin ? "drag begin" : "no drag begin"); + //SysdynWorkbenchUtils.setHoveringHint(ctx, me, SysdynTextElementNoBounds.this); + return super.handleMouseEvent(e, ctx, me); + } } -- 2.47.1