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;
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;
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)
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$
}
}