From: lempinen Date: Tue, 5 Oct 2010 12:07:49 +0000 (+0000) Subject: Remove listener works better in SysdynModel if it actually removes and does not try... X-Git-Tag: simantics-1.2.0~9 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=c9e4990e05a267d152c03db5b5929c6cee052abe;p=simantics%2Fsysdyn.git Remove listener works better in SysdynModel if it actually removes and does not try to add.. git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@18225 ac1ea38d-2e2b-0410-8846-a27921b304fc --- diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/BasicExpression.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/BasicExpression.java index 79acf421..58d265f9 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/BasicExpression.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/BasicExpression.java @@ -112,7 +112,6 @@ public class BasicExpression implements IExpression { SysdynResource sr = SysdynResource.getInstance(g); Resource expression = g.getPossibleObject(variable, sr.HasExpression); if(ExpressionUtils.isParameter(currentText)) { - System.out.println(expressionType); if(!expressionType.equals(sr.ConstantExpression)) expressionType = sr.ParameterExpression; } else { diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/viewUtils/SysdynDatasetSelectionListener.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/viewUtils/SysdynDatasetSelectionListener.java index 5e6f4168..db69a53e 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/viewUtils/SysdynDatasetSelectionListener.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/viewUtils/SysdynDatasetSelectionListener.java @@ -130,6 +130,7 @@ public abstract class SysdynDatasetSelectionListener implements ISelectionListen ArrayList datasets = new ArrayList(); for(Resource resource : resources) { Variable variable = getVariable(g, resource, runtime); + if(variable == null) continue; Collection activeDataSets = loadAllActive(g, Variables.getRVI(g, variable).substring(1), getSysdynModel(g, Variables.getModel(g, variable))); if(activeDataSets != null && !activeDataSets.isEmpty()) datasets.addAll(activeDataSets); diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynModel.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynModel.java index d49606ae..b331f6ea 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynModel.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynModel.java @@ -329,7 +329,7 @@ public class SysdynModel implements IMappingListener, IModel { public void removeResultListener(Runnable listener) { synchronized(resultListeners) { - resultListeners.add(listener); + resultListeners.remove(listener); } }