]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Fixing name validation issue with Sysdyn diagram elements (refs #5005).
authormiettinen <miettinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Tue, 24 Jun 2014 08:51:01 +0000 (08:51 +0000)
committermiettinen <miettinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Tue, 24 Jun 2014 08:51:01 +0000 (08:51 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@29712 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/SysdynTextElementNoBounds.java

index 3d6eda9e2463bb98c326ec522c91820af18cd89e..3e2f4f52896f1f10aeaed4d55c2d3aa48fb9f33e 100644 (file)
@@ -41,6 +41,7 @@ import org.simantics.modeling.ModelingResources;
 import org.simantics.modeling.ui.diagramEditor.DiagramEditor;\r
 import org.simantics.modeling.ui.diagramEditor.DiagramViewer;\r
 import org.simantics.scenegraph.g2d.G2DParentNode;\r
+import org.simantics.scenegraph.g2d.events.MouseEvent;\r
 import org.simantics.sysdyn.SysdynResource;\r
 import org.simantics.sysdyn.ui.utils.SysdynWorkbenchUtils;\r
 import org.simantics.sysdyn.ui.utils.VariableNameValidator;\r
@@ -145,6 +146,7 @@ public class SysdynTextElementNoBounds extends TextElementNoBounds {
                         String text = node.getText();\r
                         if(!new VariableNameValidator().isValid(component, text, false)) {\r
                             text = textBeforeEdit;\r
+                            node.setEditMode(false);\r
                             node.setText(text);\r
                             if(new VariableNameValidator().isValid(component, text, false))\r
                                 node.setColor(ElementUtils.getTextColor(e, Color.BLACK));\r
@@ -304,5 +306,13 @@ public class SysdynTextElementNoBounds extends TextElementNoBounds {
         \r
         unflipText(e);\r
     }\r
+    \r
+    @Override\r
+    public boolean handleMouseEvent(IElement e, final ICanvasContext ctx, MouseEvent me) {\r
+       //if (!(me instanceof MouseEnterEvent) && !(me instanceof MouseMovedEvent) && !(me instanceof MouseExitEvent))\r
+               //System.out.println(me instanceof MouseDragBegin ? "drag begin" : "no drag begin");\r
+       //SysdynWorkbenchUtils.setHoveringHint(ctx, me, SysdynTextElementNoBounds.this);\r
+        return super.handleMouseEvent(e, ctx, me);\r
+    }\r
 \r
 }\r