]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Fixed problems in shared libraries view 74/1174/2
authorJussi Koskela <jussi.koskela@semantum.fi>
Wed, 1 Nov 2017 07:42:24 +0000 (09:42 +0200)
committerJani Simomaa <jani.simomaa@semantum.fi>
Wed, 1 Nov 2017 08:58:50 +0000 (10:58 +0200)
refs #7589

Change-Id: I1435330e0ce84118c246e4f99234a9e404fea6f4

bundles/org.simantics.document.base.ontology/graph/Properties.pgraph
bundles/org.simantics.document.swt.ontology/graph/Components.pgraph
bundles/org.simantics.modeling/src/org/simantics/modeling/adapters/SCLChildRule.java
bundles/org.simantics.platform.ui.ontology/graph/PlatformUIViews.pgraph
bundles/org.simantics.platform.ui.ontology/graph/scl/SCLMain.scl

index d0394de6693251707724921758b93ec8df5f7cab..e1cf07711ac734e595a12cfa6afb33cdddfc0125 100644 (file)
@@ -74,7 +74,7 @@ PROPERTIES.dataDefinitions
 
 PROPERTIES.SCLFunction : PROPERTIES.ParameterType
     @PROPERTIES.defAttribute L0.Value
-    ==> "EventHandler"   
+    ==> "AbstractEventHandler"   
     L0.HasLabel "SCL Function"
     
 PROPERTIES.target : PROPERTIES.ParameterType
index 7029798418cdd41ef144de72183d2bc24ffedfd4..e577e6c5dadda5e00469d9acdf757ad6b10e2af8 100644 (file)
@@ -127,7 +127,7 @@ COMPONENTS.Button <T COMPONENTS.Component
   >-- COMPONENTS.Button.text
     @SWT.defAttribute L0.Value "String"
   >-- COMPONENTS.Button.onPress
-    @SWT.defAttribute L0.Value "EventHandler"
+    @SWT.defAttribute L0.Value "AbstractEventHandler"
 
   @attribute COMPONENTS.Button.text
     ""
index 52349e5821acec2f1a8d476b9c31cd901c8b2ad1..a04b9315f544d698913c655ce084e485ec05224a 100644 (file)
@@ -28,21 +28,27 @@ public class SCLChildRule implements ChildRule {
     }
 
     @Override
-    public Collection<?> getChildren(ReadGraph graph, Object parent) throws DatabaseException {
+    public Collection<Resource> getChildren(ReadGraph graph, Object parent) throws DatabaseException {
+        Resource parentResource;
+        
+        if (parent instanceof Variable) {
+            parentResource = ((Variable)parent).getRepresents(graph);
+        } else {
+            parentResource = (Resource)parent;
+        }
         
         ModelingResources MOD = ModelingResources.getInstance(graph);
         
         Variable ruleVariable = Variables.getVariable(graph, rule);
 
-        Function1<Object,List<?>> getChildren = ruleVariable.getPossiblePropertyValue(graph, MOD.SCLChildRule_getChildren);
+        Function1<Resource,List<Resource>> getChildren = ruleVariable.getPossiblePropertyValue(graph, MOD.SCLChildRule_getChildren);
         if(getChildren == null) return Collections.emptyList();
 
         SCLContext sclContext = SCLContext.getCurrent();
         Object oldGraph = sclContext.get("graph");
         try {
             sclContext.put("graph", graph);
-            Object value = getChildren.apply(parent);
-            return (Collection<?>)value;
+            return getChildren.apply(parentResource);
         } catch (Throwable t) {
                throw new DatabaseException(t);
         } finally {
index a49e26a7b5026dd2d8bee78df775424121c234b6..51a9ad62fdb9d4e5e952511d6f9a69a33e036767 100644 (file)
@@ -113,7 +113,7 @@ SharedLibraries.UsedContext : VP.BrowseContext
         VP.ChildContribution.HasParentNodeType MBC.Variable
         VP.ChildContribution.HasChildNodeType L0.SharedOntology
         VP.ChildContribution.HasRule SharedLibraries.UsedContext.Children.Rule : MOD.SCLChildRule
-            @VIEWS.scl MOD.SCLChildRule.getChildren "usedSharedOntologies2" "Resource -> <ReadGraph> [Resource]"
+            @VIEWS.scl MOD.SCLChildRule.getChildren "usedSharedOntologies" "Resource -> <ReadGraph> [Resource]"
 
 SharedLibraries.AvailableContext : VP.BrowseContext
     VP.BrowseContext.HasVisualsContribution PROJECT.Contributions.StandardNameLabelRule
@@ -121,7 +121,7 @@ SharedLibraries.AvailableContext : VP.BrowseContext
         VP.ChildContribution.HasParentNodeType MBC.Variable
         VP.ChildContribution.HasChildNodeType L0.SharedOntology
         VP.ChildContribution.HasRule SharedLibraries.AvailableContext.Children.Rule : MOD.SCLChildRule
-            @VIEWS.scl MOD.SCLChildRule.getChildren "availableSharedOntologies2" "Resource -> <ReadGraph> [Resource]"
+            @VIEWS.scl MOD.SCLChildRule.getChildren "availableSharedOntologies" "Resource -> <ReadGraph> [Resource]"
 
 VIEWS.SCLValue <T DOC.SCLValue
 /*  @L0.assert L0.SCLValue.environment
index 44bf61267b7b9fbe0f6fc0b2eda98534f62dcab8..44c53d80e4cfa35e9320f51ae3b93227eac94dbe 100644 (file)
@@ -1,12 +1,6 @@
 include "Simantics/All"
 include "SWT/All"
 
-usedSharedOntologies2 :: Variable -> <ReadGraph> [Resource]
-usedSharedOntologies2 model = usedSharedOntologies $ represents model
-
-availableSharedOntologies2 :: Variable -> <ReadGraph> [Resource]
-availableSharedOntologies2 model = availableSharedOntologies $ represents model
-
 useSelectedHandler :: Variable -> (String -> Maybe String) -> <WriteGraph> String
 useSelectedHandler input parameters = do
   model = represents input