Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2010-12-10 19:31:19 +0000
committerspingel2010-12-10 19:31:19 +0000
commit67c6bc6a9802a17fc9653eb553793bc0290d8661 (patch)
treeb9f6a5fd91ebe29baabe4a75c17b075a59f620c7 /org.eclipse.mylyn.tasks.core
parentd9af088498ce6b1f0af38cf85714cc99a77d5c75 (diff)
downloadorg.eclipse.mylyn.tasks-67c6bc6a9802a17fc9653eb553793bc0290d8661.tar.gz
org.eclipse.mylyn.tasks-67c6bc6a9802a17fc9653eb553793bc0290d8661.tar.xz
org.eclipse.mylyn.tasks-67c6bc6a9802a17fc9653eb553793bc0290d8661.zip
RESOLVED - bug 329575: [api] task attribute type for double
https://bugs.eclipse.org/bugs/show_bug.cgi?id=329575
Diffstat (limited to 'org.eclipse.mylyn.tasks.core')
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttribute.java5
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttributeMapper.java26
2 files changed, 31 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttribute.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttribute.java
index 262763fc7..87b00727f 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttribute.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttribute.java
@@ -251,6 +251,11 @@ public final class TaskAttribute {
public static final String TYPE_URL = "url"; //$NON-NLS-1$
+ /**
+ * @since 3.5
+ */
+ public static final String TYPE_DOUBLE = "double"; //$NON-NLS-1$
+
public static final String USER_ASSIGNED = "task.common.user.assigned"; //$NON-NLS-1$
@Deprecated
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttributeMapper.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttributeMapper.java
index 408421d00..2c7687848 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttributeMapper.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttributeMapper.java
@@ -112,6 +112,21 @@ public class TaskAttributeMapper {
return taskAttribute.getMetaData().getDefaultOption();
}
+ /**
+ * @since 3.5
+ */
+ public Double getDoubleValue(TaskAttribute attribute) {
+ String doubleString = attribute.getValue();
+ try {
+ if (doubleString != null) {
+ return Double.parseDouble(doubleString);
+ }
+ } catch (NumberFormatException e) {
+ // ignore
+ }
+ return null;
+ }
+
public Integer getIntegerValue(TaskAttribute attribute) {
String integerString = attribute.getValue();
try {
@@ -234,6 +249,17 @@ public class TaskAttributeMapper {
}
}
+ /**
+ * @since 3.5
+ */
+ public void setDoubleValue(TaskAttribute attribute, Double value) {
+ if (value != null) {
+ attribute.setValue(value.toString());
+ } else {
+ attribute.clearValues();
+ }
+ }
+
public void setIntegerValue(TaskAttribute attribute, Integer value) {
if (value != null) {
attribute.setValue(value.toString());

Back to the top