]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Merged sysdyn trunk changes betwee r20633 and r20694 to simantics-1.4 branch
authorlehtonen <lehtonen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Mon, 2 May 2011 07:43:04 +0000 (07:43 +0000)
committerlehtonen <lehtonen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Mon, 2 May 2011 07:43:04 +0000 (07:43 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/branches@20695 ac1ea38d-2e2b-0410-8846-a27921b304fc

simantics-1.4/org.simantics.sysdyn.feature/feature.xml
simantics-1.4/org.simantics.sysdyn.ui/splash.bmp [new file with mode: 0644]
simantics-1.4/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/LabelPropertyTabContributor.java
simantics-1.4/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/utils/ExpressionUtils.java
simantics-1.4/org.simantics.sysdyn.ui/sysdyn.product
simantics-1.4/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/HistoryVariable.java
simantics-1.4/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/utils/IndexUtils.java

index 02b406c4b2a69f7d48c0b2b4e0c30389e74512bb..7b51cef13cd522ad45ba312e8833fdeea0a0619b 100644 (file)
          version="0.0.0"\r
          unpack="false"/>\r
 \r
-   <plugin\r
-         id="org.simantics.diagram.ontology"\r
-         download-size="0"\r
-         install-size="0"\r
-         version="0.0.0"\r
-         unpack="false"/>\r
-\r
-   <plugin\r
-         id="org.simantics.structural.ontology"\r
-         download-size="0"\r
-         install-size="0"\r
-         version="0.0.0"\r
-         unpack="false"/>\r
-\r
    <plugin\r
          id="org.simantics.sysdyn.ontology"\r
          download-size="0"\r
diff --git a/simantics-1.4/org.simantics.sysdyn.ui/splash.bmp b/simantics-1.4/org.simantics.sysdyn.ui/splash.bmp
new file mode 100644 (file)
index 0000000..cb932ea
Binary files /dev/null and b/simantics-1.4/org.simantics.sysdyn.ui/splash.bmp differ
index 2d9d76c65b06caa6632b95bd282ceef8f2d02c9e..b13a6fa207daa5d06a425e25903fdb95c934caa5 100644 (file)
@@ -1,24 +1,58 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
 package org.simantics.sysdyn.ui.properties;\r
 \r
 import org.eclipse.jface.viewers.ISelection;\r
+import org.eclipse.swt.events.DisposeEvent;\r
+import org.eclipse.swt.events.DisposeListener;\r
+import org.eclipse.swt.widgets.Composite;\r
+import org.eclipse.ui.IWorkbenchSite;\r
 import org.simantics.browsing.ui.swt.PropertyTabContributorImpl;\r
+import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupportImpl;\r
 import org.simantics.db.AsyncReadGraph;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.management.ISessionContext;\r
 import org.simantics.db.procedure.AsyncListener;\r
 import org.simantics.db.request.Read;\r
 import org.simantics.layer0.Layer0;\r
+import org.simantics.modeling.ModelingResources;\r
 import org.simantics.ui.SimanticsUI;\r
 import org.simantics.ui.utils.AdaptionUtils;\r
 import org.simantics.utils.datastructures.Callback;\r
 \r
 public abstract class LabelPropertyTabContributor extends PropertyTabContributorImpl {\r
 \r
+       private boolean isDisposed = false;\r
        \r
+       \r
+       public void createControl(Composite parent, final IWorkbenchSite site, final ISessionContext context, final WidgetSupportImpl support) {\r
+               super.createControl(parent, site, context, support);\r
+               \r
+               // Add dispose listener to make sure name listening receives the correct isDisposed -value\r
+               parent.addDisposeListener(new DisposeListener() {\r
+                       \r
+                       @Override\r
+                       public void widgetDisposed(DisposeEvent e) {\r
+                               LabelPropertyTabContributor.this.dispose();\r
+                       }\r
+               });\r
+       }\r
+       \r
+       @Override\r
     public void updatePartName(ISelection forSelection, final Callback<String> updateCallback) {\r
-       final Resource r = AdaptionUtils.adaptToSingle(forSelection, Resource.class);\r
-       if(r == null) {\r
+       final Resource resource = AdaptionUtils.adaptToSingle(forSelection, Resource.class);\r
+       if(resource == null) {\r
                updateCallback.run("Selection properties");\r
                return;\r
        }\r
@@ -29,6 +63,11 @@ public abstract class LabelPropertyTabContributor extends PropertyTabContributor
                                @Override\r
                                public String perform(ReadGraph graph) throws DatabaseException {\r
                                        Layer0 l0 = Layer0.getInstance(graph);\r
+                                       ModelingResources mr = ModelingResources.getInstance(graph);\r
+                                       Resource r = resource;\r
+                                       if(graph.hasStatement(r, mr.ElementToComponent)) {\r
+                                               r = graph.getSingleObject(r, mr.ElementToComponent);\r
+                                       }\r
                                        String label = graph.getPossibleRelatedValue(r, l0.HasLabel);\r
                                        if(label != null)\r
                                                return label;\r
@@ -51,7 +90,7 @@ public abstract class LabelPropertyTabContributor extends PropertyTabContributor
 \r
                                @Override\r
                                public boolean isDisposed() {\r
-                                       return false;\r
+                                       return isDisposed;\r
                                }\r
                        });\r
                } catch (DatabaseException e) {\r
@@ -60,4 +99,9 @@ public abstract class LabelPropertyTabContributor extends PropertyTabContributor
                }\r
                \r
     }\r
+    \r
+    @Override\r
+    protected void dispose() {\r
+       this.isDisposed = true;\r
+    }\r
 }\r
index 180b2fc594aa0f2cee34a1ec013ee821b497c531..5297a2f5a5479dc28a9f6c2cddd52034011f35a7 100644 (file)
@@ -278,8 +278,9 @@ public class ExpressionUtils {
                                                boolean isFound = false;\r
                                                Enumeration e = (Enumeration)v;\r
                                                \r
-                                               // TODO: add .elements and .size  \r
-                                               if(enumeration.equals(et.image)) {\r
+                                               if(enumeration.equals(et.image) ||\r
+                                                               "size".equals(et.image) || \r
+                                                               "elements".equals(et.image)){\r
                                                        // The full enumeration\r
                                                        isFound = true;\r
                                                } else {\r
index 9b282a0c8ffca6e1a8f68ee3df3832cb5a19b77b..a95881864858fe90bc8ca32224b1d88995c96374 100644 (file)
@@ -14,6 +14,8 @@
 \r
    <windowImages/>\r
 \r
+   <splash\r
+      location="org.simantics.sysdyn.ui" />\r
    <launcher name="Simantics-Sysdyn">\r
       <solaris/>\r
       <win useIco="false">\r
index fdde1806207445e479d0676632609e22e0825545..1b0dfe75682440e222e05e856455f5d6d5df832f 100644 (file)
@@ -93,6 +93,14 @@ public class HistoryVariable extends ChildVariable {
                return super.getInterface(graph, clazz);\r
        }\r
        \r
+       @Override\r
+       public Variable getPossibleChild(ReadGraph graph, String name) throws DatabaseException {\r
+               try {\r
+                       return getChild(graph, name);\r
+               } catch (DatabaseException e) {\r
+                       return null;\r
+               }\r
+       }\r
        \r
        @Override\r
        public Variable getChild(ReadGraph graph, String name) throws DatabaseException {\r
index 6c379a42443d332b8f650265dc4b6d800594789c..a1693271c7448c8b19790fc9c6129afaa8b46ea9 100644 (file)
@@ -107,7 +107,7 @@ public class IndexUtils {
                        }\r
                        range.append("]");\r
                        \r
-                       Variable prevVar = getVariable(variable.getParentConfiguration(), prevToken);\r
+                       Variable prevVar = getVariable(variable.getParentConfiguration(), prevToken.trim());\r
                    result.append(rangeToIndexes(prevVar, range.toString()));\r
                } else {\r
                        result.append(nextToken);\r