From: akallio Date: Wed, 29 Jun 2011 15:31:50 +0000 (+0000) Subject: modelbrowser2 enabled X-Git-Tag: simantics-1.5~80 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=fcb66d4904025d07f0f06e7959ee51423609e913;p=simantics%2Fsysdyn.git modelbrowser2 enabled git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@21406 ac1ea38d-2e2b-0410-8846-a27921b304fc --- diff --git a/org.simantics.sysdyn.ontology/graph/Sysdyn.pgraph b/org.simantics.sysdyn.ontology/graph/Sysdyn.pgraph index 3428e820..7f8b35c6 100644 --- a/org.simantics.sysdyn.ontology/graph/Sysdyn.pgraph +++ b/org.simantics.sysdyn.ontology/graph/Sysdyn.pgraph @@ -27,7 +27,7 @@ SYSDYN.SharedModuleOntolofgy +VP = +SIMU = +PROJECT = +IMAGE = +ACT = +MOD = +STR = +SYSDYN = + +SBC = SYSDYN.ProjectBrowseContext : VP.BrowseContext +SAC = SYSDYN.ProjectActionContext : VP.BrowseContext + +MBC = MOD.ModelingBrowseContext : VP.BrowseContext + VP.BrowseContext.IsIncludedIn PROJECT.ProjectBrowseContext +MAC = MOD.ModelingActionContext : VP.BrowseContext + VP.BrowseContext.IsIncludedIn PROJECT.ProjectActionContext + +//dymmy moduleslibrary to make this easier +SYSDYN.ModulesLibrary - none 0 fill 1 + none 0 fill 1 \ No newline at end of file diff --git a/org.simantics.sysdyn.ui/plugin.xml b/org.simantics.sysdyn.ui/plugin.xml index cf30c2d7..f8db234d 100644 --- a/org.simantics.sysdyn.ui/plugin.xml +++ b/org.simantics.sysdyn.ui/plugin.xml @@ -144,6 +144,12 @@ relationship="left" relative="org.eclipse.ui.editorss"> + + contentType) { + return contentType.equals(Resource.class); + } + + @Override + public Collection getChildren(ReadGraph graph, Object parent) + throws DatabaseException { + + ArrayList children = new ArrayList(); + + if(!(parent instanceof Resource)) { + return children; + } + + Layer0 l0 = Layer0.getInstance(graph); + StructuralResource2 st = StructuralResource2.getInstance(graph); + + Resource modulelibrary = (Resource)parent; + + Resource model = graph.getSingleObject(modulelibrary, l0.PartOf); + + for(Resource r : graph.syncRequest(new ObjectsWithType(model, l0.ConsistsOf, st.ComponentType))) { + if(graph.isInheritedFrom(r, SysdynResource.getInstance(graph).Module)) { + Resource symbol = graph.getPossibleObject(r,ModelingResources.getInstance(graph).ComponentTypeToSymbol); + children.add(symbol); + } + } + + return children; + } + + @Override + public Collection getParents(ReadGraph graph, Object child) + throws DatabaseException { + return new ArrayList(); + } + +} \ No newline at end of file diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProject.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProject.java index 657a8ff1..3f6cde47 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProject.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProject.java @@ -153,6 +153,11 @@ public class SysdynProject extends AbstractProjectFeature { l0.HasLabel, "Experiment", l0.HasReportFactory, report, l0.PartOf, model); + + //model browser2 + Resource moduleslibrary = g.newResource(); + g.claim(moduleslibrary, l0.InstanceOf, sr.ModulesLibrary); + g.claim(model, l0.ConsistsOf, moduleslibrary); ProjectResource PROJ = ProjectResource.getInstance(g); for(Resource dep : g.getObjects(library, l0.IsLinkedTo)) {