From 3251f0d5f7015e38afcceb14036c16e4c380c7f6 Mon Sep 17 00:00:00 2001 From: lehtonen Date: Thu, 28 Apr 2011 13:21:01 +0000 Subject: [PATCH] No more Builtins class, use Layer0 instead. git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@20612 ac1ea38d-2e2b-0410-8846-a27921b304fc --- .../simantics/objmap/rules/domain/RelatedValueAccessor.java | 5 +++-- .../src/org/simantics/objmap/schema/SimpleLinkType.java | 5 +++-- .../org/simantics/sysdyn/ui/properties/DependencyTab.java | 6 +++--- .../org/simantics/sysdyn/ui/properties/EnumerationTab.java | 5 ++--- .../simantics/sysdyn/ui/properties/InputVariableTab.java | 6 +++--- .../src/org/simantics/sysdyn/ui/properties/ModuleTab.java | 6 +++--- .../org/simantics/sysdyn/ui/properties/ModuleTypeTab.java | 6 +++--- .../sysdyn/ui/property/OperationProjectContributor.java | 3 ++- 8 files changed, 22 insertions(+), 20 deletions(-) diff --git a/org.simantics.objmap/src/org/simantics/objmap/rules/domain/RelatedValueAccessor.java b/org.simantics.objmap/src/org/simantics/objmap/rules/domain/RelatedValueAccessor.java index 592d0e0c..4cf7ecde 100644 --- a/org.simantics.objmap/src/org/simantics/objmap/rules/domain/RelatedValueAccessor.java +++ b/org.simantics.objmap/src/org/simantics/objmap/rules/domain/RelatedValueAccessor.java @@ -16,11 +16,12 @@ import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; import org.simantics.db.exception.DatabaseException; +import org.simantics.layer0.Layer0; import org.simantics.objmap.MappingException; /** * Accesses a value attached to the element by given functional relation. - * @author Hannu Niemistö + * @author Hannu Niemist� */ public class RelatedValueAccessor implements IDomainAccessor { @@ -57,7 +58,7 @@ public class RelatedValueAccessor implements IDomainAccessor { if(value == null) return false; valueResource = g.newResource(); - g.claim(valueResource, g.getBuiltins().InstanceOf, null, + g.claim(valueResource, Layer0.getInstance(g).InstanceOf, null, valueType); g.claim(element, relation, valueResource); g.claimValue(valueResource, value); diff --git a/org.simantics.objmap/src/org/simantics/objmap/schema/SimpleLinkType.java b/org.simantics.objmap/src/org/simantics/objmap/schema/SimpleLinkType.java index 3d7b4aad..1b9a0354 100644 --- a/org.simantics.objmap/src/org/simantics/objmap/schema/SimpleLinkType.java +++ b/org.simantics.objmap/src/org/simantics/objmap/schema/SimpleLinkType.java @@ -19,6 +19,7 @@ import org.simantics.db.Resource; import org.simantics.db.WriteGraph; import org.simantics.db.common.utils.NameUtils; import org.simantics.db.exception.DatabaseException; +import org.simantics.layer0.Layer0; import org.simantics.objmap.IFunction; import org.simantics.objmap.ILinkType; import org.simantics.objmap.IMappingRule; @@ -28,7 +29,7 @@ import org.simantics.objmap.MappingException; * A link type that is associated with single domain and range type (class). * SimpleLinkType is composed of simpler rules whose combination determines * its update policy. - * @author Hannu Niemistö + * @author Hannu Niemist� */ public class SimpleLinkType implements ILinkType { @@ -66,7 +67,7 @@ public class SimpleLinkType implements ILinkType { rangeElement.toString() ); Resource result = g.newResource(); - g.claim(result, g.getBuiltins().InstanceOf, null, domainType); + g.claim(result, Layer0.getInstance(g).InstanceOf, null, domainType); return result; } catch(DatabaseException e) { throw new MappingException(e); diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/DependencyTab.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/DependencyTab.java index e65cef71..ac5507cc 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/DependencyTab.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/DependencyTab.java @@ -21,8 +21,8 @@ import org.simantics.browsing.ui.swt.widgets.StringPropertyFactory; import org.simantics.browsing.ui.swt.widgets.StringPropertyModifier; import org.simantics.browsing.ui.swt.widgets.TrackedText; import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport; -import org.simantics.db.Builtins; import org.simantics.db.management.ISessionContext; +import org.simantics.layer0.Layer0; public class DependencyTab extends PropertyTabContributorImpl { @@ -32,8 +32,8 @@ public class DependencyTab extends PropertyTabContributorImpl { GridDataFactory.fillDefaults().grab(true, true).applyTo(composite); GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(6).applyTo(composite); TrackedText nameText = new TrackedText(composite, support, SWT.BORDER); - nameText.setTextFactory(new StringPropertyFactory(Builtins.URIs.HasName)); - nameText.addModifyListener(new StringPropertyModifier(context, Builtins.URIs.HasName)); + nameText.setTextFactory(new StringPropertyFactory(Layer0.URIs.HasName)); + nameText.addModifyListener(new StringPropertyModifier(context, Layer0.URIs.HasName)); GridDataFactory.fillDefaults().grab(true, false).applyTo(nameText.getWidget()); } diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/EnumerationTab.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/EnumerationTab.java index f4cbd5ff..ee23bcc1 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/EnumerationTab.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/EnumerationTab.java @@ -27,7 +27,6 @@ import org.simantics.browsing.ui.swt.widgets.TrackedText; import org.simantics.browsing.ui.swt.widgets.impl.Widget; import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport; import org.simantics.databoard.Bindings; -import org.simantics.db.Builtins; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; @@ -72,8 +71,8 @@ public class EnumerationTab extends PropertyTabContributorImpl implements Widget GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(4).applyTo(container); TrackedText nameText = new TrackedText(container, support, SWT.BORDER); - nameText.setTextFactory(new StringPropertyFactory(Builtins.URIs.HasName)); - nameText.addModifyListener(new VariableNamePropertyModifier(context, Builtins.URIs.HasName)); + nameText.setTextFactory(new StringPropertyFactory(Layer0.URIs.HasName)); + nameText.addModifyListener(new VariableNamePropertyModifier(context, Layer0.URIs.HasName)); nameText.setInputValidator(new VariableNameValidator(support)); GridDataFactory.fillDefaults().grab(true, false).span(4,1).applyTo(nameText.getWidget()); diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/InputVariableTab.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/InputVariableTab.java index 09864cb4..acc53a50 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/InputVariableTab.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/InputVariableTab.java @@ -23,8 +23,8 @@ import org.simantics.browsing.ui.swt.PropertyTabContributorImpl; import org.simantics.browsing.ui.swt.widgets.StringPropertyFactory; import org.simantics.browsing.ui.swt.widgets.TrackedText; import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport; -import org.simantics.db.Builtins; import org.simantics.db.management.ISessionContext; +import org.simantics.layer0.Layer0; import org.simantics.sysdyn.SysdynResource; import org.simantics.sysdyn.ui.properties.widgets.IsOutputWidget; import org.simantics.sysdyn.ui.properties.widgets.factories.DoublePropertyFactory; @@ -42,8 +42,8 @@ public class InputVariableTab extends PropertyTabContributorImpl { GridLayoutFactory.fillDefaults().margins(3, 3).applyTo(composite); TrackedText nameText = new TrackedText(composite, support, SWT.BORDER); - nameText.setTextFactory(new StringPropertyFactory(Builtins.URIs.HasName)); - nameText.addModifyListener(new VariableNamePropertyModifier(context, Builtins.URIs.HasName)); + nameText.setTextFactory(new StringPropertyFactory(Layer0.URIs.HasName)); + nameText.addModifyListener(new VariableNamePropertyModifier(context, Layer0.URIs.HasName)); nameText.setInputValidator(new VariableNameValidator(support)); GridDataFactory.fillDefaults().grab(true, false).applyTo(nameText.getWidget()); diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ModuleTab.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ModuleTab.java index a3bd4b53..1c44fcdb 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ModuleTab.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ModuleTab.java @@ -27,9 +27,9 @@ import org.simantics.browsing.ui.swt.widgets.StringPropertyModifier; import org.simantics.browsing.ui.swt.widgets.TrackedText; import org.simantics.browsing.ui.swt.widgets.impl.Widget; import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport; -import org.simantics.db.Builtins; import org.simantics.db.Resource; import org.simantics.db.management.ISessionContext; +import org.simantics.layer0.Layer0; import org.simantics.sysdyn.ui.properties.widgets.ColumnKeys; import org.simantics.utils.datastructures.ArrayMap; @@ -45,8 +45,8 @@ public class ModuleTab extends PropertyTabContributorImpl implements Widget { GridDataFactory.fillDefaults().grab(true, true).applyTo(composite); GridLayoutFactory.fillDefaults().margins(3, 3).applyTo(composite); TrackedText nameText = new TrackedText(composite, support, SWT.BORDER); - nameText.setTextFactory(new StringPropertyFactory(Builtins.URIs.HasName)); - nameText.addModifyListener(new StringPropertyModifier(context, Builtins.URIs.HasName)); + nameText.setTextFactory(new StringPropertyFactory(Layer0.URIs.HasName)); + nameText.addModifyListener(new StringPropertyModifier(context, Layer0.URIs.HasName)); GridDataFactory.fillDefaults().grab(true, false).applyTo(nameText.getWidget()); Label label = new Label(composite, SWT.NONE); diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ModuleTypeTab.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ModuleTypeTab.java index aa3e2227..5910e9ac 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ModuleTypeTab.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ModuleTypeTab.java @@ -21,8 +21,8 @@ import org.simantics.browsing.ui.swt.widgets.StringPropertyFactory; import org.simantics.browsing.ui.swt.widgets.StringPropertyModifier; import org.simantics.browsing.ui.swt.widgets.TrackedText; import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport; -import org.simantics.db.Builtins; import org.simantics.db.management.ISessionContext; +import org.simantics.layer0.Layer0; public class ModuleTypeTab extends PropertyTabContributorImpl { @@ -32,8 +32,8 @@ public class ModuleTypeTab extends PropertyTabContributorImpl { GridDataFactory.fillDefaults().grab(true, true).applyTo(composite); GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(6).applyTo(composite); TrackedText nameText = new TrackedText(composite, support, SWT.BORDER); - nameText.setTextFactory(new StringPropertyFactory(Builtins.URIs.HasName)); - nameText.addModifyListener(new StringPropertyModifier(context, Builtins.URIs.HasName)); + nameText.setTextFactory(new StringPropertyFactory(Layer0.URIs.HasName)); + nameText.addModifyListener(new StringPropertyModifier(context, Layer0.URIs.HasName)); GridDataFactory.fillDefaults().grab(true, false).applyTo(nameText.getWidget()); } diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/property/OperationProjectContributor.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/property/OperationProjectContributor.java index a03d79c6..6d9a27e9 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/property/OperationProjectContributor.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/property/OperationProjectContributor.java @@ -22,6 +22,7 @@ import org.simantics.db.Resource; import org.simantics.db.common.request.ObjectsWithType; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.variable.Variable; +import org.simantics.layer0.Layer0; import org.simantics.project.ontology.ProjectResource; import org.simantics.simulation.ontology.SimulationResource; @@ -31,7 +32,7 @@ public class OperationProjectContributor extends ViewpointContributor public Collection getContribution(ReadGraph graph, Resource project) throws DatabaseException { ArrayList result = new ArrayList(); - for(Resource model : graph.syncRequest(new ObjectsWithType(project, b.ConsistsOf, SimulationResource.getInstance(graph).Model))) { + for(Resource model : graph.syncRequest(new ObjectsWithType(project, Layer0.getInstance(graph).ConsistsOf, SimulationResource.getInstance(graph).Model))) { result.add(new OperationModelNode(graph.adapt(model, Variable.class))); } return result; -- 2.47.1