From: Jussi Koskela Date: Wed, 1 Nov 2017 07:42:24 +0000 (+0200) Subject: Fixed problems in shared libraries view X-Git-Tag: v1.31.0~69 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=456397cb7d972d49540b89f92aadca71039e8870;p=simantics%2Fplatform.git Fixed problems in shared libraries view refs #7589 Change-Id: I1435330e0ce84118c246e4f99234a9e404fea6f4 --- diff --git a/bundles/org.simantics.document.base.ontology/graph/Properties.pgraph b/bundles/org.simantics.document.base.ontology/graph/Properties.pgraph index d0394de66..e1cf07711 100644 --- a/bundles/org.simantics.document.base.ontology/graph/Properties.pgraph +++ b/bundles/org.simantics.document.base.ontology/graph/Properties.pgraph @@ -74,7 +74,7 @@ PROPERTIES.dataDefinitions PROPERTIES.SCLFunction : PROPERTIES.ParameterType @PROPERTIES.defAttribute L0.Value - ==> "EventHandler" + ==> "AbstractEventHandler" L0.HasLabel "SCL Function" PROPERTIES.target : PROPERTIES.ParameterType diff --git a/bundles/org.simantics.document.swt.ontology/graph/Components.pgraph b/bundles/org.simantics.document.swt.ontology/graph/Components.pgraph index 702979841..e577e6c5d 100644 --- a/bundles/org.simantics.document.swt.ontology/graph/Components.pgraph +++ b/bundles/org.simantics.document.swt.ontology/graph/Components.pgraph @@ -127,7 +127,7 @@ COMPONENTS.Button -- 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 "" diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/adapters/SCLChildRule.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/adapters/SCLChildRule.java index 52349e582..a04b9315f 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/adapters/SCLChildRule.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/adapters/SCLChildRule.java @@ -28,21 +28,27 @@ public class SCLChildRule implements ChildRule { } @Override - public Collection getChildren(ReadGraph graph, Object parent) throws DatabaseException { + public Collection 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> getChildren = ruleVariable.getPossiblePropertyValue(graph, MOD.SCLChildRule_getChildren); + Function1> 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 { diff --git a/bundles/org.simantics.platform.ui.ontology/graph/PlatformUIViews.pgraph b/bundles/org.simantics.platform.ui.ontology/graph/PlatformUIViews.pgraph index a49e26a7b..51a9ad62f 100644 --- a/bundles/org.simantics.platform.ui.ontology/graph/PlatformUIViews.pgraph +++ b/bundles/org.simantics.platform.ui.ontology/graph/PlatformUIViews.pgraph @@ -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 -> [Resource]" + @VIEWS.scl MOD.SCLChildRule.getChildren "usedSharedOntologies" "Resource -> [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 -> [Resource]" + @VIEWS.scl MOD.SCLChildRule.getChildren "availableSharedOntologies" "Resource -> [Resource]" VIEWS.SCLValue [Resource] -usedSharedOntologies2 model = usedSharedOntologies $ represents model - -availableSharedOntologies2 :: Variable -> [Resource] -availableSharedOntologies2 model = availableSharedOntologies $ represents model - useSelectedHandler :: Variable -> (String -> Maybe String) -> String useSelectedHandler input parameters = do model = represents input