]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
sysdyn project
authorniemisto <niemisto@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Wed, 18 Nov 2009 11:07:28 +0000 (11:07 +0000)
committerniemisto <niemisto@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Wed, 18 Nov 2009 11:07:28 +0000 (11:07 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@13115 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.sysdyn.ui/META-INF/MANIFEST.MF
org.simantics.sysdyn.ui/adapters.xml [new file with mode: 0644]
org.simantics.sysdyn.ui/plugin.xml
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/EquationView.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynPerspectiveFactory.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProject.java [new file with mode: 0644]
org.simantics.sysdyn/src/org/simantics/sysdyn/SysdynResource.java
sysdyn_ontologies/install.map
sysdyn_ontologies/sysdyn.graph

index 4274ee39ae3ec0dc480527774fcd368911dde7a3..a71d5a0586db6ab228b759381153e6b991cb7ea1 100644 (file)
@@ -14,4 +14,5 @@ Require-Bundle: org.simantics.h2d;bundle-version="1.0.0",
  org.eclipse.ui;bundle-version="3.5.0",
  org.eclipse.core.runtime;bundle-version="3.5.0",
  org.simantics.objmap;bundle-version="0.1.0",
- org.simantics.sysdyn;bundle-version="1.0.0"
+ org.simantics.sysdyn;bundle-version="1.0.0",
+ org.simantics.project;bundle-version="1.0.0"
diff --git a/org.simantics.sysdyn.ui/adapters.xml b/org.simantics.sysdyn.ui/adapters.xml
new file mode 100644 (file)
index 0000000..3af512f
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<adapters>\r
+       <target\r
+               interface="org.simantics.project.features.IProjectFeature">\r
+               <resource\r
+                       uri="http://www.simantics.org/Sysdyn#SysdynProject"\r
+                       class="org.simantics.sysdyn.ui.project.SysdynProject" />\r
+       </target>\r
+</adapters>
\ No newline at end of file
index 19dc2d0cb26c5982b075ecf81874de8bfa0e534e..6092710c65003ecaa279e141b989b17e992fa4d7 100644 (file)
             restorable="true">\r
       </view>\r
    </extension>\r
+   <extension\r
+         point="org.eclipse.ui.perspectives">\r
+      <perspective\r
+            class="org.simantics.sysdyn.ui.project.SysdynPerspectiveFactory"\r
+            id="org.simantics.sysdyn.ui.perspective"\r
+            name="System dynamics">\r
+      </perspective>\r
+   </extension>\r
 \r
 </plugin>\r
index ed3d88125dd84200c1bea309426d5b92d1ffb2ca..9a513a891ce9832be6fc1f1d1bc028d63e52d3e0 100644 (file)
@@ -80,7 +80,7 @@ public class EquationView extends ViewPart implements ISelectionListener {
         public void run(ReadGraph g) throws DatabaseException {\r
             SysdynResource sr = SysdynResource.getInstance(g);\r
             Builtins b = g.getBuiltins();\r
-            if(g.isInstanceOf(resource, sr.Auxiliary)) {\r
+            if(g.isInstanceOf(resource, sr.Auxiliary) || g.isInstanceOf(resource, sr.Valve)) {\r
                 auxiliary = resource;\r
                 final String name = g.getRelatedValue(resource, b.HasName);\r
                 final String value = g.getPossibleRelatedValue(resource, sr.HasValue);\r
@@ -93,7 +93,25 @@ public class EquationView extends ViewPart implements ISelectionListener {
                         else\r
                             originalText = value;\r
                         text.setText(originalText);\r
-                        setPartName(name + " equation");\r
+                        setPartName("Value of " + name);\r
+                    }\r
+                    \r
+                });\r
+            }\r
+            else if(g.isInstanceOf(resource, sr.Stock)) {\r
+                auxiliary = resource;\r
+                final String name = g.getRelatedValue(resource, b.HasName);\r
+                final String value = g.getPossibleRelatedValue(resource, sr.HasValue);\r
+                text.getDisplay().asyncExec(new Runnable() {\r
+\r
+                    @Override\r
+                    public void run() {\r
+                        if(value == null)\r
+                            originalText = "";\r
+                        else\r
+                            originalText = value;\r
+                        text.setText(originalText);\r
+                        setPartName("Initial value of " + name);\r
                     }\r
                     \r
                 });\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynPerspectiveFactory.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynPerspectiveFactory.java
new file mode 100644 (file)
index 0000000..9f6b257
--- /dev/null
@@ -0,0 +1,21 @@
+package org.simantics.sysdyn.ui.project;\r
+\r
+import org.eclipse.ui.IFolderLayout;\r
+import org.eclipse.ui.IPageLayout;\r
+import org.eclipse.ui.IPerspectiveFactory;\r
+\r
+public class SysdynPerspectiveFactory implements IPerspectiveFactory {\r
+\r
+    @Override\r
+    public void createInitialLayout(IPageLayout layout) {\r
+        layout.setEditorAreaVisible(true);\r
+        String editorArea = layout.getEditorArea();\r
+\r
+        IFolderLayout left = layout.createFolder("left", IPageLayout.LEFT, 0.25f, editorArea);\r
+        left.addView("org.simantics.ode.views.ontologyBrowser");\r
+        \r
+        IFolderLayout bottom = layout.createFolder("bottom", IPageLayout.BOTTOM, 0.75f, editorArea);\r
+        bottom.addView("org.simantics.sysdyn.ui.equation.view");\r
+    }\r
+\r
+}\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProject.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProject.java
new file mode 100644 (file)
index 0000000..7324bc4
--- /dev/null
@@ -0,0 +1,21 @@
+package org.simantics.sysdyn.ui.project;\r
+\r
+import org.simantics.project.ProjectKeys;\r
+import org.simantics.project.exception.ProjectException;\r
+import org.simantics.project.features.AbstractProjectFeature;\r
+\r
+public class SysdynProject extends AbstractProjectFeature {\r
+    private static final String DEFAULT_PERSPECTIVE = "org.simantics.sysdyn.ui.perspective";\r
+    \r
+    @Override\r
+    public void configure() throws ProjectException {\r
+        addToCollectionHint(ProjectKeys.PERSPECTIVES, DEFAULT_PERSPECTIVE);\r
+        addToCollectionHint(ProjectKeys.OPEN_PERSPECTIVES, DEFAULT_PERSPECTIVE);\r
+        getProjectElement().setHint(ProjectKeys.DEFAULT_PERSPECTIVE, DEFAULT_PERSPECTIVE);\r
+    }\r
+\r
+    @Override\r
+    public void deconfigure() throws ProjectException {\r
+    }\r
+\r
+}\r
index 5281df8f829ace3fd97e137e46c546956374d3fa..01448ff3128d4281db5cbdbb3f401c073ed2de8d 100644 (file)
@@ -33,7 +33,7 @@ public class SysdynResource {
     public final Resource IsHeadOf;\r
     public final Resource IsTailOf;\r
     public final Resource Stock;\r
-    public final Resource TestConfiguration;\r
+    public final Resource SysdynProject;\r
     public final Resource Valve;\r
     public final Resource Variable;\r
     \r
@@ -53,7 +53,7 @@ public class SysdynResource {
         public static final String IsHeadOf = "http://www.simantics.org/Sysdyn#IsHeadOf";\r
         public static final String IsTailOf = "http://www.simantics.org/Sysdyn#IsTailOf";\r
         public static final String Stock = "http://www.simantics.org/Sysdyn#Stock";\r
-        public static final String TestConfiguration = "http://www.simantics.org/Sysdyn#TestConfiguration";\r
+        public static final String SysdynProject = "http://www.simantics.org/Sysdyn#SysdynProject";\r
         public static final String Valve = "http://www.simantics.org/Sysdyn#Valve";\r
         public static final String Variable = "http://www.simantics.org/Sysdyn#Variable";\r
     }\r
@@ -83,7 +83,7 @@ public class SysdynResource {
         IsHeadOf = getResourceOrNull(graph, URIs.IsHeadOf);\r
         IsTailOf = getResourceOrNull(graph, URIs.IsTailOf);\r
         Stock = getResourceOrNull(graph, URIs.Stock);\r
-        TestConfiguration = getResourceOrNull(graph, URIs.TestConfiguration);\r
+        SysdynProject = getResourceOrNull(graph, URIs.SysdynProject);\r
         Valve = getResourceOrNull(graph, URIs.Valve);\r
         Variable = getResourceOrNull(graph, URIs.Variable);\r
     }\r
index 15cfc257565c0d1ec9cb45f69a23b476bee9c18a..a3fbef177ee493e9c5433aeda5e7b92743a0bf59 100644 (file)
@@ -1 +1 @@
-copy=org/simantics/sysdyn=../org.simantics.sysdyn.ui/src\r
+copy=org/simantics/sysdyn=../org.simantics.sysdyn/src\r
index eadd105a07e849a2499b6ec4d4dbd524dea5d36d..14f136075e5d7592e8a56e079cfb1ecfbfe5d0ef 100644 (file)
@@ -1,5 +1,6 @@
 %import "layer0.graph" L0\r
 %import "structural2.graph" ST\r
+%import "project.graph" PROJ\r
 \r
 %deflib L0.Type Sysdyn\r
 %deflib L0.Relation Sysdyn\r
 ######################################################################\r
 \r
 Sysdyn @ "Sysdyn-1.0" : L0.Ontology\r
-  L0.PartOf L0.TypeSystemProject\r
-  L0.PartOf L0.SimanticsDomain\r
-  L0.HasNamespace "http://www.simantics.org/Sysdyn" : L0.URI\r
-  L0.HasVersion "1.0" : L0.Version\r
-  L0.HasResourceClass "org.simantics.sysdyn.SysdynResource" : L0.String\r
-  L0.HasPackageName "sysdyn" : L0.String  \r
+    L0.PartOf L0.TypeSystemProject\r
+    L0.PartOf L0.SimanticsDomain\r
+    L0.HasNamespace "http://www.simantics.org/Sysdyn" : L0.URI\r
+    L0.HasVersion "1.0" : L0.Version\r
+    L0.HasResourceClass "org.simantics.sysdyn.SysdynResource" : L0.String\r
+    L0.HasPackageName "sysdyn" : L0.String  \r
 SysdynNamespace : L0.Namespace\r
-  L0.PartOf L0.TypeSystemNamespaces\r
-  L0.HasNamespace "http://www.simantics.org/Sysdyn" : L0.URI\r
-  L0.HasNamespaceRoot Sysdyn\r
+    L0.PartOf L0.TypeSystemNamespaces\r
+    L0.HasNamespace "http://www.simantics.org/Sysdyn" : L0.URI\r
+    L0.HasNamespaceRoot Sysdyn\r
 \r
+SysdynProject : PROJ.Feature\r
+    L0.PartOf Sysdyn\r
+    L0.PartOf PROJ.PublishedProjectFeatures\r
+    \r
+SysdynTest : PROJ.Project2\r
+    PROJ.HasFeature SysdynProject    \r
+    L0.PartOf L0.Projects    \r
+    \r
 ######################################################################\r
 # Configuration\r
 ######################################################################\r
@@ -78,18 +87,7 @@ Flow <T ST.Connection
 ######################################################################\r
 \r
 TestConfiguration : Configuration\r
-    L0.PartOf Sysdyn    \r
-    L0.ConsistsOf\r
-        Foo : Auxiliary\r
-            HasX "200.0" : L0.Double\r
-            HasY "100.0" : L0.Double\r
-        Bar : Auxiliary\r
-            HasX "100.0" : L0.Double\r
-            HasY "200.0" : L0.Double\r
-        _ : Dependency\r
-            HasTail Foo\r
-            HasHead Bar\r
-            HasAngle "0.5" : L0.Double\r
+    L0.PartOf SysdynTest\r
             \r
             \r
         \r