From f834078ff8ed764436e3cec9442e2c120d8984b5 Mon Sep 17 00:00:00 2001 From: lempinen Date: Thu, 22 Nov 2012 08:39:04 +0000 Subject: [PATCH] Separate name caches for each diagram configuration. Previously sysdyn model had only one cache for the whole model. The cache was created from the first diagram configuration that was opened. (fixes #3773) git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@26386 ac1ea38d-2e2b-0410-8846-a27921b304fc --- .../ui/actions/ShowInstantiatedModuleAction.java | 12 ++++++------ .../sysdyn/ui/editor/SysdynCreationInstruction.java | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/actions/ShowInstantiatedModuleAction.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/actions/ShowInstantiatedModuleAction.java index 944fdacd..4447c940 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/actions/ShowInstantiatedModuleAction.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/actions/ShowInstantiatedModuleAction.java @@ -29,8 +29,8 @@ import org.simantics.sysdyn.ui.browser.nodes.ModuleNode; import org.simantics.sysdyn.ui.editor.SysdynEditorInput; import org.simantics.ui.DoubleClickEvent; import org.simantics.ui.IDoubleClickAction; -import org.simantics.ui.utils.AdaptionUtils; import org.simantics.ui.workbench.ResourceEditorInput2; +import org.simantics.utils.ui.AdaptionUtils; import org.simantics.utils.ui.ISelectionUtils; import org.simantics.utils.ui.action.PriorityAction; import org.simantics.utils.ui.workbench.WorkbenchUtils; @@ -54,14 +54,14 @@ public class ShowInstantiatedModuleAction implements IDoubleClickAction { // Open instance for a module instance, if the resource is adaptable to variable Variable variable = AdaptionUtils.adaptToSingle(e.getResource(), Variable.class); if(variable != null) { - String rvi = Variables.getRVI(g, variable); - if(!rvi.isEmpty()) - rvi = rvi.substring(1); - Resource model = Variables.getModel(g, variable); - Resource represents = (Resource)variable.getPropertyValue(g, Variables.REPRESENTS); + Resource represents = variable.getRepresents(g); Resource instanceOf = g.getPossibleObject(represents, l0.InstanceOf); Resource configuration = g.getPossibleObject(instanceOf, sr2.IsDefinedBy); if(configuration != null) { + String rvi = Variables.getRVI(g, variable); + if(!rvi.isEmpty()) + rvi = rvi.substring(1); + Resource model = Variables.getModel(g, variable); addShowModuleAction(e, getResourceEditorInput(g, model, configuration, rvi)); return; } diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/SysdynCreationInstruction.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/SysdynCreationInstruction.java index f465a16e..3e4a83ed 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/SysdynCreationInstruction.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/SysdynCreationInstruction.java @@ -50,7 +50,7 @@ public class SysdynCreationInstruction extends CreationInstruction { Layer0X L0X = Layer0X.getInstance(g); try { - String proposition = URIStringUtils.escape(ComponentNamingUtil.findFreshInstanceName(g, project, configurationRoot, configuration, componentType)); + String proposition = URIStringUtils.escape(ComponentNamingUtil.findFreshInstanceName(g, project, configuration, configuration, componentType)); Resource result = GraphUtils.create(g, l0.HasName, proposition ); -- 2.47.1