]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Merge changes I764df2ec,Ieb979991
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Wed, 14 Aug 2019 10:46:03 +0000 (10:46 +0000)
committerGerrit Code Review <gerrit2@simantics>
Wed, 14 Aug 2019 10:46:03 +0000 (10:46 +0000)
* changes:
  Switch from org.apache.log4j to org.slf4j.
  Added missing creation of RelatedElementRuleFactory.

bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/GraphExplorerImpl.java
bundles/org.simantics.db.common/src/org/simantics/db/common/utils/ListUtils.java
bundles/org.simantics.layer0/graph/Layer0Values.pgraph
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/markdown/html/SCLDocumentationExtensionNodeHandler.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/markdown/html/SclDoc.css
bundles/org.simantics.scl.db/scl/Simantics/DB.scl
bundles/org.simantics.selectionview.ontology/graph/Selectionview.pgraph

index 40c21585a7d83c5b0b6c6d1c89f845528af3ed50..6361401b48723f58aa62516387421f5f473ea8cc 100644 (file)
@@ -1076,7 +1076,6 @@ class GraphExplorerImpl extends GraphExplorerImplBase implements Listener, Graph
         editor.setEditor(combo, item, columnIndex);
 
         combo.setFocus();
-        combo.setListVisible(true);
 
         GraphExplorerImpl.this.reconfigureTreeEditorForText(item, columnIndex, combo, combo.getText(), SWT.DEFAULT, 0, 0);
 
@@ -1085,6 +1084,7 @@ class GraphExplorerImpl extends GraphExplorerImplBase implements Listener, Graph
         // Removed in comboListener
         currentlyModifiedNodes.add(context);
 
+        combo.setListVisible(true);
         //System.out.println("START ENUMERATION EDITING: " + item);
     }
 
index a197de88013dec935b1a46c3fb680c5fdf1831e9..656dfeb27550b8acfe8e1f1c8801cbebefe6e879 100644 (file)
@@ -55,9 +55,14 @@ public class ListUtils {
      */
     public static Resource create(WriteGraph g, Iterable<Resource> elements) throws DatabaseException {
        Layer0 L0 = Layer0.getInstance(g);
-       return ListUtils.create(g,L0.List, L0.List_ElementWithInverse, L0.List_ElementWithInverse_Inverse, elements);
+       return ListUtils.create(g,L0.List, L0.List_Element, null, elements);
     }
-
+    
+    public static Resource createWithInverses(WriteGraph g, Iterable<Resource> elements) throws DatabaseException {
+       Layer0 L0 = Layer0.getInstance(g);
+       return ListUtils.create(g,L0.ListWithInverses, L0.List_ElementWithInverse, L0.List_ElementWithInverse_Inverse, elements);
+    }
+    
     /**
      * Creates a list of the given list type containing the given {@code elements}.
      */
@@ -85,6 +90,8 @@ public class ListUtils {
         Layer0 L0 = g.getService(Layer0.class);
         Resource list = g.newResource();
         g.claim(list, L0.InstanceOf, null, type);
+        if (!elementPredicate.equals(L0.List_Element))
+               g.claim(list, L0.List_ElementPredicate, L0.List_ElementPredicate_Inverse, elementPredicate);
         createExisting(g, list, elementPredicate, elementPredicateInverse, elements);
         return list;
     }
index 358aaa7e914a92ad6b89e465139fa3e6f8f8559a..14aa774e8e6111642b569c2dd261121a7b686d8b 100644 (file)
@@ -1,6 +1,8 @@
 L0 = <http://www.simantics.org/Layer0-1.1>
 
-L0.Value <T L0.Entity
+L0.Value <T L0.Entity : L0.ValueType
+
+L0.ValueType <T L0.Type
     
 L0.ExternalValue <T L0.Value
 
@@ -30,7 +32,7 @@ L0.SCLValue <T L0.Value : L0.SCLValueType
     >-- L0.SCLValue.environment --> L0.SCLValue.Environment <R L0.IsRelatedTo : L0.TotalFunction
     @L0.assert L0.ConvertsToValueWith L0.Functions.sclValue
 
-L0.SCLValueType <T L0.Entity
+L0.SCLValueType <T L0.ValueType
     >-- L0.SCLValueType.validator ==> "Variable -> <ReadGraph> String" <R L0.HasProperty
 
 L0.scl : L0.Template
index d9e65e28c39208b575234aae41e3a94000702912..e719aaf8cd47e6993311d7f6b970851430087497 100644 (file)
@@ -178,7 +178,7 @@ public class SCLDocumentationExtensionNodeHandler implements ExtensionNodeHandle
         StringBuilder signature = new StringBuilder();
         signature.append("<div id=\"")
         .append(HtmlEscape.escape(name))
-        .append("\" class=\"code-doc-box\"><div class=\"code\">");
+        .append("\" class=\"code-doc-box\"><div class=\"code value\">");
         char firstChar = name.charAt(0);
         if(!Character.isAlphabetic(firstChar) && firstChar != '_')
             name = "(" + name + ")";
@@ -231,7 +231,9 @@ public class SCLDocumentationExtensionNodeHandler implements ExtensionNodeHandle
         
         TypeUnparsingContext tuc = new TypeUnparsingContext();
         StringBuilder signature = new StringBuilder();
-        signature.append("<div class=\"code-doc-box\"><div class=\"code\">");
+        signature.append("<div id=\"class-")
+        .append(HtmlEscape.escape(name))
+        .append("\" class=\"code-doc-box\"><div class=\"code class\">");
         signature.append("class ");
         if(typeClass.context.length > 0) {
             signature.append('(');
@@ -293,7 +295,9 @@ public class SCLDocumentationExtensionNodeHandler implements ExtensionNodeHandle
         
         TypeUnparsingContext tuc = new TypeUnparsingContext();
         StringBuilder signature = new StringBuilder();
-        signature.append("<div class=\"code-doc-box\"><div class=\"code\">");
+        signature.append("<div id=\"data-")
+        .append(HtmlEscape.escape(name))
+        .append("\" class=\"code-doc-box\"><div class=\"code data\">");
         signature.append("data ");
         signature.append(typeDescriptor.name.name);
         if(typeDescriptor instanceof TypeConstructor) {
index 27ecb48ebeb4af1ff48f18fbfc3e18f088b8fe59..7dd20434848b27777af13e2d6af193b0b8558cd3 100644 (file)
@@ -491,7 +491,6 @@ vertical-align:1px;
 .code-doc-box>.code {
   font-size: 12px;
   font-family: Consolas, "Liberation Mono", Courier, monospace;
-  background-color: #f0f0ff;
   white-space: pre;
   padding: 10px 15px;
   border-bottom: 1px solid;
@@ -500,7 +499,19 @@ vertical-align:1px;
   display: block;
 }
 
-.code-doc-box>.doc {display: block;
+.code-doc-box>.value {
+  background-color: #f0f0ff;
+}
+
+.code-doc-box>.data {
+  background-color: #f0fff0;
+}
+
+.code-doc-box>.class {
+  background-color: #fff0f0;
+}
+
+.code-doc-box>.doc {
   padding: 0px 15px ;
   display: block;
 }
index af8c194762c50810150f49f7cc9dd4b029a54c38..b69119eae0e345b65f153961cb289f85c752d63a 100644 (file)
@@ -250,13 +250,6 @@ importJava "org.simantics.db.WriteGraph" where
     @JavaName denyValue
     denyValue :: Resource -> <WriteGraph> ()
 
-claimAssertion :: Resource -> Resource -> Resource -> <WriteGraph> ()
-claimAssertion type_ predicate object = do
-    ass = newResource ()
-    claim ass L0.HasPredicate predicate
-    claim ass L0.HasObject object
-    claim type_ L0.Asserts ass
-
 "Sets the value of the literal that is an object with the given subject and predicate."
 @inline
 claimRelatedValue :: Serializable a => Resource -> Resource -> a -> <WriteGraph> ()
@@ -415,6 +408,9 @@ importJava "org.simantics.db.layer0.util.Layer0Utils" where
     addMetadataListener :: ChangeListener -> <Proc> ()
     removeMetadataListener :: ChangeListener -> <Proc> ()
 
+    @JavaName assert_
+    claimAssertion :: Resource -> Resource -> Resource -> <WriteGraph> ()
+
 copyTo :: Resource -> Resource -> <WriteGraph> Resource
 copyTo targetContainer source = do
     (collectionToList $ copyTo_ targetContainer source)!0
index 861f705d7a31dc8061d1848b347cb613ddcdb4ea..c38966f655f89989c94b891efeb180d8e4fd1717 100644 (file)
@@ -112,8 +112,7 @@ SEL.GenericParameterType <T L0.FunctionalRelation
       L0.readOnly true
   @L0.assert SEL.HasDisplayValue
     _ : SEL.DisplayValue
-      SEL.HasEnumerationValues _ : L0.Value
-        L0.ConvertsToValueWith SEL.Functions.getEnumerationValues
+      SEL.HasEnumerationValues SEL.Functions.getEnumerationValues
   @L0.assert SEL.HasDisplayUnit
     _ : SEL.DisplayUnit
       L0.readOnly true