X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.modeling.ui%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2Fui%2Fchart%2Fproperty%2FDoublePropertyModifier.java;h=f9aa143d251edfe8fcb86b31d998c7a67dbf229f;hb=b45e9e5c1696a2e729dcecac0f58d16c15391770;hp=0b9baecb147fcc5e5f354bbe7f13b1fb95abee41;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/chart/property/DoublePropertyModifier.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/chart/property/DoublePropertyModifier.java index 0b9baecb1..f9aa143d2 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/chart/property/DoublePropertyModifier.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/chart/property/DoublePropertyModifier.java @@ -1,39 +1,39 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Association for Decentralized Information Management in - * Industry THTH ry. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics.modeling.ui.chart.property; - -import org.simantics.browsing.ui.swt.widgets.impl.TextModifyListenerImpl; -import org.simantics.databoard.Bindings; -import org.simantics.db.Resource; -import org.simantics.db.WriteGraph; -import org.simantics.db.exception.DatabaseException; -import org.simantics.db.management.ISessionContext; - -public class DoublePropertyModifier extends TextModifyListenerImpl { - - final private String propertyURI; - - public DoublePropertyModifier(ISessionContext context, String propertyURI) { - this.propertyURI = propertyURI; - } - - @Override - public void applyText(WriteGraph graph, Resource input, String text) throws DatabaseException { - if (text == null || text.trim().isEmpty()) { - if (graph.hasStatement(input, graph.getResource(propertyURI))) - graph.denyValue(input, graph.getResource(propertyURI)); - } else { - graph.claimLiteral(input, graph.getResource(propertyURI), Double.parseDouble(text), Bindings.DOUBLE); - } - } - -} +/******************************************************************************* + * Copyright (c) 2010, 2011 Association for Decentralized Information Management in + * Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.modeling.ui.chart.property; + +import org.simantics.browsing.ui.swt.widgets.impl.TextModifyListenerImpl; +import org.simantics.databoard.Bindings; +import org.simantics.db.Resource; +import org.simantics.db.WriteGraph; +import org.simantics.db.exception.DatabaseException; +import org.simantics.db.management.ISessionContext; + +public class DoublePropertyModifier extends TextModifyListenerImpl { + + final private String propertyURI; + + public DoublePropertyModifier(ISessionContext context, String propertyURI) { + this.propertyURI = propertyURI; + } + + @Override + public void applyText(WriteGraph graph, Resource input, String text) throws DatabaseException { + if (text == null || text.trim().isEmpty()) { + if (graph.hasStatement(input, graph.getResource(propertyURI))) + graph.denyValue(input, graph.getResource(propertyURI)); + } else { + graph.claimLiteral(input, graph.getResource(propertyURI), Double.parseDouble(text), Bindings.DOUBLE); + } + } + +}