]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Chart Items, valuesAndTimes -function, RootLayoutPanel instead of replacing stockList...
authorlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Thu, 28 Jun 2012 12:45:17 +0000 (12:45 +0000)
committerlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Thu, 28 Jun 2012 12:45:17 +0000 (12:45 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@25245 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/imports/ImportModelHandler.java
org.simantics.sysdyn/src/org/simantics/sysdyn/representation/ModuleType.java

index 954b52fdcc6b277a5d528a869c08751530ad1f94..c86acfa803830c671d28c84b69eea250f49f30af 100644 (file)
@@ -156,8 +156,10 @@ public class ImportModelHandler extends AbstractHandler {
 \r
                                                } else {\r
                                                        fixHasTailAndHasHead(graph, ModelRoot);\r
+                                                       addDependencies(graph, ModelRoot);\r
                                                }\r
                                        }\r
+\r
                                });\r
                        } catch (DatabaseException e) {\r
                                e.printStackTrace();\r
@@ -167,6 +169,27 @@ public class ImportModelHandler extends AbstractHandler {
                return null;\r
 \r
        }\r
+       \r
+       protected void addDependencies(WriteGraph graph, Resource modelRoot) throws DatabaseException {\r
+               Layer0 L0 = Layer0.getInstance(graph);\r
+\r
+               ArrayList<String> links = new ArrayList<String>();\r
+               for(Resource link : graph.getObjects(modelRoot, L0.IsLinkedTo))\r
+                       links.add(graph.getURI(link));\r
+               \r
+               \r
+               if(!links.contains("http://www.simantics.org/Documentation-1.0")) {\r
+                       Resource documentation = graph.getPossibleResource("http://www.simantics.org/Documentation-1.0");\r
+                       if(documentation != null)\r
+                               graph.claim(modelRoot, L0.IsLinkedTo, documentation);\r
+               }\r
+               \r
+               if(!links.contains("http://www.simantics.org/SelectionView-1.1")) {\r
+                       Resource selectionView = graph.getPossibleResource("http://www.simantics.org/SelectionView-1.1");\r
+                       if(selectionView != null)\r
+                               graph.claim(modelRoot, L0.IsLinkedTo, selectionView);\r
+               }\r
+       }\r
 \r
        protected void fixHasTailAndHasHead(WriteGraph graph, Resource modelRoot) throws DatabaseException {\r
                Layer0 L0 = Layer0.getInstance(graph);\r
index 5b57d2b443ae4e5b40a7e4a68ef1b8f098c07adf..bf7b84a9ff8a5617d04be25b43490f7c1b0b99a3 100644 (file)
@@ -31,7 +31,7 @@ public class ModuleType implements IElement {
     private String name;\r
     \r
     @RelatedElement(StructuralResource2.URIs.IsDefinedBy)\r
-    private Configuration configuration;\r
+    private Object configuration;\r
     \r
     @RelatedElement(Layer0.URIs.PartOf)\r
     protected Object parent;\r
@@ -41,7 +41,7 @@ public class ModuleType implements IElement {
     }\r
 \r
     public Configuration getConfiguration() {\r
-        return this.configuration;\r
+        return configuration instanceof Configuration ? (Configuration)configuration : null;\r
     }\r
     \r
        @Override\r