From 7873b056e19e4ceb2d85745314516af17000d554 Mon Sep 17 00:00:00 2001 From: Tuukka Lehtonen Date: Tue, 25 Aug 2020 14:18:51 +0300 Subject: [PATCH] Fixed ClassCastException caused by introduction of ShapeNode2 gitlab simantics/platform#574 Change-Id: I4fd6143ec97032f7cbe328ea677c9aad3800ddfc --- .../CreateVariablesShortcutParticipant.java | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/bundles/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/participant/CreateVariablesShortcutParticipant.java b/bundles/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/participant/CreateVariablesShortcutParticipant.java index 1c5f40be..15a67596 100644 --- a/bundles/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/participant/CreateVariablesShortcutParticipant.java +++ b/bundles/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/participant/CreateVariablesShortcutParticipant.java @@ -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; -- 2.47.1