From: lempinen Date: Mon, 18 Oct 2010 12:48:56 +0000 (+0000) Subject: git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@18450 ac1ea38d-2e2b... X-Git-Tag: simantics-1.2.1~22 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=973c6c366a1bcf9b86314e89987d6e9e289a10f7;p=simantics%2Fsysdyn.git git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@18450 ac1ea38d-2e2b-0410-8846-a27921b304fc --- diff --git a/org.simantics.modelica/src/org/simantics/modelica/ModelicaManager.java b/org.simantics.modelica/src/org/simantics/modelica/ModelicaManager.java index 1de0f868..2cde76e9 100644 --- a/org.simantics.modelica/src/org/simantics/modelica/ModelicaManager.java +++ b/org.simantics.modelica/src/org/simantics/modelica/ModelicaManager.java @@ -226,7 +226,7 @@ public class ModelicaManager { printProcessOutput(process, monitor); if(!simulationLocation.exeFile.isFile()) - throw new ModelicaException(".exe file not created"); + throw new ModelicaException(".exe file not created\nSee log at " + simulationLocation.simulationDir.getAbsolutePath()); } catch(IOException e) { e.printStackTrace(); diff --git a/org.simantics.sysdyn.ontology/src/org/simantics/sysdyn/SysdynResource.java b/org.simantics.sysdyn.ontology/src/org/simantics/sysdyn/SysdynResource.java index 3dd2da17..bb693dcc 100644 --- a/org.simantics.sysdyn.ontology/src/org/simantics/sysdyn/SysdynResource.java +++ b/org.simantics.sysdyn.ontology/src/org/simantics/sysdyn/SysdynResource.java @@ -1,6 +1,6 @@ /******************************************************************************* - * Copyright (c) 2010 Association for Decentralized Information Management in - * Industry THTH ry. + * Copyright (c) 2007, 2010 Association for Decentralized Information Management + * in Industry THTH ry. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/NewModuleNodeHandler.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/NewModuleNodeHandler.java index 62a32a34..9c940ed1 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/NewModuleNodeHandler.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/NewModuleNodeHandler.java @@ -22,10 +22,13 @@ import org.simantics.db.common.request.WriteRequest; import org.simantics.db.common.utils.OrderedSetUtils; import org.simantics.db.exception.DatabaseException; import org.simantics.diagram.DiagramConstants; +import org.simantics.diagram.stubs.DiagramResource; import org.simantics.diagram.synchronization.graph.layer.GraphLayer; import org.simantics.diagram.synchronization.graph.layer.GraphLayerUtil; +import org.simantics.layer0.Layer0; import org.simantics.layer0.utils.direct.GraphUtils; -import org.simantics.modeling.ModelingUtils; +import org.simantics.modeling.ModelingResources; +import org.simantics.structural.stubs.StructuralResource2; import org.simantics.sysdyn.SysdynResource; import org.simantics.sysdyn.ui.browser.nodes.ModulesNode; import org.simantics.ui.SimanticsUI; @@ -50,57 +53,60 @@ public class NewModuleNodeHandler extends AbstractHandler { public void perform(WriteGraph g) throws DatabaseException { // Same as in SysdynProject.java. Should use the same code, not copy. SysdynResource sr = SysdynResource.getInstance(g); - ModelingUtils mu = new ModelingUtils(g); + Layer0 l0 = Layer0.getInstance(g); + ModelingResources mr = ModelingResources.getInstance(g); + StructuralResource2 sr2 = StructuralResource2.getInstance(g); + DiagramResource dr = DiagramResource.getInstance(g); - String name = GraphUtils.findFreshName(g, "ModuleType", model, mu.b.ConsistsOf, "%s%d"); + String name = GraphUtils.findFreshName(g, "ModuleType", model, l0.ConsistsOf, "%s%d"); Resource moduleType = g.newResource(); - g.claimLiteral(moduleType, mu.b.HasName, name); - g.claim(moduleType, mu.b.Inherits, sr.Module); - g.claim(moduleType, mu.b.PartOf, model); + g.claimLiteral(moduleType, l0.HasName, name); + g.claim(moduleType, l0.Inherits, sr.Module); + g.claim(moduleType, l0.PartOf, model); Resource diagram = OrderedSetUtils.create(g, sr.ConfigurationDiagram); GraphLayer l = new GraphLayerUtil(g).createLayer(DiagramConstants.DEFAULT_LAYER_NAME, true); - g.claim(diagram, mu.dr.HasLayer, l.getLayer()); + g.claim(diagram, dr.HasLayer, l.getLayer()); Resource mapping = g.newResource(); - g.claim(mapping, mu.b.InstanceOf, null, sr.DiagramToCompositeMapping); - g.claim(diagram, mu.b.HasTrigger, mapping); + g.claim(mapping, l0.InstanceOf, null, sr.DiagramToCompositeMapping); + g.claim(diagram, l0.HasTrigger, mapping); Resource configuration = GraphUtils.create2(g, sr.Configuration, - mu.b.HasName, name + "Configuration", - mu.mr.CompositeToDiagram, diagram, - mu.b.PartOf, model); + l0.HasName, name + "Configuration", + mr.CompositeToDiagram, diagram, + l0.PartOf, model); - g.claim(moduleType, mu.sr.IsDefinedBy , configuration); + g.claim(moduleType, sr2.IsDefinedBy , configuration); Resource moduleSymbol = g.newResource(); - g.claimLiteral(moduleSymbol, mu.b.HasName, name + " Symbol"); - g.claimLiteral(moduleSymbol, mu.b.HasLabel, name); - g.claim(moduleSymbol, mu.b.Inherits, sr.ModuleSymbol); - g.claim(moduleSymbol, mu.mr.SymbolToComponentType, moduleType); - g.claim(moduleSymbol, mu.b.PartOf, model); + g.claimLiteral(moduleSymbol, l0.HasName, name + " Symbol"); + g.claimLiteral(moduleSymbol, l0.HasLabel, name); + g.claim(moduleSymbol, l0.Inherits, sr.ModuleSymbol); + g.claim(moduleSymbol, mr.SymbolToComponentType, moduleType); + g.claim(moduleSymbol, l0.PartOf, model); Resource terminal = g.newResource(); - g.claim(terminal, mu.b.InstanceOf, sr.SysdynTerminal); + g.claim(terminal, l0.InstanceOf, sr.SysdynTerminal); Resource connectionVariable = g.newResource(); - g.claim(connectionVariable, mu.b.InstanceOf, mu.sr.ConnectionVariable); - g.claim(connectionVariable, mu.sr.Binds, sr.IsHeadOfTerminal); - g.claim(connectionVariable, mu.sr.IsParameterOf, sr.ModuleSymbol); - g.claim(terminal, mu.dr.HasConnectionVariable, connectionVariable); + g.claim(connectionVariable, l0.InstanceOf, sr2.ConnectionVariable); + g.claim(connectionVariable, sr2.Binds, sr.IsHeadOfTerminal); + g.claim(connectionVariable, sr2.IsParameterOf, moduleSymbol); + g.claim(terminal, dr.HasConnectionVariable, connectionVariable); Resource terminal2 = g.newResource(); - g.claim(terminal2, mu.b.InstanceOf, sr.SysdynTerminal); + g.claim(terminal2, l0.InstanceOf, sr.SysdynTerminal); Resource connectionVariable2 = g.newResource(); - g.claim(connectionVariable2, mu.b.InstanceOf, mu.sr.ConnectionVariable); - g.claim(connectionVariable2, mu.sr.Binds, sr.IsTailOfTerminal); - g.claim(connectionVariable2, mu.sr.IsParameterOf, sr.ModuleSymbol); - g.claim(terminal2, mu.dr.HasConnectionVariable, connectionVariable2); + g.claim(connectionVariable2, l0.InstanceOf, sr2.ConnectionVariable); + g.claim(connectionVariable2, sr2.Binds, sr.IsTailOfTerminal); + g.claim(connectionVariable2, sr2.IsParameterOf, moduleSymbol); + g.claim(terminal2, dr.HasConnectionVariable, connectionVariable2); - g.claim(moduleSymbol, mu.sr.IsDefinedBy, OrderedSetUtils.create(g, mu.sr.Composite, terminal, terminal2)); + g.claim(moduleSymbol, sr2.IsDefinedBy, OrderedSetUtils.create(g, sr2.Composite, terminal, terminal2)); } diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynModel.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynModel.java index fa4fbdc5..9221c70a 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynModel.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynModel.java @@ -216,6 +216,8 @@ public class SysdynModel implements IMappingListener, IModel { previousImportantInits.put("stop value", stopTime.toString()); previousImportantInits.put("method", method); } catch (ModelicaException e) { + if(e.getMessage() != null) + monitor.message(e.getMessage()); monitor.showConsole(); canceled = true; previousModelStructure = "";