]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Each simulation run gets its own folder for simulation files and results. Function...
authorlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Wed, 25 Jul 2012 15:27:25 +0000 (15:27 +0000)
committerlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Wed, 25 Jul 2012 15:27:25 +0000 (15:27 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@25346 ac1ea38d-2e2b-0410-8846-a27921b304fc

24 files changed:
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/drop/FunctionDropAction.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/newActions/NewFunctionAction.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/newActions/NewFunctionLibraryAction.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/FunctionLibraryNode.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/FunctionNode.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/FunctionsFolder.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/SharedFunctionLibraryNode.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/imports/ImportExternalFunctionFilesHandler.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/imports/ImportFunctionLibrary.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/newComponents/NewFunctionHandler.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/newComponents/NewFunctionLibraryHandler.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProject.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/FunctionTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/externalFiles/ExternalFileNode.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/functions/FunctionCodeWidget.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/wizards/functions/SharedFunctionsFolderNode.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/wizards/functions/WizardFunctionsImportPage.java
org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/IndexVariable.java
org.simantics.sysdyn/src/org/simantics/sysdyn/manager/FunctionUtils.java
org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynExperiment.java
org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynGameExperiment.java
org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynModel.java
org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynModelManager.java
org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynPlaybackExperiment.java

index 588ac87851284f1f0beb6df4eac44a13dffc69db..da452b2f3d95db93ceb5a3e71aa70c1be8ca8b47 100644 (file)
@@ -19,7 +19,6 @@ import org.simantics.db.exception.DatabaseException;
 import org.simantics.db.layer0.adapter.DropActionFactory;\r
 import org.simantics.layer0.Layer0;\r
 import org.simantics.sysdyn.SysdynResource;\r
-import org.simantics.sysdyn.manager.FunctionUtils;\r
 import org.simantics.ui.SimanticsUI;\r
 import org.simantics.ui.utils.AdaptionUtils;\r
 \r
@@ -74,8 +73,6 @@ public class FunctionDropAction implements DropActionFactory {
                         // Remove dragged entity from its parent and add it to the new parent\r
                         graph.claim(tobemoved, L0.PartOf, library);\r
                         graph.deny(tobemoved, L0.PartOf, oldLib);\r
-                        FunctionUtils.updateFunctionFileForLibrary(graph, oldLib);\r
-                        FunctionUtils.updateFunctionFileForLibrary(graph, library);  \r
                     }\r
 \r
                 });\r
index c4e0b3dc03fd8679206b58bb598fb4c790eadb9c..a76b5c1729c3eaadef2be78ec6e605d693036796 100644 (file)
@@ -20,7 +20,6 @@ import org.simantics.db.layer0.adapter.ActionFactory;
 import org.simantics.layer0.Layer0;\r
 import org.simantics.layer0.utils.direct.GraphUtils;\r
 import org.simantics.sysdyn.SysdynResource;\r
-import org.simantics.sysdyn.manager.FunctionUtils;\r
 import org.simantics.ui.SimanticsUI;\r
 \r
 /**\r
@@ -64,8 +63,6 @@ public class NewFunctionAction implements ActionFactory{
                                 l0.HasDescription, "",\r
                                 sr.SysdynModelicaFunction_modelicaFunctionCode, "",\r
                                 l0.PartOf, library);\r
-\r
-                         FunctionUtils.updateFunctionFileForLibrary(g, library);\r
                     }\r
                 });\r
 \r
index 38670b8c4cca7512f88967793b9f5033f920663d..031e37e9267ccfc2240b4ff1e70ac34170ad38ee 100644 (file)
@@ -21,7 +21,6 @@ import org.simantics.db.layer0.adapter.ActionFactory;
 import org.simantics.layer0.Layer0;\r
 import org.simantics.layer0.utils.direct.GraphUtils;\r
 import org.simantics.sysdyn.SysdynResource;\r
-import org.simantics.sysdyn.manager.FunctionUtils;\r
 import org.simantics.ui.SimanticsUI;\r
 \r
 /**\r
@@ -95,8 +94,6 @@ public class NewFunctionLibraryAction implements ActionFactory{
                 \r
                 if(shared)\r
                     g.claim(libraryLocation, l0.IsLinkedTo, functionLibrary);\r
-\r
-                FunctionUtils.updateFunctionFileForLibrary(g, functionLibrary);\r
             }\r
         });\r
     }\r
index becb2cd18711b9b73a06d1c5c7bb7647987341cd..52ded0024a575f8baa93e032ce47a05e25794557 100644 (file)
@@ -25,7 +25,6 @@ import org.simantics.db.exception.DatabaseException;
 import org.simantics.db.layer0.util.RemoverUtil;\r
 import org.simantics.layer0.Layer0;\r
 import org.simantics.sysdyn.SysdynResource;\r
-import org.simantics.sysdyn.manager.FunctionUtils;\r
 import org.simantics.ui.SimanticsUI;\r
 import org.simantics.ui.utils.ResourceAdaptionUtils;\r
 \r
@@ -82,11 +81,8 @@ public class FunctionLibraryNode<T> extends AbstractNode<Resource> implements ID
                                        for(Resource tobeMoved : resources) {\r
                                                if(graph.isInstanceOf(tobeMoved, sr.SysdynModelicaFunction) ||\r
                                                                graph.isInstanceOf(tobeMoved, sr.SysdynModelicaFunctionLibrary)) {\r
-                                                       Resource oldLib = graph.getSingleObject(tobeMoved, l0.PartOf);\r
                                                        graph.deny(tobeMoved, l0.PartOf);\r
                                                        graph.claim(tobeMoved, l0.PartOf, library);\r
-                                                       FunctionUtils.updateFunctionFileForLibrary(graph, oldLib);\r
-                                                       FunctionUtils.updateFunctionFileForLibrary(graph, library);\r
                                                }\r
                                        }\r
                                }\r
index 710d221c90ee61c11a2947e0657b513e9c3c8f19..c3900b25318573fb1122a87e7819d61a804ee4d0 100644 (file)
@@ -24,7 +24,6 @@ import org.simantics.db.exception.DatabaseException;
 import org.simantics.db.layer0.util.RemoverUtil;\r
 import org.simantics.layer0.Layer0;\r
 import org.simantics.sysdyn.SysdynResource;\r
-import org.simantics.sysdyn.manager.FunctionUtils;\r
 import org.simantics.ui.SimanticsUI;\r
 import org.simantics.ui.utils.ResourceAdaptionUtils;\r
 \r
@@ -85,11 +84,8 @@ public class FunctionNode extends VariableNode<Resource> implements IDeletableNo
                                                        if(library == null) {\r
                                                                library = graph.getSingleObject(thisFunction, l0.PartOf);\r
                                                        }\r
-                                                       Resource oldLib = graph.getSingleObject(tobeMoved, l0.PartOf);\r
                                                        graph.deny(tobeMoved, l0.PartOf);\r
                                                        graph.claim(tobeMoved, l0.PartOf, library);\r
-                                                       FunctionUtils.updateFunctionFileForLibrary(graph, oldLib);\r
-                                                       FunctionUtils.updateFunctionFileForLibrary(graph, library);\r
                                                }\r
                                        }\r
                                }\r
index bbba4a0b82f7275b3d08f144a491eb643122bcf3..5e4f8748da8d4138cfdcee82d73e1257d0b02107 100644 (file)
@@ -19,7 +19,6 @@ import org.simantics.db.common.request.WriteRequest;
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.layer0.Layer0;\r
 import org.simantics.sysdyn.SysdynResource;\r
-import org.simantics.sysdyn.manager.FunctionUtils;\r
 import org.simantics.ui.SimanticsUI;\r
 import org.simantics.ui.utils.ResourceAdaptionUtils;\r
 \r
@@ -51,11 +50,8 @@ public class FunctionsFolder extends AbstractNode<Resource> implements IDropTarg
                                        for(Resource tobeMoved : resources) {\r
                                                if(graph.isInstanceOf(tobeMoved, sr.SysdynModelicaFunction) ||\r
                                                                graph.isInstanceOf(tobeMoved, sr.SysdynModelicaFunctionLibrary)) {\r
-                                                       Resource oldLib = graph.getSingleObject(tobeMoved, l0.PartOf);\r
                                                        graph.deny(tobeMoved, l0.PartOf);\r
                                                        graph.claim(tobeMoved, l0.PartOf, library);\r
-                                                       FunctionUtils.updateFunctionFileForLibrary(graph, oldLib);\r
-                                                       FunctionUtils.updateFunctionFileForLibrary(graph, library);\r
                                                }\r
                                        }\r
                                }\r
index 7d7646915a6759e28c7f8a4ca955b16f89b23428..e003f140bf732f7bb034749100c0e67c6a2bb26b 100644 (file)
@@ -19,7 +19,6 @@ import org.simantics.db.common.request.WriteRequest;
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.layer0.Layer0;\r
 import org.simantics.sysdyn.SysdynResource;\r
-import org.simantics.sysdyn.manager.FunctionUtils;\r
 import org.simantics.ui.SimanticsUI;\r
 import org.simantics.ui.utils.ResourceAdaptionUtils;\r
 \r
@@ -59,11 +58,8 @@ public class SharedFunctionLibraryNode extends FunctionLibraryNode<Resource> imp
                                        for(Resource tobeMoved : resources) {\r
                                                if(graph.isInstanceOf(tobeMoved, sr.SysdynModelicaFunction) ||\r
                                                                graph.isInstanceOf(tobeMoved, sr.SysdynModelicaFunctionLibrary)) {\r
-                                                       Resource oldLib = graph.getSingleObject(tobeMoved, l0.PartOf);\r
                                                        graph.deny(tobeMoved, l0.PartOf);\r
                                                        graph.claim(tobeMoved, l0.PartOf, library);\r
-                                                       FunctionUtils.updateFunctionFileForLibrary(graph, oldLib);\r
-                                                       FunctionUtils.updateFunctionFileForLibrary(graph, library);\r
                                                }\r
                                        }\r
                                        \r
index 05b63a2b59aaf8dbd2ab09be7f8359bf6a4c619e..50277c1ccd56fb8daea0fcc0c9bc3942a2353248 100644 (file)
@@ -31,7 +31,6 @@ import org.simantics.db.exception.DatabaseException;
 import org.simantics.layer0.Layer0;\r
 import org.simantics.layer0.utils.direct.GraphUtils;\r
 import org.simantics.sysdyn.SysdynResource;\r
-import org.simantics.sysdyn.manager.FunctionUtils;\r
 import org.simantics.ui.SimanticsUI;\r
 import org.simantics.utils.datastructures.Pair;\r
 \r
@@ -109,8 +108,7 @@ public class ImportExternalFunctionFilesHandler extends AbstractHandler {
                                FileInputStream fis = new FileInputStream(file);\r
                                fis.read(fileBArray);\r
                                graph.claimLiteral(externalFile, sr.ExternalFunctionFile_externalFile, fileBArray, Bindings.BYTE_ARRAY);\r
-                               \r
-                               FunctionUtils.createExternalFunctionFile(graph, externalFile);\r
+                               fis.close();\r
                        } catch (IOException e) {\r
                                e.printStackTrace();\r
                        }\r
index dad7c060cbbad5568fb7096168701c171e679936..00ad8c362c782bb738efea6d0f15706252dadf93 100644 (file)
@@ -47,7 +47,6 @@ import org.simantics.graph.representation.TransferableGraph1;
 import org.simantics.layer0.Layer0;\r
 import org.simantics.layer0.utils.direct.GraphUtils;\r
 import org.simantics.sysdyn.SysdynResource;\r
-import org.simantics.sysdyn.manager.FunctionUtils;\r
 import org.simantics.sysdyn.ui.Activator;\r
 import org.simantics.sysdyn.ui.browser.nodes.FunctionsFolder;\r
 import org.simantics.ui.SimanticsUI;\r
@@ -194,9 +193,6 @@ public class ImportFunctionLibrary  extends AbstractHandler {
                                                                displayErrorMessage(shell, "The imported file is not of type: Function Library (" + ft +")");                                                   \r
                                                        }\r
                                                });\r
-                                       } else {\r
-                                               // imported library is already in the right place. Update function library files.\r
-                                               FunctionUtils.updateFunctionFileForLibrary(graph, functionLibrary);\r
                                        }\r
 \r
                                }\r
index 1cf45f03905f5d46103dc28d8e922839e0998372..67ddc56b98cc323b578d72acef3e50a98d02d5b9 100644 (file)
@@ -25,7 +25,6 @@ import org.simantics.db.exception.DatabaseException;
 import org.simantics.layer0.Layer0;\r
 import org.simantics.layer0.utils.direct.GraphUtils;\r
 import org.simantics.sysdyn.SysdynResource;\r
-import org.simantics.sysdyn.manager.FunctionUtils;\r
 import org.simantics.ui.SimanticsUI;\r
 import org.simantics.ui.utils.AdaptionUtils;\r
 \r
@@ -77,8 +76,6 @@ public class NewFunctionHandler extends AbstractHandler {
                         l0.HasDescription, "",\r
                         sr.SysdynModelicaFunction_modelicaFunctionCode, "",\r
                         l0.PartOf, library);\r
-                \r
-                FunctionUtils.updateFunctionFileForLibrary(g, library);\r
             }\r
         });\r
         \r
index 98f40231c70dc73755fefb1d89b603b29723242d..978137a5a247f95d7a3f3368927f1276a6ceb59c 100644 (file)
@@ -26,7 +26,6 @@ import org.simantics.db.exception.ResourceNotFoundException;
 import org.simantics.layer0.Layer0;\r
 import org.simantics.layer0.utils.direct.GraphUtils;\r
 import org.simantics.sysdyn.SysdynResource;\r
-import org.simantics.sysdyn.manager.FunctionUtils;\r
 import org.simantics.ui.SimanticsUI;\r
 import org.simantics.ui.utils.AdaptionUtils;\r
 \r
@@ -101,8 +100,6 @@ public class NewFunctionLibraryHandler extends AbstractHandler {
                 \r
                 if(shared)\r
                        g.claim(model, l0.IsLinkedTo, functionLibrary);\r
-\r
-                FunctionUtils.updateFunctionFileForLibrary(g, functionLibrary);\r
             }\r
         });\r
        }\r
index 1fe30c4082bf8b7ec971eb922ed7d00ab5c6524f..42c44fef8ab96a1c0a4f4defec4c0ee13799581d 100644 (file)
@@ -44,6 +44,8 @@ import org.simantics.project.exception.ProjectException;
 import org.simantics.project.features.AbstractProjectFeature;\r
 import org.simantics.simulation.experiment.IExperiment;\r
 import org.simantics.simulation.ontology.SimulationResource;\r
+import org.simantics.simulation.project.ExperimentManagerKeys;\r
+import org.simantics.simulation.project.ExperimentManagerMode;\r
 import org.simantics.simulation.project.IExperimentManager;\r
 import org.simantics.sysdyn.SysdynResource;\r
 import org.simantics.sysdyn.ui.editor.SysdynEditorNamingService;\r
@@ -59,7 +61,12 @@ public class SysdynProject extends AbstractProjectFeature {
                final Session session = getSession();\r
 \r
                getProjectElement().setHint(ProjectKeys.DEFAULT_PERSPECTIVE, DEFAULT_PERSPECTIVE);\r
-\r
+               \r
+               // Multi for simupedia use\r
+//             getProjectElement().setHint(ExperimentManagerKeys.EXPERIMENT_MANAGER_MODE, ExperimentManagerMode.MULTI_EXPERIMENT);\r
+               // Single for normal workbench use\r
+               getProjectElement().setHint(ExperimentManagerKeys.EXPERIMENT_MANAGER_MODE, ExperimentManagerMode.SINGLE_EXPERIMENT);\r
+               \r
                getProjectElement().setHint(IEditorNamingService.KEY_EDITOR_NAMING_SERVICE, new SysdynEditorNamingService());\r
 \r
                // Install naming strategy for model components.\r
index 9d9eec4d3dd53df1f477ec785ff59756e579ae57..5fc90bbfdb18e468d2adb8ff911ec1b51201ccb6 100644 (file)
@@ -21,14 +21,9 @@ import org.simantics.browsing.ui.swt.widgets.Label;
 import org.simantics.browsing.ui.swt.widgets.StringPropertyFactory;\r
 import org.simantics.browsing.ui.swt.widgets.StringPropertyModifier;\r
 import org.simantics.browsing.ui.swt.widgets.TrackedText;\r
-import org.simantics.browsing.ui.swt.widgets.impl.TextModifyListenerImpl;\r
 import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.management.ISessionContext;\r
 import org.simantics.layer0.Layer0;\r
-import org.simantics.sysdyn.manager.FunctionUtils;\r
 import org.simantics.sysdyn.ui.properties.widgets.FunctionLabelFactory;\r
 import org.simantics.sysdyn.ui.properties.widgets.expressions.ExpressionField;\r
 import org.simantics.sysdyn.ui.properties.widgets.functions.FunctionCodeWidget;\r
@@ -48,15 +43,6 @@ public class FunctionTab extends LabelPropertyTabContributor {
         TrackedText nameText = new TrackedText(composite, support, SWT.BORDER);\r
         nameText.setTextFactory(new StringPropertyFactory(Layer0.URIs.HasName));\r
         nameText.addModifyListener(new StringPropertyModifier(context, Layer0.URIs.HasName));\r
-        nameText.addModifyListener(new TextModifyListenerImpl<Resource>() {\r
-\r
-                       @Override\r
-                       public void applyText(WriteGraph graph, Resource input, String text)\r
-                                       throws DatabaseException {\r
-                               Resource library = graph.getSingleObject(input, Layer0.getInstance(graph).PartOf);\r
-                               FunctionUtils.updateFunctionFileForLibrary(graph, library);\r
-                       }\r
-               });\r
         GridDataFactory.fillDefaults().span(2, 1).grab(true, false).applyTo(nameText.getWidget());\r
         \r
         \r
index 726ab4ac594431a4b737f5563d725d59e6db7206..1150817a3a6bcf914426d116f410a31ad573cc3b 100644 (file)
@@ -24,7 +24,6 @@ import org.simantics.db.exception.DatabaseException;
 import org.simantics.db.layer0.util.RemoverUtil;\r
 import org.simantics.db.request.Write;\r
 import org.simantics.layer0.Layer0;\r
-import org.simantics.sysdyn.manager.FunctionUtils;\r
 import org.simantics.ui.SimanticsUI;\r
 \r
 public class ExternalFileNode extends AbstractNode<Resource> implements IModifiableNode, IDeletableNode {\r
@@ -52,9 +51,7 @@ public class ExternalFileNode extends AbstractNode<Resource> implements IModifia
                                        return new WriteRequest() {\r
                                                @Override\r
                                                public void perform(WriteGraph g) throws DatabaseException {\r
-                                                       FunctionUtils.removeExternalFunctionFile(g, data);\r
                                                        g.claimLiteral(data, hasName, label);\r
-                                                       FunctionUtils.createExternalFunctionFile(g, data);\r
                                                }\r
                                        };\r
                                }\r
@@ -72,7 +69,6 @@ public class ExternalFileNode extends AbstractNode<Resource> implements IModifia
 \r
                        @Override\r
                        public void perform(WriteGraph graph) throws DatabaseException {\r
-                               FunctionUtils.removeExternalFunctionFile(graph, data);\r
                                RemoverUtil.remove(graph, data);\r
                        }\r
                });\r
index a39568bc470175ee1634cdaae9f3cbb669ac04f5..9bbd115f694d29135272f6efc89e0f4dc1155268 100644 (file)
@@ -37,13 +37,11 @@ import org.simantics.db.common.request.WriteRequest;
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.management.ISessionContext;\r
 import org.simantics.db.request.Read;\r
-import org.simantics.layer0.Layer0;\r
 import org.simantics.sysdyn.SysdynResource;\r
 import org.simantics.sysdyn.modelParser.ModelParser;\r
 import org.simantics.sysdyn.modelParser.ParseException;\r
 import org.simantics.sysdyn.modelParser.Token;\r
 import org.simantics.sysdyn.modelParser.TokenMgrError;\r
-import org.simantics.sysdyn.manager.FunctionUtils;\r
 import org.simantics.sysdyn.ui.properties.widgets.expressions.ExpressionField;\r
 import org.simantics.ui.SimanticsUI;\r
 import org.simantics.ui.utils.AdaptionUtils;\r
@@ -196,8 +194,6 @@ public class FunctionCodeWidget implements Widget {
                                                function, \r
                                                SysdynResource.getInstance(graph).SysdynModelicaFunction_modelicaFunctionCode, \r
                                                code);\r
-                               Resource library = graph.getSingleObject(function, Layer0.getInstance(graph).PartOf);\r
-                               FunctionUtils.updateFunctionFileForLibrary(graph, library);\r
                        }\r
                });\r
     }\r
index 989c5cdbc49e73c929de9e02de1bf7e40c1aab03..2658fb650c2e903dbf974a4b0e33e3a8bba028fc 100644 (file)
@@ -8,7 +8,6 @@ import org.simantics.db.common.request.WriteRequest;
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.layer0.Layer0;\r
 import org.simantics.sysdyn.SysdynResource;\r
-import org.simantics.sysdyn.manager.FunctionUtils;\r
 import org.simantics.sysdyn.ui.browser.nodes.FunctionLibraryNode;\r
 import org.simantics.ui.SimanticsUI;\r
 import org.simantics.ui.utils.ResourceAdaptionUtils;\r
@@ -49,14 +48,10 @@ public class SharedFunctionsFolderNode extends FunctionLibraryNode<Resource> imp
                                        for(Resource tobeMoved : resources) {\r
                                                if(graph.isInstanceOf(tobeMoved, sr.SysdynModelicaFunction) ||\r
                                                                graph.isInstanceOf(tobeMoved, sr.SysdynModelicaFunctionLibrary)) {\r
-                                                       Resource oldLib = graph.getSingleObject(tobeMoved, l0.PartOf);\r
                                                        graph.deny(tobeMoved, l0.PartOf);\r
                                                        graph.claim(tobeMoved, l0.PartOf, library);\r
-                                                       FunctionUtils.updateFunctionFileForLibrary(graph, oldLib);\r
-                                                       FunctionUtils.updateFunctionFileForLibrary(graph, library);\r
                                                }\r
                                        }\r
-                                       \r
                                }\r
                        });\r
                }\r
index 86f10c2c42b42a1ba3d002bd691ba381f45887d4..ee679124cd6da56c7f1fdc695145d62e12f5ef01 100644 (file)
@@ -46,7 +46,6 @@ import org.simantics.graph.representation.TransferableGraph1;
 import org.simantics.layer0.Layer0;\r
 import org.simantics.layer0.utils.direct.GraphUtils;\r
 import org.simantics.sysdyn.SysdynResource;\r
-import org.simantics.sysdyn.manager.FunctionUtils;\r
 import org.simantics.ui.SimanticsUI;\r
 import org.simantics.utils.datastructures.ArrayMap;\r
 \r
@@ -387,10 +386,7 @@ public class WizardFunctionsImportPage extends WizardPage{
                                                } \r
                                                graph.deny(root, l0.PartOf);\r
                                                error = type;\r
-                                       } else {\r
-                                               FunctionUtils.updateFunctionFileForLibrary(graph, selectedModel);\r
                                        }\r
-\r
                                }\r
                        });\r
                } catch (DatabaseException e) {\r
index 38a3e9992542a9e1f9bb1c549714818e093a7b38..dbfb5c45ca20d59697cd7a373693a02a77820b17 100644 (file)
@@ -173,11 +173,12 @@ public abstract class IndexVariable<T> extends AbstractPropertyVariable {
         \r
         Variable var = parent.getParent(graph);\r
         Resource represents = var.getRepresents(graph);\r
-        Resource experiment = null;\r
+        \r
+        Resource activeRun = null;\r
         while(represents != null && !graph.isInstanceOf(represents, MOD.StructuralModel)) {\r
 \r
-            if(graph.isInstanceOf(represents, SIMU.Experiment)) {\r
-                       experiment = represents;\r
+            if(graph.isInstanceOf(represents, SIMU.Run)) {\r
+                activeRun = represents;\r
                        break;\r
                }\r
                \r
@@ -186,9 +187,9 @@ public abstract class IndexVariable<T> extends AbstractPropertyVariable {
         }\r
 \r
         IProject project = Simantics.peekProject();\r
-        if(experiment != null && project != null) {\r
+        if(activeRun != null && project != null) {\r
                IExperimentManager expMan = project.getHint(IExperimentManager.KEY_EXPERIMENT_MANAGER);\r
-               IExperiment e = expMan.getExperiment(NameUtils.getSafeName(graph, experiment));\r
+               IExperiment e = expMan.getExperiment(NameUtils.getSafeName(graph, activeRun));\r
                if(e instanceof SysdynExperiment)\r
                        this.experiment = (SysdynExperiment)e;\r
         }\r
index 2a12c789b77cfef3c66eff25a15cc387c35557a7..097b51edce7cd4f7c73dc2448f84af81e2ff4904 100644 (file)
@@ -31,13 +31,12 @@ import org.simantics.db.common.request.ReadRequest;
 import org.simantics.db.common.utils.NameUtils;\r
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.layer0.Layer0;\r
-import org.simantics.simulation.ontology.SimulationResource;\r
 import org.simantics.sysdyn.Activator;\r
 import org.simantics.sysdyn.SysdynResource;\r
 \r
 public class FunctionUtils {\r
        \r
-       public static List<String> getLibraryPathsForModelica(final SysdynModel model) {\r
+       public static List<String> getLibraryPathsForModelica(final SysdynExperiment sysdynExperiment) {\r
                final ArrayList<String> paths = new ArrayList<String>();\r
                \r
                try {\r
@@ -45,22 +44,18 @@ public class FunctionUtils {
                                \r
                                @Override\r
                                public void run(ReadGraph graph) throws DatabaseException {\r
-                                       SysdynResource sr = SysdynResource.getInstance(graph);\r
-                                       SimulationResource simu = SimulationResource.getInstance(graph);\r
-                                       \r
-                                       Set<Resource> parents = getParents(graph, model, true);\r
-                                       for(Resource parent : parents) {\r
-                                               if(graph.isInstanceOf(parent, sr.SysdynModel)) {\r
-                                                       Resource configuration = graph.getPossibleObject(parent, simu.HasConfiguration);\r
-                                                       if(configuration.equals(model.getConfigurationResource())) {\r
-                                                               String parentName = NameUtils.getSafeName(graph, parent);\r
-                                                               paths.add(parentName + "_functions.mo");\r
-                                                       }\r
-                                               } else {\r
-                                                       String libraryname = NameUtils.getSafeName(graph, parent);\r
-                                                       paths.add("..\\\\\\\\..\\\\\\\\libraries\\\\\\\\functions\\\\\\\\" + libraryname + ".mo");\r
-                                               }\r
-                                       }\r
+                                   SysdynResource sr = SysdynResource.getInstance(graph);\r
+\r
+                                   Set<Resource> parents = getParents(graph, sysdynExperiment.getModel(), true);\r
+                                   for(Resource parent : parents) {\r
+                                       if(graph.isInstanceOf(parent, sr.SysdynModel)) {\r
+                                           String parentName = NameUtils.getSafeName(graph, parent);\r
+                                           paths.add(parentName + "_functions.mo");\r
+                                       } else {\r
+                                           String libraryname = NameUtils.getSafeName(graph, parent);\r
+                                           paths.add("..\\\\\\\\..\\\\\\\\libraries\\\\\\\\functions\\\\\\\\" + libraryname + ".mo");\r
+                                       }\r
+                                   }\r
                                }\r
                        });\r
                } catch (DatabaseException e) {\r
@@ -70,19 +65,17 @@ public class FunctionUtils {
                return paths;\r
        }\r
        \r
-       private static Set<Resource> getParents(ReadGraph graph, SysdynModel model, boolean onlyWithContent) throws DatabaseException{\r
+       private static Set<Resource> getParents(ReadGraph graph, Resource model, boolean onlyWithContent) throws DatabaseException{\r
                HashSet<Resource> parents = new HashSet<Resource>();\r
 \r
+        if(model == null)\r
+            return parents;\r
+        \r
                Layer0 l0 = Layer0.getInstance(graph);\r
                SysdynResource sr = SysdynResource.getInstance(graph);\r
-               SimulationResource simu = SimulationResource.getInstance(graph);\r
-               Resource modelResource = graph.getPossibleObject(model.getConfigurationResource(), simu.IsConfigurationOf);\r
-               if(modelResource == null)\r
-                   return parents;\r
-               \r
-               parents.add(modelResource);\r
-               \r
-               for(Resource r : graph.getObjects(modelResource, l0.IsLinkedTo)) {\r
+\r
+               parents.add(model);\r
+               for(Resource r : graph.getObjects(model, l0.IsLinkedTo)) {\r
                        if(graph.isInstanceOf(r, sr.SharedFunctionOntology)) {\r
                                parents.add(r);\r
                        } else {\r
@@ -125,15 +118,15 @@ public class FunctionUtils {
                return false;\r
        }\r
        \r
-       public static void updateFunctionFilesForModel(ReadGraph graph, SysdynModel model) throws DatabaseException {\r
+       public static void updateFunctionFilesForExperiment(ReadGraph graph, SysdynExperiment experiment) throws DatabaseException {\r
                SysdynResource sr = SysdynResource.getInstance(graph);\r
                \r
-               Set<Resource> parents = getParents(graph, model, false);\r
+               Set<Resource> parents = getParents(graph, experiment.getModel(), false);\r
                \r
                for(Resource parent : parents) {\r
                        if(graph.isInstanceOf(parent, sr.SysdynModel)) {\r
                                String parentName = NameUtils.getSafeName(graph, parent);\r
-                               File scriptFile = new File(model.getSimulationDir(), parentName + "_functions.mo");\r
+                               File scriptFile = new File(experiment.getSimulationDir(), parentName + "_functions.mo");\r
                                updateFunctionFile(graph, parent, scriptFile, false);\r
                        } else {\r
                                updateFunctionFileForLibrary(graph, parent);\r
@@ -142,6 +135,7 @@ public class FunctionUtils {
                return;\r
        }\r
        \r
+       /*\r
        private static File getDir(ReadGraph graph, Resource resource) throws DatabaseException {\r
                SysdynResource sr = SysdynResource.getInstance(graph);\r
                Layer0 l0 = Layer0.getInstance(graph);\r
@@ -171,13 +165,18 @@ public class FunctionUtils {
                }\r
                return dir;\r
        }\r
+       */\r
 \r
-       public static void createExternalFunctionFile(ReadGraph graph, Resource externalFunction) throws DatabaseException {\r
+       public static void createExternalFunctionFile(ReadGraph graph, Resource externalFunction, File scriptFile) throws DatabaseException {\r
                SysdynResource sr = SysdynResource.getInstance(graph);\r
-               Layer0 l0 = Layer0.getInstance(graph);\r
 \r
-               Resource function = graph.getSingleObject(externalFunction, l0.PartOf);\r
-               File dir = getDir(graph, function);\r
+               File dir = scriptFile.getParentFile();\r
+               \r
+               if(!dir.exists())\r
+                   dir.mkdir();\r
+               \r
+               if(!dir.isDirectory())\r
+                   return;\r
 \r
                try {\r
                        String name = NameUtils.getSafeName(graph, externalFunction);\r
@@ -192,54 +191,32 @@ public class FunctionUtils {
                }\r
        }\r
        \r
-       public static void removeExternalFunctionFile(ReadGraph graph, Resource externalFunction) throws DatabaseException {\r
-               Layer0 l0 = Layer0.getInstance(graph);\r
+       \r
+       protected static void updateFunctionFileForLibrary(ReadGraph graph, Resource library) throws DatabaseException {\r
+           Layer0 l0 = Layer0.getInstance(graph);\r
 \r
-               Resource function = graph.getSingleObject(externalFunction, l0.PartOf);\r
-               File dir = getDir(graph, function);\r
-               String name = NameUtils.getSafeName(graph, externalFunction);\r
-               File file = new File(dir, name);\r
-               file.delete();\r
-       }\r
+           while(!graph.isInstanceOf(library, l0.Ontology)) {\r
+               library = graph.getSingleObject(library, l0.PartOf);\r
+           }\r
 \r
-       \r
-       \r
-       public static void updateFunctionFileForLibrary(ReadGraph graph, Resource library) throws DatabaseException {\r
-               SysdynResource sr = SysdynResource.getInstance(graph);\r
-               Layer0 l0 = Layer0.getInstance(graph);\r
-               \r
-               while(!graph.isInstanceOf(library, sr.SysdynModel) && !graph.isInstanceOf(library, l0.Ontology)) {\r
-                       library = graph.getSingleObject(library, l0.PartOf);\r
-               }\r
-               \r
-               if(graph.isInstanceOf(library, sr.SysdynModel)) {\r
-                       SimulationResource simu = SimulationResource.getInstance(graph);\r
-                       Resource configuration = graph.getSingleObject(library, simu.HasConfiguration);\r
-                       SysdynModelManager smm = SysdynModelManager.getInstance(graph.getSession());\r
-                       SysdynModel model = smm.getModel(graph, configuration);\r
-                       updateFunctionFilesForModel(graph, model);\r
-               } else {\r
-               \r
-                       File librariesDir  = Activator.getBundleContext().getDataFile("libraries");\r
-                       if (!librariesDir.exists()) {\r
-                               librariesDir.mkdir();\r
-                       }\r
-                       File dir = new File(librariesDir, "functions");\r
-                       if (!dir.exists()) {\r
-                               dir.mkdir();\r
-                       }\r
-                       String parentName = NameUtils.getSafeName(graph, library);\r
-                       File scriptFile = new File(dir, parentName + ".mo");\r
-                       \r
-                       Resource sysdyn = graph.getResource("http://www.simantics.org/Sysdyn-1.1");\r
+           File librariesDir  = Activator.getBundleContext().getDataFile("libraries");\r
+           if (!librariesDir.exists()) {\r
+               librariesDir.mkdir();\r
+           }\r
+           File dir = new File(librariesDir, "functions");\r
+           if (!dir.exists()) {\r
+               dir.mkdir();\r
+           }\r
+           String parentName = NameUtils.getSafeName(graph, library);\r
+           File scriptFile = new File(dir, parentName + ".mo");\r
 \r
-                       if(library.equals(sysdyn)) {\r
-                               updateFunctionFile(graph, library, scriptFile, true);\r
-                       } else {\r
-                               updateFunctionFile(graph, library, scriptFile, false);\r
-                       }\r
-               }\r
-                \r
+           Resource sysdyn = graph.getResource("http://www.simantics.org/Sysdyn-1.1");\r
+\r
+           if(library.equals(sysdyn)) {\r
+               updateFunctionFile(graph, library, scriptFile, true);\r
+           } else {\r
+               updateFunctionFile(graph, library, scriptFile, false);\r
+           }\r
 \r
        }\r
        \r
@@ -256,28 +233,28 @@ public class FunctionUtils {
                String name = NameUtils.getSafeName(graph, library);\r
                if(!builtIn && !graph.isInstanceOf(library, sr.SysdynModel))\r
                        s.println("package " + name);\r
-               writeLibrary(graph, library, s, builtIn);\r
+               writeLibrary(graph, library, scriptFile, s, builtIn);\r
                if(!builtIn && !graph.isInstanceOf(library, sr.SysdynModel))\r
                        s.println("end " + name + ";\n");\r
                \r
                s.close();\r
        }\r
        \r
-       private static void writeLibrary(ReadGraph graph, Resource library, PrintStream stream, boolean builtIn) throws DatabaseException {\r
+       private static void writeLibrary(ReadGraph graph, Resource library, File scriptFile, PrintStream stream, boolean builtIn) throws DatabaseException {\r
                Layer0 l0 = Layer0.getInstance(graph);\r
                SysdynResource sr = SysdynResource.getInstance(graph);\r
-               writeLibraryFunctions(graph, library, stream);\r
+               writeLibraryFunctions(graph, library, scriptFile, stream);\r
                for(Resource sublibrary : graph.syncRequest(new ObjectsWithType(library, l0.ConsistsOf, sr.SysdynModelicaFunctionLibrary))) {\r
                        String name = NameUtils.getSafeName(graph, sublibrary);\r
                        if(!builtIn)\r
                                stream.println("encapsulated package " + name);\r
-                       writeLibrary(graph, sublibrary, stream, builtIn);\r
+                       writeLibrary(graph, sublibrary, scriptFile, stream, builtIn);\r
                        if(!builtIn)\r
                                stream.println("end " + name + ";\n");\r
                }\r
        }\r
        \r
-       private static void writeLibraryFunctions(ReadGraph graph, Resource library, PrintStream stream) throws DatabaseException {\r
+       private static void writeLibraryFunctions(ReadGraph graph, Resource library, File scriptFile, PrintStream stream) throws DatabaseException {\r
                Layer0 l0 = Layer0.getInstance(graph);\r
                SysdynResource sr = SysdynResource.getInstance(graph);\r
                for(Resource function : graph.syncRequest(new ObjectsWithType(library, l0.ConsistsOf, sr.SysdynModelicaFunction))) {\r
@@ -287,7 +264,7 @@ public class FunctionUtils {
                        stream.println(functionCode);\r
                        stream.println("end " + name + ";\n");\r
                        for(Resource externalFunction : graph.syncRequest(new ObjectsWithType(function, l0.ConsistsOf, sr.ExternalFunctionFile))) {\r
-                               createExternalFunctionFile(graph, externalFunction);\r
+                               createExternalFunctionFile(graph, externalFunction, scriptFile);\r
                        }\r
                }\r
        }\r
index 30d161eefcec5962696fab901e11a78141934d1b..e6a042683ca6634b827d2d1203e73e1663717940 100644 (file)
@@ -19,8 +19,10 @@ import java.io.FileNotFoundException;
 import java.io.IOException;\r
 import java.io.StringReader;\r
 import java.util.ArrayList;\r
+import java.util.Arrays;\r
 import java.util.Collection;\r
 import java.util.HashMap;\r
+import java.util.List;\r
 import java.util.Map;\r
 import java.util.UUID;\r
 import java.util.concurrent.locks.Lock;\r
@@ -52,13 +54,13 @@ import org.simantics.simulation.experiment.ExperimentState;
 import org.simantics.simulation.experiment.IDynamicExperiment;\r
 import org.simantics.simulation.experiment.IExperimentListener;\r
 import org.simantics.simulation.ontology.SimulationResource;\r
+import org.simantics.sysdyn.Activator;\r
 import org.simantics.sysdyn.SysdynResource;\r
 import org.simantics.sysdyn.adapter.VariableValueSubscription;\r
 import org.simantics.sysdyn.modelica.ModelicaWriter;\r
 import org.simantics.sysdyn.representation.Configuration;\r
 import org.simantics.sysdyn.representation.Model;\r
 import org.simantics.sysdyn.simulation.SimulationScheduler;\r
-import org.simantics.sysdyn.manager.SysdynInitKeys;\r
 \r
 public class SysdynExperiment extends Experiment implements IDynamicExperiment, VariableSubscriptionManager {\r
 \r
@@ -78,11 +80,14 @@ public class SysdynExperiment extends Experiment implements IDynamicExperiment,
        protected ExperimentState                       sysdynExperimentState;\r
        \r
     private SysdynResult                            result;\r
+    private File                                    simulationDir;\r
 \r
+    protected String                                experimentName;\r
+    \r
        public static SysdynExperiment                                  INSTANCE;\r
 \r
-       public SysdynExperiment(Resource experiment, Resource model, String identifier) {\r
-               super(experiment, model, identifier);\r
+       public SysdynExperiment(Resource experiment, Resource model) {\r
+               super(experiment, model);\r
                INSTANCE = this;\r
        }\r
 \r
@@ -109,6 +114,12 @@ public class SysdynExperiment extends Experiment implements IDynamicExperiment,
         * @param g ReadGraph\r
         */\r
        public void init(ReadGraph g) {\r
+           try {\r
+            this.experimentName = NameUtils.getSafeName(g, experiment);\r
+        } catch (DatabaseException e) {\r
+            this.experimentName = "Experiment";\r
+        }\r
+           \r
                this.session = g.getSession();\r
                state = ExperimentState.STOPPED;\r
                for(IExperimentListener listener : listeners.getListeners())\r
@@ -376,15 +387,56 @@ public class SysdynExperiment extends Experiment implements IDynamicExperiment,
         * @return\r
         * @throws IOException\r
         */\r
-       protected static SimulationLocation createSimulationFiles(SysdynModel sysdynModel, String modelText, HashMap<String, String> inits, String additionalScript, boolean fmu) throws IOException {\r
+       protected SimulationLocation createSimulationFiles(SysdynModel sysdynModel, String modelText, HashMap<String, String> inits, String additionalScript, boolean fmu) throws IOException {\r
+           File simulationDir = getSimulationDir();\r
+\r
+           // update all function files. both the model's and built-in\r
+           try {\r
+               final SysdynExperiment experiment = this;\r
+            session.syncRequest(new ReadRequest() {\r
+                \r
+                @Override\r
+                public void run(ReadGraph graph) throws DatabaseException {\r
+                    FunctionUtils.updateFunctionFilesForExperiment(graph, experiment);\r
+                }\r
+            });\r
+        } catch (DatabaseException e) {\r
+            e.printStackTrace();\r
+        }\r
+           \r
                return ModelicaManager.createSimulationFiles(\r
-                               sysdynModel.getSimulationDir(),\r
+                       simulationDir,\r
                                sysdynModel.getConfiguration().getLabel(),\r
                                modelText,\r
                                inits,\r
                                additionalScript,\r
                                fmu);\r
        }\r
+       \r
+    /**\r
+     * Get a simulation directory for this model\r
+     * @return File directory\r
+     */\r
+    public File getSimulationDir() {\r
+        if(simulationDir == null) {\r
+            File modelsDir = Activator.getBundleContext().getDataFile("models");\r
+            String experimentName = this.experimentName;\r
+            List<String> files = Arrays.asList(modelsDir.list());\r
+            if (files.contains(experimentName)) {\r
+                int i = 2;\r
+                while (files.contains(experimentName + "_" + i)){\r
+                    i++;\r
+                }\r
+                experimentName += "_" + i;\r
+            }\r
+\r
+            simulationDir  = Activator.getBundleContext().getDataFile("models/" + experimentName);\r
+            if (!simulationDir.exists()) {\r
+                simulationDir.mkdir();\r
+            }\r
+        }\r
+        return simulationDir;\r
+    }\r
 \r
        /**\r
         * \r
@@ -392,7 +444,7 @@ public class SysdynExperiment extends Experiment implements IDynamicExperiment,
         */\r
        protected String getAdditionalScripts() {\r
                StringBuilder functionscript = new StringBuilder();\r
-               for(String path : FunctionUtils.getLibraryPathsForModelica(sysdynModel)) {\r
+               for(String path : FunctionUtils.getLibraryPathsForModelica(this)) {\r
                        functionscript.append("loadFile(\"" + path + "\");\n"); \r
                }\r
                return functionscript.toString();\r
index 2cb85d4c72bf29c1ec474d3da62dbf239739a68c..399d6fd3325c4c023556d391fe45a617a7f1b55d 100644 (file)
@@ -53,8 +53,8 @@ public class SysdynGameExperiment extends SysdynExperiment {
        public static double DEFAULT_STEP_LENGTH        = 0.1;\r
        public static int DEFAULT_OUTPUT_INTERVAL       = 1;\r
        \r
-       public SysdynGameExperiment(Resource experiment, Resource model, String identifier) {\r
-               super(experiment, model, identifier);\r
+       public SysdynGameExperiment(Resource experiment, Resource model) {\r
+               super(experiment, model);\r
        }\r
 \r
        public double getStepDuration() {\r
index a52351f87df0b835c3989e37f980068f78ee7195..00379a9c11359dae8499420086473f4b5eb975b3 100644 (file)
@@ -13,13 +13,10 @@ package org.simantics.sysdyn.manager;
 \r
 import gnu.trove.set.hash.THashSet;\r
 \r
-import java.io.File;\r
 import java.util.ArrayList;\r
-import java.util.Arrays;\r
 import java.util.Collection;\r
 import java.util.HashMap;\r
 import java.util.HashSet;\r
-import java.util.List;\r
 import java.util.Map;\r
 import java.util.Set;\r
 import java.util.concurrent.CopyOnWriteArrayList;\r
@@ -49,7 +46,6 @@ import org.simantics.simulation.project.ExperimentRuns;
 import org.simantics.simulation.project.IExperimentActivationListener;\r
 import org.simantics.simulation.project.IExperimentManager;\r
 import org.simantics.structural.stubs.StructuralResource2;\r
-import org.simantics.sysdyn.Activator;\r
 import org.simantics.sysdyn.SysdynResource;\r
 import org.simantics.sysdyn.adapter.VariableValueSubscription;\r
 import org.simantics.sysdyn.representation.Configuration;\r
@@ -92,8 +88,6 @@ public class SysdynModel implements IMappingListener, IModel, VariableSubscripti
     @SuppressWarnings("rawtypes")\r
     private Map<Class, Object> services = new HashMap<Class, Object>();\r
 \r
-    private File simulationDir;\r
-\r
     /**\r
      * Recursively read all module configurations that are used in \r
      * configResource and its components children\r
@@ -394,13 +388,12 @@ public class SysdynModel implements IMappingListener, IModel, VariableSubscripti
             SysdynResource sr = SysdynResource.getInstance(g);\r
             IDynamicExperiment exp;\r
             \r
-            String name = NameUtils.getSafeName(g, experiment);\r
             if(g.isInstanceOf(experiment, sr.PlaybackExperiment)) {\r
-                exp = new SysdynPlaybackExperiment(experiment, modelResource, name);\r
+                exp = new SysdynPlaybackExperiment(experiment, modelResource);\r
             } else if(g.isInstanceOf(experiment, sr.GameExperiment)) {\r
-                exp = new SysdynGameExperiment(experiment, modelResource, name);\r
+                exp = new SysdynGameExperiment(experiment, modelResource);\r
             } else if(g.isInstanceOf(experiment, sr.BasicExperiment)) {\r
-                exp = new SysdynExperiment(experiment, modelResource, name);\r
+                exp = new SysdynExperiment(experiment, modelResource);\r
             } else {\r
                 return null;\r
             }\r
@@ -467,31 +460,6 @@ public class SysdynModel implements IMappingListener, IModel, VariableSubscripti
         return inits;\r
     }\r
 \r
-    /**\r
-     * Get a simulation directory for this model\r
-     * @return File directory\r
-     */\r
-    public File getSimulationDir() {\r
-        if(simulationDir == null) {\r
-            File modelsDir = Activator.getBundleContext().getDataFile("models");\r
-            String configName = configuration.getLabel();\r
-            List<String> files = Arrays.asList(modelsDir.list());\r
-            if (files.contains(configName)) {\r
-                int i = 2;\r
-                while (files.contains(configName + "_" + i)){\r
-                    i++;\r
-                }\r
-                configName += "_" + i;\r
-            }\r
-\r
-            simulationDir  = Activator.getBundleContext().getDataFile("models/" + configName);\r
-            if (!simulationDir.exists()) {\r
-                simulationDir.mkdir();\r
-            }\r
-        }\r
-        return simulationDir;\r
-    }\r
-\r
 \r
        @SuppressWarnings("rawtypes")\r
     /**\r
index efa5578c308a4ff8684811a32157dbfb478b0e93..82cf2f05e46126c3c67780added98b5e0ecb8692 100644 (file)
@@ -18,7 +18,6 @@ import org.simantics.db.Resource;
 import org.simantics.db.Session;\r
 import org.simantics.db.common.request.ReadRequest;\r
 import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.simulation.ontology.SimulationResource;\r
 \r
 /**\r
  * Manages system dynamic models.\r
@@ -48,7 +47,6 @@ public class SysdynModelManager {
                                public void run(ReadGraph graph) throws DatabaseException {\r
                                        SysdynModel model = new SysdynModel(graph, resource);\r
                                    models.put(resource, model);\r
-                                   FunctionUtils.updateFunctionFilesForModel(graph, model);\r
                                }\r
                            });\r
                    } catch (DatabaseException e) {\r
@@ -71,14 +69,6 @@ public class SysdynModelManager {
                if(model == null) {\r
                    model = new SysdynModel(g, resource);\r
                    models.put(resource, model);\r
-                try {\r
-                       SimulationResource simu = SimulationResource.getInstance(g);\r
-                       Resource modelResource = g.getPossibleObject(model.getConfigurationResource(), simu.IsConfigurationOf);\r
-                       if(modelResource != null)\r
-                               FunctionUtils.updateFunctionFilesForModel(g, model);\r
-                               } catch (DatabaseException e) {\r
-                                       e.printStackTrace();\r
-                               }\r
                }\r
                return model;\r
        }\r
index 29102b9c381da873421341a52a2ae950d65bcbec..7e5690cb4fc35991e2ddd0a1c21d6c1464500466 100644 (file)
@@ -44,8 +44,8 @@ public class SysdynPlaybackExperiment extends SysdynExperiment implements IDynam
     ScheduledExecutorService playbackExecutionService;\r
     PlaybackConfiguration playbackConfiguration;\r
 \r
-    public SysdynPlaybackExperiment(Resource experiment, Resource model, String identifier) {\r
-        super(experiment, model, identifier);\r
+    public SysdynPlaybackExperiment(Resource experiment, Resource model) {\r
+        super(experiment, model);\r
         this.time = 0;\r
     }\r
 \r