]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Refactored duplicate code contained SGFocusParticipant/TextEditActivation into Contex...
authorlehtonen <lehtonen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Thu, 29 Jul 2010 10:13:29 +0000 (10:13 +0000)
committerlehtonen <lehtonen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Thu, 29 Jul 2010 10:13:29 +0000 (10:13 +0000)
Deprecated old EditTextHandler and removed it from all diagram viewers.

git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@16867 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/HoverTextElementNoBounds.java

index ffab9354cb8fe7d754a504a0c5846c208d41f2ce..ebdea3bfb4c6758ccab2e7524442811096b5dcdc 100644 (file)
@@ -14,16 +14,13 @@ package org.simantics.sysdyn.ui.elements2;
 import java.awt.Color;\r
 import java.awt.Font;\r
 import java.awt.geom.Point2D;\r
-import java.util.Collection;\r
 \r
 import org.simantics.diagram.elements.ITextListener;\r
+import org.simantics.diagram.elements.TextEditActivation;\r
 import org.simantics.diagram.elements.TextNode;\r
-import org.simantics.diagram.participant.ContextUtil;\r
 import org.simantics.g2d.canvas.ICanvasContext;\r
-import org.simantics.g2d.canvas.IMouseCaptureHandle;\r
 import org.simantics.g2d.diagram.DiagramUtils;\r
 import org.simantics.g2d.diagram.IDiagram;\r
-import org.simantics.g2d.diagram.participant.ElementInteractor;\r
 import org.simantics.g2d.element.ElementUtils;\r
 import org.simantics.g2d.element.IElement;\r
 import org.simantics.g2d.element.SceneGraphNodeKey;\r
@@ -36,9 +33,9 @@ import org.simantics.g2d.participant.MouseUtil.MouseClickEvent;
 import org.simantics.g2d.utils.Alignment;\r
 import org.simantics.scenegraph.g2d.G2DParentNode;\r
 import org.simantics.utils.datastructures.Callback;\r
+import org.simantics.utils.datastructures.hints.IHintContext.Key;\r
 import org.simantics.utils.datastructures.hints.IHintListener;\r
 import org.simantics.utils.datastructures.hints.IHintObservable;\r
-import org.simantics.utils.datastructures.hints.IHintContext.Key;\r
 \r
 /**\r
  * ElementHandler for text elements\r
@@ -130,14 +127,14 @@ public class HoverTextElementNoBounds implements SceneGraph, HandleMouseEvent {
         node.setHorizontalAlignment((byte) horizontalAlignment.ordinal());\r
         node.setBorderWidth((float) borderWidth);\r
         node.setEditable(editable);\r
-        \r
+\r
         e.addHintListener(new IHintListener() {\r
-            \r
+\r
             @Override\r
             public void hintRemoved(IHintObservable sender, Key key, Object oldValue) {\r
-                \r
+\r
             }\r
-            \r
+\r
             @Override\r
             public void hintChanged(IHintObservable sender, Key key, Object oldValue, Object newValue) {\r
                 IElement e = (IElement)sender;\r
@@ -230,42 +227,5 @@ public class HoverTextElementNoBounds implements SceneGraph, HandleMouseEvent {
             return false;\r
         return true;\r
     }\r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    class TextEditActivation {\r
-\r
-        ICanvasContext      ctx;\r
-        IMouseCaptureHandle capture;\r
-        ContextUtil         ctxUtil;\r
-        Collection<String>  originalContexts;\r
-\r
-        public TextEditActivation(int mouseId, IElement e, ICanvasContext ctx) {\r
-            ElementInteractor ei = ctx.getSingleItem(ElementInteractor.class);\r
-            this.ctxUtil = ctx.getSingleItem(ContextUtil.class);\r
-\r
-            // Capture mouse events (otherwise we would not get mouse events when the cursor is outside the text widget)\r
-            this.capture = ei.captureMouse(e, mouseId);\r
-\r
-            // activate in-line editing context\r
-            this.originalContexts = ctxUtil.getActivatedContextIds();\r
-            ctxUtil.deactivateAll();\r
-            ctxUtil.activate("org.simantics.modeling.ui.diagramming.inlineEdit");\r
-        }\r
-\r
-        public void release() {\r
-            capture.release();\r
-            capture = null;\r
-\r
-            // de-activate in-line editing context\r
-            ctxUtil.deactivateAll();\r
-            ctxUtil.activate(originalContexts);\r
-        }\r
-\r
-    }\r
 \r
 }
\ No newline at end of file