From dd73060ebfb660932102f59b45f48e60810cdb65 Mon Sep 17 00:00:00 2001 From: lempinen Date: Mon, 18 Jun 2012 12:26:14 +0000 Subject: [PATCH] Document viewer displays the document of active document editor. (refs #3511) git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@25200 ac1ea38d-2e2b-0410-8846-a27921b304fc --- org.simantics.sysdyn.ui/plugin.xml | 6 +++++- .../sysdyn/ui/editor/SysdynEditorNamingService.java | 13 ++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/org.simantics.sysdyn.ui/plugin.xml b/org.simantics.sysdyn.ui/plugin.xml index 8638585b..910c8d86 100644 --- a/org.simantics.sysdyn.ui/plugin.xml +++ b/org.simantics.sysdyn.ui/plugin.xml @@ -1236,7 +1236,7 @@ property="org.simantics.sysdyn.ui.nodeClass"> @@ -1274,6 +1274,10 @@ args="org.simantics.sysdyn.ui.browser.nodes.FunctionLibraryNode" property="org.simantics.sysdyn.ui.nodeClass"> + + diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/SysdynEditorNamingService.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/SysdynEditorNamingService.java index f47c890c..eba820ac 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/SysdynEditorNamingService.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/SysdynEditorNamingService.java @@ -22,6 +22,7 @@ import org.simantics.layer0.Layer0; import org.simantics.modeling.ModelingResources; import org.simantics.modeling.ui.features.EditorNamingService2; import org.simantics.simulation.ontology.SimulationResource; +import org.simantics.sysdyn.SysdynResource; import org.simantics.ui.workbench.IResourceEditorInput2; /** @@ -57,11 +58,13 @@ public class SysdynEditorNamingService extends EditorNamingService2 { } } else { ModelingResources mr = ModelingResources.getInstance(g); - Resource conf = g.getPossibleObject(input.getResource(), mr.DiagramToComposite); - if(conf != null) { - Resource module = g.getPossibleObject(conf, Layer0.getInstance(g).PartOf); - if(module != null) - return NameUtils.getSafeName(g, module); + SysdynResource sr = SysdynResource.getInstance(g); + Resource composite = g.getPossibleObject(input.getResource(), mr.DiagramToComposite); + if(composite != null) { + if(g.isInstanceOf(composite, sr.Configuration)) + composite = g.getPossibleObject(composite, Layer0.getInstance(g).PartOf); + if(composite != null) + return NameUtils.getSafeName(g, composite); } } } -- 2.47.1