\r
@Override\r
public String getLabel(ReadGraph graph, ConfigurationNode conf) throws DatabaseException {\r
- String name = graph.getPossibleRelatedValue(conf.resource, graph.getBuiltins().HasLabel);\r
- return name == null ? "Project (no name)" : name;\r
+ return "Configuration";\r
}\r
\r
}\r
ArrayList<AbstractNode> result = new ArrayList<AbstractNode>();\r
for (Resource r : graph.syncRequest(getChildRequest(graph, lib))) {\r
try {\r
- System.out.println("Is Flow? " + graph.isInstanceOf(r, SysdynResource.getInstance(graph).Flow));\r
AbstractNode n = graph.adapt(r, AbstractNode.class);\r
result.add(n);\r
} catch (DatabaseException e) {\r
Builtins b = graph.getBuiltins();\r
SysdynResource sr = SysdynResource.getInstance(graph);\r
StructuralResource2 str = StructuralResource2.getInstance(graph);\r
- Resource instance = graph.getSingleObject(module.resource, b.InstanceOf);\r
+ Resource instance = graph.getPossibleObject(module.resource, b.InstanceOf);\r
+ if(instance == null) return result;\r
Resource conf = graph.getSingleObject(instance, str.IsDefinedBy);\r
for(Resource r : graph.syncRequest(new ObjectsWithType(conf, b.ConsistsOf, sr.IndependentVariable))) {\r
try {\r
import java.util.Collection;\r
\r
import org.simantics.browsing.ui.graph.contributor.viewpoint.ViewpointContributor;\r
-import org.simantics.db.Builtins;\r
import org.simantics.db.ReadGraph;\r
import org.simantics.db.Resource;\r
import org.simantics.db.exception.DatabaseException;\r
import org.simantics.modeling.ModelingResources;\r
-import org.simantics.structural.stubs.StructuralResource2;\r
-import org.simantics.sysdyn.SysdynResource;\r
import org.simantics.sysdyn.ui.browser.nodes.AbstractNode;\r
import org.simantics.sysdyn.ui.browser.nodes.ModuleTypeNode;\r
\r
@Override\r
public Collection<?> getContribution(ReadGraph graph, ModuleTypeNode module) throws DatabaseException {\r
ArrayList<AbstractNode> result = new ArrayList<AbstractNode>();\r
- Builtins b = graph.getBuiltins();\r
- SysdynResource sr = SysdynResource.getInstance(graph);\r
- StructuralResource2 str = StructuralResource2.getInstance(graph);\r
ModelingResources mr = ModelingResources.getInstance(graph);\r
Resource symbol = graph.getPossibleObject(module.resource, mr.ComponentTypeToSymbol);\r
result.add(graph.adapt(symbol, AbstractNode.class));\r
@Override\r
public String getLabel(ReadGraph graph, ModuleTypeNode moduleType) throws DatabaseException {\r
String label = graph.getPossibleRelatedValue(moduleType.resource, graph.getBuiltins().HasLabel);\r
- return label == null ? "Model (no name)" : label;\r
+ return label == null ? "ModuleType (no name)" : label;\r
}\r
\r
}\r
ModelingUtils mu = new ModelingUtils(g);\r
\r
Resource moduleType = g.newResource();\r
- g.claimValue(moduleType, mu.b.HasName, "ModuleType");\r
- g.claimValue(moduleType, mu.b.HasLabel, "ModuleTypeLabel");\r
+ g.claimValue(moduleType, mu.b.HasLabel, "New Module Type");\r
g.claim(moduleType, mu.b.Inherits, sr.Module);\r
g.claim(moduleType, mu.b.PartOf, model);\r
\r
--- /dev/null
+package org.simantics.sysdyn.ui.properties;\r
+\r
+import org.eclipse.jface.layout.GridDataFactory;\r
+import org.eclipse.jface.layout.GridLayoutFactory;\r
+import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.widgets.Composite;\r
+import org.eclipse.ui.IWorkbenchSite;\r
+import org.simantics.browsing.ui.swt.PropertyTabContributorImpl;\r
+import org.simantics.browsing.ui.swt.widgets.StringPropertyFactory;\r
+import org.simantics.browsing.ui.swt.widgets.StringPropertyModifier;\r
+import org.simantics.browsing.ui.swt.widgets.TrackedText;\r
+import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;\r
+import org.simantics.db.Builtins;\r
+import org.simantics.db.management.ISessionContext;\r
+\r
+public class DependencyTab extends PropertyTabContributorImpl {\r
+\r
+ @Override\r
+ public void createControls(Composite body, IWorkbenchSite site, ISessionContext context, WidgetSupport support) {\r
+ Composite composite = new Composite(body, SWT.NONE);\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(6).applyTo(composite);\r
+ TrackedText nameText = new TrackedText(composite, support, SWT.BORDER);\r
+ nameText.setTextFactory(new StringPropertyFactory(Builtins.URIs.HasName));\r
+ nameText.addModifyListener(new StringPropertyModifier(context, Builtins.URIs.HasName));\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(nameText.getWidget());\r
+ }\r
+\r
+\r
+}\r
SysdynResource sr = SysdynResource.getInstance(graph);\r
StructuralResource2 sr2 = StructuralResource2.getInstance(graph);\r
ArrayList<ReferenceRow> result = new ArrayList<ReferenceRow>();\r
- Resource instanceOf = graph.getSingleObject(module, b.InstanceOf);\r
+ Resource instanceOf = graph.getPossibleObject(module, b.InstanceOf);\r
+ if(instanceOf == null) return result;\r
Resource configuration = graph.getSingleObject(instanceOf, sr2.IsDefinedBy);\r
for(Resource input : graph.syncRequest(new ObjectsWithType(configuration, b.ConsistsOf, sr.Input))) {\r
Resource dependency = null;\r
SysdynResource sr = SysdynResource.getInstance(graph);\r
StructuralResource2 sr2 = StructuralResource2.getInstance(graph);\r
ArrayList<ReferenceRow> result = new ArrayList<ReferenceRow>();\r
- Resource instanceOf = graph.getSingleObject(module, b.InstanceOf);\r
+ Resource instanceOf = graph.getPossibleObject(module, b.InstanceOf);\r
+ if(instanceOf == null) return result;\r
Resource configuration = graph.getSingleObject(instanceOf, sr2.IsDefinedBy);\r
for(Resource variable : graph.syncRequest(new ObjectsWithType(configuration, b.ConsistsOf, sr.Variable))) {\r
if(!graph.hasStatement(variable, sr.IsOutput)) continue;\r
0,\r
r,\r
"Reference Properties"));\r
+ else\r
+ return Collections.singleton(\r
+ new ComparableTabContributor(\r
+ new DependencyTab(),\r
+ 0,\r
+ r,\r
+ "Dependency Properties"));\r
} catch (ServiceException e) {\r
e.printStackTrace();\r
} catch (ManyObjectsForFunctionalRelationException e) {\r