X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.modeling.ui%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2Fui%2FcomponentTypeEditor%2FComponentTypeViewer.java;h=38f24b4f7ddb53d8d7b6b3dafc84403c35042533;hp=7d256ba00e2dca5941e632a990105b02daee3d1d;hb=3a25ce941361ea625bc07a427b0574fe5cb17180;hpb=0ae2b770234dfc3cbb18bd38f324125cf0faca07 diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypeViewer.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypeViewer.java index 7d256ba00..38f24b4f7 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypeViewer.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypeViewer.java @@ -34,6 +34,7 @@ import org.osgi.framework.BundleContext; import org.osgi.framework.InvalidSyntaxException; import org.osgi.framework.ServiceReference; import org.simantics.Simantics; +import org.simantics.browsing.ui.graph.impl.GetEnumerationValue; import org.simantics.databoard.Bindings; import org.simantics.databoard.binding.Binding; import org.simantics.databoard.binding.error.BindingException; @@ -42,6 +43,7 @@ import org.simantics.databoard.type.NumberType; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.common.NamedResource; +import org.simantics.db.common.request.IsEnumeratedValue; import org.simantics.db.common.request.UniqueRead; import org.simantics.db.common.utils.NameUtils; import org.simantics.db.exception.DatabaseException; @@ -185,22 +187,24 @@ public class ComponentTypeViewer { String type = graph.getPossibleRelatedValue(relation, L0.RequiresValueType); String label = graph.getPossibleRelatedValue(relation, L0.HasLabel); if (label == null) - label = ""; + label = ""; //$NON-NLS-1$ String description = graph.getPossibleRelatedValue(relation, L0.HasDescription); if (description == null) - description = ""; + description = ""; //$NON-NLS-1$ NumberType numberType = null; if(type == null) - type = "Double"; + type = "Double"; //$NON-NLS-1$ String unit = graph.getPossibleRelatedValue(relation, L0X.HasUnit, Bindings.STRING); - String defaultValue = "0"; + String defaultValue = "0"; //$NON-NLS-1$ String expression = null; for(Resource assertion : graph.getAssertedObjects(data.componentType, relation)) { try { expression = graph.getPossibleRelatedValue(assertion, L0.SCLValue_expression, Bindings.STRING); if(expression != null) { - defaultValue = "=" + expression; + defaultValue = "=" + expression; //$NON-NLS-1$ + } else if (graph.sync(new IsEnumeratedValue(assertion))) { + defaultValue = GetEnumerationValue.getEnumerationValueName(graph, assertion); } else { Datatype dt = getPossibleDatatype(graph, assertion); if (dt == null) @@ -306,9 +310,9 @@ public class ComponentTypeViewer { section.setReadOnly(readOnly); IMessageManager mm = data.form.getMessageManager(); if (readOnly) - mm.addMessage("readonly", "(Opened in read-only mode)", null, IMessageProvider.INFORMATION); + mm.addMessage("readonly", Messages.ComponentTypeViewer_OpenedInReadOnly, null, IMessageProvider.INFORMATION); //$NON-NLS-1$ else - mm.removeMessage("readonly"); + mm.removeMessage("readonly"); //$NON-NLS-1$ } }