From 0aa59f0fd9490f5f46414f0a6c6c90374e8c6a21 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jani=20M=C3=A4kinen?= Date: Mon, 3 Jun 2019 12:54:31 +0300 Subject: [PATCH] Deleting symbols and connectors from diagram viewer causes errors gitlab #46 Change-Id: Iede73d259885df55dbc577ad44d7d6a188170c66 --- bundles/org.simantics.sysdyn.ui/adapters.xml | 10 +++------- .../connections/DependencyConnectionFactory.java | 2 ++ .../sysdyn/ui/elements/connections/DependencyNode.java | 1 + .../org/simantics/sysdyn/manager/SysdynExperiment.java | 6 ++++++ 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/bundles/org.simantics.sysdyn.ui/adapters.xml b/bundles/org.simantics.sysdyn.ui/adapters.xml index 531c4cf9..32864ef3 100644 --- a/bundles/org.simantics.sysdyn.ui/adapters.xml +++ b/bundles/org.simantics.sysdyn.ui/adapters.xml @@ -121,19 +121,15 @@ - - - + class="org.simantics.sysdyn.ui.elements.connections.DependencyEdgeFactory" /> + diff --git a/bundles/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/connections/DependencyConnectionFactory.java b/bundles/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/connections/DependencyConnectionFactory.java index 6316eec8..2846a51b 100644 --- a/bundles/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/connections/DependencyConnectionFactory.java +++ b/bundles/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/connections/DependencyConnectionFactory.java @@ -264,6 +264,8 @@ public class DependencyConnectionFactory extends ElementFactoryAdapter { ModelingResources MO = ModelingResources.getInstance(graph); Layer0 L0 = Layer0.getInstance(graph); Resource connection = graph.getPossibleObject(elementResource, MO.DiagramConnectionToConnection); + if(connection == null) + return false; Resource tail = graph.getPossibleObject(connection, SR.Variable_HasTail); if (tail == null) return false; diff --git a/bundles/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/connections/DependencyNode.java b/bundles/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/connections/DependencyNode.java index 2bd3a51c..0d9314a3 100644 --- a/bundles/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/connections/DependencyNode.java +++ b/bundles/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/connections/DependencyNode.java @@ -104,6 +104,7 @@ public class DependencyNode extends TextNode implements ISelectionPainterNode, I @Override public void cleanup() { + removeEventHandler(this); super.cleanup(); } diff --git a/bundles/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynExperiment.java b/bundles/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynExperiment.java index b8269d4b..59d175e5 100644 --- a/bundles/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynExperiment.java +++ b/bundles/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynExperiment.java @@ -449,5 +449,11 @@ public class SysdynExperiment extends Experiment implements IDynamicExperiment, return SolverSettings.getSelectedSolverType(); } + @Override + public double getSimulationTime() { + // TODO Auto-generated method stub + return 0; + } + } -- 2.47.1