Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiles Parker2012-09-09 21:36:15 -0400
committerSteffen Pingel2012-09-09 21:36:15 -0400
commit68d3bf8c09357d5965be2074e134cfce92386276 (patch)
tree63288b6f694439df29681253cbe63e6542aaaed2 /org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data
parent1b9aac0aa26a56dc4c6b8d4427ae6a89d9a63cf5 (diff)
downloadorg.eclipse.mylyn.tasks-68d3bf8c09357d5965be2074e134cfce92386276.tar.gz
org.eclipse.mylyn.tasks-68d3bf8c09357d5965be2074e134cfce92386276.tar.xz
org.eclipse.mylyn.tasks-68d3bf8c09357d5965be2074e134cfce92386276.zip
ASSIGNED - bug 387492: [api] provide iterators and other services for
TaskSchema https://bugs.eclipse.org/bugs/show_bug.cgi?id=387492 Change-Id: I00a0c80eb8b03e71d71cc3d205c4608b1ebf38bb Signed-off-by: Miles Parker <milesparker@gmail.com>
Diffstat (limited to 'org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data')
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/AbstractTaskSchema.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/AbstractTaskSchema.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/AbstractTaskSchema.java
index a70db57ff..4bb6cb167 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/AbstractTaskSchema.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/AbstractTaskSchema.java
@@ -11,7 +11,9 @@
package org.eclipse.mylyn.tasks.core.data;
+import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
import java.util.Collections;
import java.util.EnumSet;
import java.util.LinkedHashMap;
@@ -25,6 +27,7 @@ import org.eclipse.core.runtime.Assert;
*
* @author Steffen Pingel
* @author David Green
+ * @author Miles Parker
* @since 3.5
*/
public abstract class AbstractTaskSchema {
@@ -248,16 +251,33 @@ public abstract class AbstractTaskSchema {
private final Map<String, Field> fieldByKey = new LinkedHashMap<String, Field>();
+ /**
+ * Returns the specified field for the given key.
+ */
public Field getFieldByKey(String taskKey) {
return fieldByKey.get(taskKey);
}
+ /**
+ * Creates no-value attributes with default options for the supplied task for each schema field.
+ */
public void initialize(TaskData taskData) {
for (Field field : fieldByKey.values()) {
field.createAttribute(taskData.getRoot());
}
}
+ /**
+ * Provides an iterator for all fields within the schema. Subsequent modifications to the returned collection are
+ * not reflected to schema.
+ *
+ * @since 3.9
+ * @return all fields within the schema
+ */
+ public Collection<Field> getFields() {
+ return new ArrayList<Field>(fieldByKey.values());
+ }
+
protected Field createField(String key, String label, String type) {
return createField(key, label, type, null, (Flag[]) null);
}

Back to the top