]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@18450 ac1ea38d-2e2b...
authorlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Mon, 18 Oct 2010 12:48:56 +0000 (12:48 +0000)
committerlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Mon, 18 Oct 2010 12:48:56 +0000 (12:48 +0000)
org.simantics.modelica/src/org/simantics/modelica/ModelicaManager.java
org.simantics.sysdyn.ontology/src/org/simantics/sysdyn/SysdynResource.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/NewModuleNodeHandler.java
org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynModel.java

index 1de0f8685436f7fa03bae08169300b71ca30b2cb..2cde76e9533b0b76e1eede5a671e3a5aa93c9468 100644 (file)
@@ -226,7 +226,7 @@ public class ModelicaManager {
                        printProcessOutput(process, monitor);\r
 \r
                        if(!simulationLocation.exeFile.isFile())\r
-                               throw new ModelicaException(".exe file not created");            \r
+                               throw new ModelicaException(".exe file not created\nSee log at " + simulationLocation.simulationDir.getAbsolutePath());            \r
 \r
                } catch(IOException e) {\r
                        e.printStackTrace();\r
index 3dd2da17d8621957809e8ff19517a38546471122..bb693dcccfa28f3a0af0114d6bd027769ec432c2 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************\r
- * Copyright (c) 2010 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
+ * in Industry THTH ry.\r
  * All rights reserved. This program and the accompanying materials\r
  * are made available under the terms of the Eclipse Public License v1.0\r
  * which accompanies this distribution, and is available at\r
index 62a32a3403e7ba094bc15b1849f38d20ed011835..9c940ed1ae999fa5dc9b9c304cf33cb8c57ed56e 100644 (file)
@@ -22,10 +22,13 @@ import org.simantics.db.common.request.WriteRequest;
 import org.simantics.db.common.utils.OrderedSetUtils;\r
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.diagram.DiagramConstants;\r
+import org.simantics.diagram.stubs.DiagramResource;\r
 import org.simantics.diagram.synchronization.graph.layer.GraphLayer;\r
 import org.simantics.diagram.synchronization.graph.layer.GraphLayerUtil;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.layer0.utils.direct.GraphUtils;\r
-import org.simantics.modeling.ModelingUtils;\r
+import org.simantics.modeling.ModelingResources;\r
+import org.simantics.structural.stubs.StructuralResource2;\r
 import org.simantics.sysdyn.SysdynResource;\r
 import org.simantics.sysdyn.ui.browser.nodes.ModulesNode;\r
 import org.simantics.ui.SimanticsUI;\r
@@ -50,57 +53,60 @@ public class NewModuleNodeHandler extends AbstractHandler {
             public void perform(WriteGraph g) throws DatabaseException {\r
                 // Same as in SysdynProject.java. Should use the same code, not copy.\r
                 SysdynResource sr = SysdynResource.getInstance(g);\r
-                ModelingUtils mu = new ModelingUtils(g);\r
+                Layer0 l0 = Layer0.getInstance(g);\r
+                ModelingResources mr = ModelingResources.getInstance(g);\r
+                StructuralResource2 sr2 = StructuralResource2.getInstance(g);\r
+                DiagramResource dr = DiagramResource.getInstance(g);\r
                 \r
-                String name = GraphUtils.findFreshName(g, "ModuleType", model, mu.b.ConsistsOf, "%s%d");\r
+                String name = GraphUtils.findFreshName(g, "ModuleType", model, l0.ConsistsOf, "%s%d");\r
                 \r
                 Resource moduleType = g.newResource();\r
-                g.claimLiteral(moduleType, mu.b.HasName, name);\r
-                g.claim(moduleType, mu.b.Inherits, sr.Module);\r
-                g.claim(moduleType, mu.b.PartOf, model);\r
+                g.claimLiteral(moduleType, l0.HasName, name);\r
+                g.claim(moduleType, l0.Inherits, sr.Module);\r
+                g.claim(moduleType, l0.PartOf, model);\r
                 \r
                 Resource diagram = OrderedSetUtils.create(g, sr.ConfigurationDiagram);\r
                 GraphLayer l = new GraphLayerUtil(g).createLayer(DiagramConstants.DEFAULT_LAYER_NAME, true);\r
-                g.claim(diagram, mu.dr.HasLayer, l.getLayer());\r
+                g.claim(diagram, dr.HasLayer, l.getLayer());\r
                 Resource mapping = g.newResource();\r
-                g.claim(mapping, mu.b.InstanceOf, null, sr.DiagramToCompositeMapping);\r
-                g.claim(diagram, mu.b.HasTrigger, mapping);\r
+                g.claim(mapping, l0.InstanceOf, null, sr.DiagramToCompositeMapping);\r
+                g.claim(diagram, l0.HasTrigger, mapping);\r
 \r
                 \r
                 Resource configuration = GraphUtils.create2(g, \r
                         sr.Configuration,\r
-                        mu.b.HasName, name + "Configuration",\r
-                        mu.mr.CompositeToDiagram, diagram,\r
-                        mu.b.PartOf, model);\r
+                        l0.HasName, name + "Configuration",\r
+                        mr.CompositeToDiagram, diagram,\r
+                        l0.PartOf, model);\r
                 \r
-                g.claim(moduleType, mu.sr.IsDefinedBy , configuration);\r
+                g.claim(moduleType, sr2.IsDefinedBy , configuration);\r
                 \r
                 \r
                 Resource moduleSymbol = g.newResource();\r
-                g.claimLiteral(moduleSymbol, mu.b.HasName, name + " Symbol");\r
-                g.claimLiteral(moduleSymbol, mu.b.HasLabel, name);\r
-                g.claim(moduleSymbol, mu.b.Inherits, sr.ModuleSymbol);\r
-                g.claim(moduleSymbol, mu.mr.SymbolToComponentType, moduleType);\r
-                g.claim(moduleSymbol, mu.b.PartOf, model);\r
+                g.claimLiteral(moduleSymbol, l0.HasName, name + " Symbol");\r
+                g.claimLiteral(moduleSymbol, l0.HasLabel, name);\r
+                g.claim(moduleSymbol, l0.Inherits, sr.ModuleSymbol);\r
+                g.claim(moduleSymbol, mr.SymbolToComponentType, moduleType);\r
+                g.claim(moduleSymbol, l0.PartOf, model);\r
                 \r
                 Resource terminal = g.newResource();\r
-                g.claim(terminal, mu.b.InstanceOf, sr.SysdynTerminal);\r
+                g.claim(terminal, l0.InstanceOf, sr.SysdynTerminal);\r
                 Resource connectionVariable = g.newResource();\r
-                g.claim(connectionVariable, mu.b.InstanceOf, mu.sr.ConnectionVariable);\r
-                g.claim(connectionVariable, mu.sr.Binds, sr.IsHeadOfTerminal);\r
-                g.claim(connectionVariable, mu.sr.IsParameterOf, sr.ModuleSymbol);\r
-                g.claim(terminal, mu.dr.HasConnectionVariable, connectionVariable);\r
+                g.claim(connectionVariable, l0.InstanceOf, sr2.ConnectionVariable);\r
+                g.claim(connectionVariable, sr2.Binds, sr.IsHeadOfTerminal);\r
+                g.claim(connectionVariable, sr2.IsParameterOf, moduleSymbol);\r
+                g.claim(terminal, dr.HasConnectionVariable, connectionVariable);\r
                 \r
                 \r
                 Resource terminal2 = g.newResource();\r
-                g.claim(terminal2, mu.b.InstanceOf, sr.SysdynTerminal);\r
+                g.claim(terminal2, l0.InstanceOf, sr.SysdynTerminal);\r
                 Resource connectionVariable2 = g.newResource();\r
-                g.claim(connectionVariable2, mu.b.InstanceOf, mu.sr.ConnectionVariable);\r
-                g.claim(connectionVariable2, mu.sr.Binds, sr.IsTailOfTerminal);\r
-                g.claim(connectionVariable2, mu.sr.IsParameterOf, sr.ModuleSymbol);\r
-                g.claim(terminal2, mu.dr.HasConnectionVariable, connectionVariable2);\r
+                g.claim(connectionVariable2, l0.InstanceOf, sr2.ConnectionVariable);\r
+                g.claim(connectionVariable2, sr2.Binds, sr.IsTailOfTerminal);\r
+                g.claim(connectionVariable2, sr2.IsParameterOf, moduleSymbol);\r
+                g.claim(terminal2, dr.HasConnectionVariable, connectionVariable2);\r
                 \r
-                g.claim(moduleSymbol, mu.sr.IsDefinedBy, OrderedSetUtils.create(g, mu.sr.Composite, terminal, terminal2));\r
+                g.claim(moduleSymbol, sr2.IsDefinedBy, OrderedSetUtils.create(g, sr2.Composite, terminal, terminal2));\r
             \r
                 \r
             }\r
index fa4fbdc5a5980a9a1cb6e17f6984e03744f55405..9221c70aa85c9cca1e8ad1f9f66cc64bfd239e35 100644 (file)
@@ -216,6 +216,8 @@ public class SysdynModel implements IMappingListener, IModel {
                                previousImportantInits.put("stop value", stopTime.toString());\r
                                previousImportantInits.put("method", method);\r
                        } catch (ModelicaException e) {\r
+                               if(e.getMessage() != null)\r
+                                       monitor.message(e.getMessage());\r
                                monitor.showConsole();\r
                                canceled = true;\r
                                previousModelStructure = "";\r