X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.browsing.ui.model%2Fsrc%2Forg%2Fsimantics%2Fbrowsing%2Fui%2Fmodel%2Fmodifiers%2FVariablePropertyModifierRule.java;h=bcd6d3bf39c0b9fda6c59b2da962ab140bda4d6f;hp=8867d20b07a40c8f87aad8378c69ae91153fed8b;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.browsing.ui.model/src/org/simantics/browsing/ui/model/modifiers/VariablePropertyModifierRule.java b/bundles/org.simantics.browsing.ui.model/src/org/simantics/browsing/ui/model/modifiers/VariablePropertyModifierRule.java index 8867d20b0..bcd6d3bf3 100644 --- a/bundles/org.simantics.browsing.ui.model/src/org/simantics/browsing/ui/model/modifiers/VariablePropertyModifierRule.java +++ b/bundles/org.simantics.browsing.ui.model/src/org/simantics/browsing/ui/model/modifiers/VariablePropertyModifierRule.java @@ -1,48 +1,48 @@ -/******************************************************************************* - * Copyright (c) 2007, 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.browsing.ui.model.modifiers; - -import org.simantics.browsing.ui.common.ColumnKeys; -import org.simantics.browsing.ui.content.Labeler.Modifier; -import org.simantics.db.ReadGraph; -import org.simantics.db.exception.DatabaseException; -import org.simantics.db.layer0.variable.Variable; - -/** - * @author Tuukka Lehtonen - */ -public class VariablePropertyModifierRule implements ModifierRule { - - String propertyName; - - public VariablePropertyModifierRule(ReadGraph graph, String propertyName) throws DatabaseException { - this.propertyName = propertyName; - } - - @Override - public boolean isCompatible(Class contentType) { - return contentType.equals(Variable.class); - } - - @Override - public Modifier getModifier(ReadGraph graph, Object content, - String columnKey) throws DatabaseException { - if(!ColumnKeys.SINGLE.equals(columnKey)) - return null; - if(!(content instanceof Variable)) - return null; - Variable variable = (Variable)content; - Variable propertyVariable = variable.getProperty(graph, propertyName); - return new VariableModifier2(graph, propertyVariable); - } - -} +/******************************************************************************* + * Copyright (c) 2007, 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.browsing.ui.model.modifiers; + +import org.simantics.browsing.ui.common.ColumnKeys; +import org.simantics.browsing.ui.content.Labeler.Modifier; +import org.simantics.db.ReadGraph; +import org.simantics.db.exception.DatabaseException; +import org.simantics.db.layer0.variable.Variable; + +/** + * @author Tuukka Lehtonen + */ +public class VariablePropertyModifierRule implements ModifierRule { + + String propertyName; + + public VariablePropertyModifierRule(ReadGraph graph, String propertyName) throws DatabaseException { + this.propertyName = propertyName; + } + + @Override + public boolean isCompatible(Class contentType) { + return contentType.equals(Variable.class); + } + + @Override + public Modifier getModifier(ReadGraph graph, Object content, + String columnKey) throws DatabaseException { + if(!ColumnKeys.SINGLE.equals(columnKey)) + return null; + if(!(content instanceof Variable)) + return null; + Variable variable = (Variable)content; + Variable propertyVariable = variable.getProperty(graph, propertyName); + return new VariableModifier2(graph, propertyVariable); + } + +}