From 456397cb7d972d49540b89f92aadca71039e8870 Mon Sep 17 00:00:00 2001 From: Jussi Koskela Date: Wed, 1 Nov 2017 09:42:24 +0200 Subject: [PATCH] Fixed problems in shared libraries view refs #7589 Change-Id: I1435330e0ce84118c246e4f99234a9e404fea6f4 --- .../graph/Properties.pgraph | 2 +- .../graph/Components.pgraph | 2 +- .../simantics/modeling/adapters/SCLChildRule.java | 14 ++++++++++---- .../graph/PlatformUIViews.pgraph | 4 ++-- .../graph/scl/SCLMain.scl | 6 ------ 5 files changed, 14 insertions(+), 14 deletions(-) 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 -- 2.47.1