diff options
author | ddunne | 2008-04-09 04:41:50 +0000 |
---|---|---|
committer | ddunne | 2008-04-09 04:41:50 +0000 |
commit | 59713c5b968c75fb6aa8c636b21f2cdf82b95d5d (patch) | |
tree | c31c6289963cffa280bdf5f80e38d6a8484b6f5b | |
parent | e5883c75ae3e4b197266b65fcd6f2d846f0a6641 (diff) | |
download | org.eclipse.osee-59713c5b968c75fb6aa8c636b21f2cdf82b95d5d.tar.gz org.eclipse.osee-59713c5b968c75fb6aa8c636b21f2cdf82b95d5d.tar.xz org.eclipse.osee-59713c5b968c75fb6aa8c636b21f2cdf82b95d5d.zip |
Fixed BooleanAttribute AttributeCellModifier in ArtifactEditor
3 files changed, 14 insertions, 1 deletions
diff --git a/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/BooleanAttribute.java b/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/BooleanAttribute.java index 6b0789ffe81..56152a60fe3 100644 --- a/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/BooleanAttribute.java +++ b/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/BooleanAttribute.java @@ -17,7 +17,7 @@ import java.io.InputStream; * @author Ryan D. Brooks */ public class BooleanAttribute extends Attribute<Boolean> { - private static final String[] booleanChoices = new String[] {"yes", "no"}; + public static final String[] booleanChoices = new String[] {"yes", "no"}; public BooleanAttribute(DynamicAttributeDescriptor attributeType, String defaultValue) { super(attributeType); diff --git a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/AttributeCellModifier.java b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/AttributeCellModifier.java index 92914b19233..545734fa47f 100644 --- a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/AttributeCellModifier.java +++ b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/AttributeCellModifier.java @@ -15,6 +15,7 @@ import org.eclipse.jface.viewers.ICellModifier; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.osee.framework.skynet.core.attribute.Attribute; import org.eclipse.osee.framework.skynet.core.attribute.BinaryAttribute; +import org.eclipse.osee.framework.skynet.core.attribute.BooleanAttribute; import org.eclipse.osee.framework.skynet.core.attribute.DateAttribute; import org.eclipse.osee.framework.skynet.core.attribute.EnumeratedAttribute; import org.eclipse.osee.framework.skynet.core.attribute.FloatingPointAttribute; @@ -72,6 +73,11 @@ public class AttributeCellModifier implements ICellModifier { */ public Object getValue(Object element, String property) { Attribute<?> attribute = (Attribute<?>) element; + if (attribute instanceof BooleanAttribute) { + enumeratedValue.setValue(((BooleanAttribute) attribute).getValue() ? "yes" : "no"); + enumeratedValue.setChocies(BooleanAttribute.booleanChoices); + return enumeratedValue; + } if (attribute instanceof StringAttribute || attribute instanceof IntegerAttribute || attribute instanceof FloatingPointAttribute) { stringValue.setValue(String.valueOf(attribute.getValue())); return stringValue; @@ -113,6 +119,9 @@ public class AttributeCellModifier implements ICellModifier { if (attribute instanceof DateAttribute) { ((DateAttribute) attribute).setValue((Date) value); } + if (attribute instanceof BooleanAttribute) { + ((BooleanAttribute) attribute).setValue(value.equals("yes")); + } //binary attributes should not be changed. else if (!(attribute instanceof BinaryAttribute)) { attribute.setStringData(value.toString()); diff --git a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/AttributeLabelProvider.java b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/AttributeLabelProvider.java index f6f58490b08..1645e819125 100644 --- a/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/AttributeLabelProvider.java +++ b/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/AttributeLabelProvider.java @@ -13,6 +13,7 @@ package org.eclipse.osee.framework.ui.skynet; import org.eclipse.jface.viewers.ILabelProviderListener; import org.eclipse.jface.viewers.ITableLabelProvider; import org.eclipse.osee.framework.skynet.core.attribute.Attribute; +import org.eclipse.osee.framework.skynet.core.attribute.BooleanAttribute; import org.eclipse.osee.framework.skynet.core.attribute.EnumeratedAttribute; import org.eclipse.swt.graphics.Image; @@ -50,6 +51,9 @@ public class AttributeLabelProvider implements ITableLabelProvider { if ((attribute instanceof EnumeratedAttribute) && attribute.toString() == null) { return "<Select>"; } + if (attribute instanceof BooleanAttribute) { + return ((BooleanAttribute) attribute).getValue() ? "yes" : "no"; + } return attribute.toString(); } |