From: miettinen Date: Tue, 24 Jun 2014 08:51:01 +0000 (+0000) Subject: Fixing name validation issue with Sysdyn diagram elements (refs #5005). X-Git-Tag: v1.29.0~261 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=7802db6af7f030debd924c83385d8cc0f2eb7e18;p=simantics%2Fsysdyn.git 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 --- 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); + } }