]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Fixed ClassCastException caused by introduction of ShapeNode2 04/4404/1
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Tue, 25 Aug 2020 11:18:51 +0000 (14:18 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Tue, 25 Aug 2020 11:18:51 +0000 (14:18 +0300)
gitlab simantics/platform#574

Change-Id: I4fd6143ec97032f7cbe328ea677c9aad3800ddfc

bundles/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/participant/CreateVariablesShortcutParticipant.java

index 1c5f40be6a0a5327508b3a198f42bf376a96e1ab..15a675964c2c0e75f52a10a158a6072f418c845c 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2010 Association for Decentralized Information Management in
+ * Copyright (c) 2020 Association for Decentralized Information Management in
  * Industry THTH ry.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,7 @@
  *
  * Contributors:
  *     VTT Technical Research Centre of Finland - initial API and implementation
+ *     Semantum Oy - simantics/platform#574
  *******************************************************************************/
 package org.simantics.sysdyn.ui.editor.participant;
 
@@ -40,13 +41,13 @@ import org.simantics.g2d.element.IElement;
 import org.simantics.g2d.participant.MouseUtil;
 import org.simantics.g2d.participant.MouseUtil.MouseInfo;
 import org.simantics.scenegraph.g2d.G2DParentNode;
+import org.simantics.scenegraph.g2d.IG2DNode;
 import org.simantics.scenegraph.g2d.events.EventHandlerReflection.EventHandler;
 import org.simantics.scenegraph.g2d.events.KeyEvent;
 import org.simantics.scenegraph.g2d.events.KeyEvent.KeyPressedEvent;
 import org.simantics.scenegraph.g2d.events.KeyEvent.KeyReleasedEvent;
 import org.simantics.scenegraph.g2d.events.MouseEvent;
 import org.simantics.scenegraph.g2d.events.MouseEvent.MouseMovedEvent;
-import org.simantics.scenegraph.g2d.nodes.ShapeNode;
 import org.simantics.sysdyn.SysdynResource;
 import org.simantics.sysdyn.ui.elements.AuxiliaryFactory;
 import org.simantics.sysdyn.ui.elements.CloudFactory;
@@ -73,7 +74,7 @@ public class CreateVariablesShortcutParticipant extends AbstractDiagramParticipa
        @Dependency
        ElementPainter diagramPainter;
 
-       ShapeNode node;
+       IG2DNode node;
        G2DParentNode parent;
 
        private boolean createVar;
@@ -139,43 +140,43 @@ public class CreateVariablesShortcutParticipant extends AbstractDiagramParticipa
                                variableInformation = new VariableInformation(
                                java.awt.event.KeyEvent.VK_A,
                                SysdynResource.URIs.AuxiliarySymbol,
-                               (ShapeNode)AuxiliaryFactory.AUX_STATIC_IMAGE.init(parent)
+                               (IG2DNode)AuxiliaryFactory.AUX_STATIC_IMAGE.init(parent)
                                );
                        } else if (kpe.keyCode == java.awt.event.KeyEvent.VK_S) {
                                variableInformation = new VariableInformation(
                                                java.awt.event.KeyEvent.VK_S,
                                                SysdynResource.URIs.StockSymbol,
-                                               (ShapeNode)StockFactory.STOCK_IMAGE.init(parent)
+                                               (IG2DNode)StockFactory.STOCK_IMAGE.init(parent)
                                                );
                        } else if (kpe.keyCode == java.awt.event.KeyEvent.VK_C) {
                                variableInformation = new VariableInformation(
                                                java.awt.event.KeyEvent.VK_C,
                                                SysdynResource.URIs.CloudSymbol,
-                                               (ShapeNode)CloudFactory.CLOUD_IMAGE.init(parent)
+                                               (IG2DNode)CloudFactory.CLOUD_IMAGE.init(parent)
                                                );
                        } else if (kpe.keyCode == java.awt.event.KeyEvent.VK_V) {
                                variableInformation = new VariableInformation(
                                                java.awt.event.KeyEvent.VK_V,
                                                SysdynResource.URIs.ValveSymbol,
-                                               (ShapeNode)ValveFactory.VALVE_STATIC_IMAGE.init(parent)
+                                               (IG2DNode)ValveFactory.VALVE_STATIC_IMAGE.init(parent)
                                                );
                        } else if (kpe.keyCode == java.awt.event.KeyEvent.VK_I) {
                                variableInformation = new VariableInformation(
                                                java.awt.event.KeyEvent.VK_I,
                                                SysdynResource.URIs.InputSymbol,
-                                               (ShapeNode)InputFactory.INPUT_IMAGE.init(parent)
+                                               (IG2DNode)InputFactory.INPUT_IMAGE.init(parent)
                                                );
                        } else if (kpe.keyCode == java.awt.event.KeyEvent.VK_G) {
                 variableInformation = new VariableInformation(
                         java.awt.event.KeyEvent.VK_G,
                         SysdynResource.URIs.ShadowSymbol,
-                        (ShapeNode)ShadowFactory.GHOST_IMAGE.init(parent)
+                        (IG2DNode)ShadowFactory.GHOST_IMAGE.init(parent)
                         );
                        } else if (kpe.keyCode == java.awt.event.KeyEvent.VK_L) {
                 variableInformation = new VariableInformation(
                         java.awt.event.KeyEvent.VK_L,
                         SysdynResource.URIs.LoopSymbol,
-                        (ShapeNode)LoopFactory.LOOP_STATIC_IMAGE.init(parent)
+                        (IG2DNode)LoopFactory.LOOP_STATIC_IMAGE.init(parent)
                         );
             }
 
@@ -303,10 +304,10 @@ public class CreateVariablesShortcutParticipant extends AbstractDiagramParticipa
 
        private class VariableInformation {
                public String symbolURI;
-               public ShapeNode node;
+               public IG2DNode node;
                public int shortcutKey;
 
-               public VariableInformation(int shortcutKey, String symbolURI, ShapeNode node) {
+               public VariableInformation(int shortcutKey, String symbolURI, IG2DNode node) {
                        this.symbolURI = symbolURI;
                        this.node = node;
                        this.shortcutKey = shortcutKey;