From: lempinen Date: Thu, 28 Jun 2012 12:45:17 +0000 (+0000) Subject: Chart Items, valuesAndTimes -function, RootLayoutPanel instead of replacing stockList... X-Git-Tag: simantics-1.7~20 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=04a9939eea64c78674937c280a320435690504ea;p=simantics%2Fsysdyn.git Chart Items, valuesAndTimes -function, RootLayoutPanel instead of replacing stockList content.. (refs #3511) git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@25245 ac1ea38d-2e2b-0410-8846-a27921b304fc --- diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/imports/ImportModelHandler.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/imports/ImportModelHandler.java index 954b52fd..c86acfa8 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/imports/ImportModelHandler.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/imports/ImportModelHandler.java @@ -156,8 +156,10 @@ public class ImportModelHandler extends AbstractHandler { } else { fixHasTailAndHasHead(graph, ModelRoot); + addDependencies(graph, ModelRoot); } } + }); } catch (DatabaseException e) { e.printStackTrace(); @@ -167,6 +169,27 @@ public class ImportModelHandler extends AbstractHandler { return null; } + + protected void addDependencies(WriteGraph graph, Resource modelRoot) throws DatabaseException { + Layer0 L0 = Layer0.getInstance(graph); + + ArrayList links = new ArrayList(); + for(Resource link : graph.getObjects(modelRoot, L0.IsLinkedTo)) + links.add(graph.getURI(link)); + + + if(!links.contains("http://www.simantics.org/Documentation-1.0")) { + Resource documentation = graph.getPossibleResource("http://www.simantics.org/Documentation-1.0"); + if(documentation != null) + graph.claim(modelRoot, L0.IsLinkedTo, documentation); + } + + if(!links.contains("http://www.simantics.org/SelectionView-1.1")) { + Resource selectionView = graph.getPossibleResource("http://www.simantics.org/SelectionView-1.1"); + if(selectionView != null) + graph.claim(modelRoot, L0.IsLinkedTo, selectionView); + } + } protected void fixHasTailAndHasHead(WriteGraph graph, Resource modelRoot) throws DatabaseException { Layer0 L0 = Layer0.getInstance(graph); diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/ModuleType.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/ModuleType.java index 5b57d2b4..bf7b84a9 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/ModuleType.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/ModuleType.java @@ -31,7 +31,7 @@ public class ModuleType implements IElement { private String name; @RelatedElement(StructuralResource2.URIs.IsDefinedBy) - private Configuration configuration; + private Object configuration; @RelatedElement(Layer0.URIs.PartOf) protected Object parent; @@ -41,7 +41,7 @@ public class ModuleType implements IElement { } public Configuration getConfiguration() { - return this.configuration; + return configuration instanceof Configuration ? (Configuration)configuration : null; } @Override