]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Build preparations (refs #3646)
authorlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Fri, 14 Dec 2012 13:41:33 +0000 (13:41 +0000)
committerlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Fri, 14 Dec 2012 13:41:33 +0000 (13:41 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@26520 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.sysdyn.feature/feature.xml
org.simantics.sysdyn.ui/plugin.xml
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/SysdynBrowser.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/utils/ArrayVariableUtils.java
org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynGameExperiment.java
org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Module.java
org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Sheet.java
org.simantics.sysdyn/src/org/simantics/sysdyn/representation/utils/IndexUtils.java

index 23193a92a1e22d5969b6452299a7ef8a66b6a9f8..8399d120976a7a8bfa592b6e7d2b0196aa0c829a 100644 (file)
@@ -53,9 +53,8 @@
          version="0.0.0"/>\r
 \r
    <includes\r
-         id="org.simantics.operating"\r
-         version="0.0.0"\r
-         optional="true"/>\r
+         id="org.simantics.eclipsec.launcher"\r
+         version="0.0.0"/>\r
 \r
    <plugin\r
          id="org.simantics.objmap"\r
          id="org.simantics.fmu.me.win32"\r
          download-size="0"\r
          install-size="0"\r
+         version="0.0.0"/>\r
+<!--\r
+   <plugin\r
+         id="org.simantics.document.ontology2"\r
+         download-size="0"\r
+         install-size="0"\r
          version="0.0.0"\r
          unpack="false"/>\r
 \r
+   <plugin\r
+         id="org.simantics.document.server"\r
+         download-size="0"\r
+         install-size="0"\r
+         version="0.0.0"\r
+         unpack="false"/>\r
+\r
+   <plugin\r
+         id="org.simantics.document.vaadin"\r
+         download-size="0"\r
+         install-size="0"\r
+         version="0.0.0"\r
+         unpack="false"/>\r
+\r
+   <plugin\r
+         id="org.simantics.document.workbench"\r
+         download-size="0"\r
+         install-size="0"\r
+         version="0.0.0"\r
+         unpack="false"/>\r
+\r
+   <plugin\r
+         id="org.simantics.document.workbench.ontology"\r
+         download-size="0"\r
+         install-size="0"\r
+         version="0.0.0"\r
+         unpack="false"/>\r
+\r
+   <plugin\r
+         id="org.simantics.views2.swt"\r
+         download-size="0"\r
+         install-size="0"\r
+         version="0.0.0"\r
+         unpack="false"/>\r
+\r
+   <plugin\r
+         id="org.simantics.swt.ontology"\r
+         download-size="0"\r
+         install-size="0"\r
+         version="0.0.0"\r
+         unpack="false"/>\r
+-->\r
 </feature>\r
index d39c13f3a4f0edff9b0d460a7b8a08e27b6e0923..5c5f8544a3c86f1190d9ab80960e7409fc43e8f4 100644 (file)
                   </with>\r
                </visibleWhen>\r
             </command>\r
-           -->\r
+            -->\r
          </menu>\r
          <dynamic\r
                class="org.simantics.ui.contribution.OpenWithMenuContribution"\r
index 74eeb77d7ec174f8710f1e2db275550ad72257a2..57986157c159517d2fc2587fec68bc66abaf733f 100644 (file)
@@ -51,7 +51,7 @@ public class SysdynBrowser extends GraphExplorerView {
             "http://www.simantics.org/Sysdyn-1.1/Browser",  \r
             /*"http://www.simantics.org/Operating-1.1/Browser", \r
              * Operating interfaces are not functioning properly. They have not been maintained. */ \r
-            "http://www.simantics.org/Documentation-1.1/OldBrowser",\r
+            "http://www.simantics.org/DocumentWorkbench-1.0/OldBrowser",\r
             "http://www.simantics.org/Image-1.1/Browser"));    \r
 \r
     private BinaryFunction<Object[], GraphExplorer, Object[]> selectionTransformation = new BinaryFunction<Object[], GraphExplorer, Object[]>() {\r
index ef49ba467a17a0ae6c8c8e6551968681799df641..26079fca1a419bc4f07cbdc7b88d099023704ae8 100644 (file)
@@ -85,7 +85,8 @@ public class ArrayVariableUtils {
             for(String r : rangeComponents) {\r
                 r = r.trim();\r
                 boolean componentIsValid = false;\r
-                for(EnumerationIndex ei : enumerations.get(i).getEnumerationIndexes()) {\r
+                Enumeration enumeration = enumerations.get(i);\r
+                for(EnumerationIndex ei : enumeration.getEnumerationIndexes()) {\r
                     if(ei.getName().equals(r)) {\r
                         componentIsValid = true;\r
                         break;\r
@@ -96,8 +97,8 @@ public class ArrayVariableUtils {
                     try {\r
                         int index = Integer.parseInt(r);\r
                         int min = 1;\r
-                        int max = enumerations.get(i).getEnumerationIndexes().size();\r
-                        if(index >= min && index <= max) {\r
+                        int max = enumeration.getEnumerationIndexes().size();\r
+                        if(index >= min && index <= max || enumeration.isReplaceable()) {\r
                             componentIsValid = true;\r
                             error = new SyntaxError();\r
                             error.setMessage("Using numbers as array indexes is not encouraged");\r
@@ -105,7 +106,7 @@ public class ArrayVariableUtils {
                             result.put(i, error);\r
                         } else {\r
                             error = new SyntaxError();\r
-                            error.setMessage("Invalid array index " + index + ". Numbered index must be between " + min + " and " + max + " unless the enumeration is overridden. In that case, ignore this warning.");\r
+                            error.setMessage("Invalid array index " + index + ". Numbered index must be between " + min + " and " + max);\r
                             error.setType(ExpressionField.SYNTAX_ERROR);\r
                             result.put(i, error);\r
                         }\r
index defa0977607a26a0b15a1c622dfa0fff34882130..ed13664259f6a1a2c1cd65f438082fa3408400ec 100644 (file)
@@ -226,6 +226,7 @@ public class SysdynGameExperiment extends SysdynExperiment {
        \r
        private class simulateDurationJob extends Job {\r
 \r
+           private boolean canceled = false;\r
                private double duration;\r
                private final SysdynGameExperiment experiment;\r
                public simulateDurationJob(String name, SysdynGameExperiment experiment, double duration) {\r
@@ -233,6 +234,11 @@ public class SysdynGameExperiment extends SysdynExperiment {
                        this.duration = duration;\r
                        this.experiment = experiment;\r
                }\r
+               \r
+               @Override\r
+               protected void canceling() {\r
+                   canceled = true;\r
+               }\r
 \r
                @Override\r
                protected IStatus run(IProgressMonitor monitor) {\r
@@ -263,7 +269,7 @@ public class SysdynGameExperiment extends SysdynExperiment {
                                monitor.worked(1);\r
                                \r
                                int stepNumber = 1;\r
-                               while(control.getTime() < (eTime - 1e-9)) { // Substract a very small number, because OpenModelica is not very precise with its Real numbers\r
+                               while(control.getTime() < (eTime - 1e-9) && !canceled) { // Substract a very small number, because OpenModelica is not very precise with its Real numbers\r
                                        monitor.subTask("Simulate step (time = " + control.getTime() + ")");\r
                                        control.simulateStep();\r
                                        monitor.worked(1);\r
index 699085c6f0fbe8b9d4a42099040aac46658733e2..d9b329eff0ee1262a1c1d10bc25c220fbbeb3645 100644 (file)
@@ -130,12 +130,19 @@ public class Module implements IElement {
                StringBuilder redeclarations = new StringBuilder();\r
                if(!getRedeclarations().isEmpty()) {\r
 \r
+                   boolean first = true;\r
                        Iterator<Redeclaration> i = getRedeclarations().iterator();\r
                        while(i.hasNext()) {\r
                                Redeclaration rd = i.next();\r
-                               redeclarations.append(rd.getRedeclaration());\r
-                               if(i.hasNext())\r
-                                       redeclarations.append(",");\r
+                               String redeclaration = rd.getRedeclaration();\r
+                               if(redeclaration != null && !redeclaration.isEmpty()) {\r
+                    if(!first) {\r
+                        redeclarations.append(",");\r
+                    } else {\r
+                        first = false;\r
+                    }\r
+                                   redeclarations.append(redeclaration);\r
+                               }\r
                        }\r
                }\r
                return redeclarations.toString();\r
index a2deef14ffda0e5cc4c8df3e68024f0f351be3ca..92226cc84f732ec068f51308700a77920f4f784d 100644 (file)
@@ -157,19 +157,20 @@ public class Sheet extends org.simantics.sysdyn.representation.Variable {
     }\r
     \r
     private void addRange(String key, HashSet<String> usedCells, StringBuilder clazz) {\r
-        usedCells.add(key);\r
-        Object value = cells.get(key);\r
-        if(value instanceof String || value instanceof MutableString) {\r
-            try {\r
-                Double d = Double.parseDouble(value.toString());\r
-                value = d;\r
-            } catch (NumberFormatException e) {\r
-            }\r
-        } \r
+        if(usedCells.add(key)) {\r
+            Object value = cells.get(key);\r
+            if(value instanceof String || value instanceof MutableString) {\r
+                try {\r
+                    Double d = Double.parseDouble(value.toString());\r
+                    value = d;\r
+                } catch (NumberFormatException e) {\r
+                }\r
+            \r
 \r
-        if(value instanceof Double) {\r
-            Double d = (Double)value;\r
-            clazz.append("    parameter Real " + key + " = " + d + " /* Actual value read from init file */;\n");\r
+            if(value instanceof Double) {\r
+                Double d = (Double)value;\r
+                clazz.append("    parameter Real " + key + " = " + d + " /* Actual value read from init file */;\n");\r
+            }\r
         }\r
     }\r
     \r
index e2f5cf4550d0494f75febffbe61a8f5d0d1ebef2..137b6690bdcb10f868233033de0e08223469100d 100644 (file)
@@ -53,18 +53,21 @@ public class IndexUtils {
                        if(rangeToken.matches("[\\[\\]:]")) {\r
                                sb.append(rangeToken);\r
                        } else if (rangeToken.equals(",")) {\r
-                               sb.append(rangeToken);\r
-                               index++;\r
-                       } else if(rangeToken.equals(enumerations.get(index).getName())) {\r
-                               sb.append(":");\r
+                           sb.append(rangeToken);\r
+                           index++;\r
+                       } else if(index < enumerations.size()) {\r
+                           if(rangeToken.equals(enumerations.get(index).getName())) {\r
+                               sb.append(":");\r
+                           } else {\r
+                               int i = indexOf(enumerations.get(index), rangeToken);\r
+                               if(i >= 0)\r
+                                   sb.append(i);\r
+                               else\r
+                                   sb.append(rangeToken);\r
+                           }\r
                        } else {\r
-                               int i = indexOf(enumerations.get(index), rangeToken);\r
-                               if(i >= 0)\r
-                                       sb.append(i);\r
-                               else\r
-                                       sb.append(rangeToken);\r
+                           sb.append(rangeToken);\r
                        }\r
-\r
                }\r
                return sb.toString();\r
        }\r