Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.mylyn.tasks.core/src/org')
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java85
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/AbstractTaskSchema.java89
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttribute.java45
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttributeMapper.java8
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttributeMetaData.java22
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskDataModel.java12
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskDataModelListener.java1
7 files changed, 175 insertions, 87 deletions
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java
index 13660f564..7603904a6 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java
@@ -105,7 +105,7 @@ import org.eclipse.mylyn.tasks.core.sync.ISynchronizationSession;
* <li>{@link #canSynchronizeTask(TaskRepository, ITask)} returns <code>false</code> so full task data is never
* retrieved
* </ul>
- *
+ *
* @author Mik Kersten
* @author Rob Elves
* @author Shawn Minto
@@ -118,7 +118,7 @@ public abstract class AbstractRepositoryConnector {
/**
* Returns true, if the connector provides a wizard for creating new tasks.
- *
+ *
* @since 2.0
*/
// TODO move this to ConnectorUi.hasNewTaskWizard()
@@ -126,14 +126,14 @@ public abstract class AbstractRepositoryConnector {
/**
* Returns true, if the connector supports retrieval of tasks based on String keys.
- *
+ *
* @since 2.0
*/
public abstract boolean canCreateTaskFromKey(@NonNull TaskRepository repository);
/**
* Returns true, if the connector supports retrieval of task history for <code>task</code>.
- *
+ *
* @see #getHistory(TaskRepository, ITask, IProgressMonitor)
* @since 3.6
*/
@@ -143,7 +143,7 @@ public abstract class AbstractRepositoryConnector {
/**
* Returns true, if the connector supports querying the repository.
- *
+ *
* @since 3.0
* @see #performQuery(TaskRepository, IRepositoryQuery, TaskDataCollector, ISynchronizationSession,
* IProgressMonitor)
@@ -154,7 +154,7 @@ public abstract class AbstractRepositoryConnector {
/**
* Returns true, if the connectors support retrieving full task data for <code>task</code>.
- *
+ *
* @since 3.0
* @see #getTaskData(TaskRepository, String, IProgressMonitor)
*/
@@ -164,7 +164,7 @@ public abstract class AbstractRepositoryConnector {
/**
* Returns true, if the connector supports deletion of <code>task</code> which is part of <code>repository</code>.
- *
+ *
* @since 3.3
*/
public boolean canDeleteTask(@NonNull TaskRepository repository, @NonNull ITask task) {
@@ -174,7 +174,7 @@ public abstract class AbstractRepositoryConnector {
/**
* Return true, if the connector supports creation of task repositories. The default default implementation returns
* true.
- *
+ *
* @since 3.4
*/
public boolean canCreateRepository() {
@@ -183,7 +183,7 @@ public abstract class AbstractRepositoryConnector {
/**
* Returns the unique kind of the repository, e.g. "bugzilla".
- *
+ *
* @since 2.0
*/
@NonNull
@@ -191,7 +191,7 @@ public abstract class AbstractRepositoryConnector {
/**
* The connector's summary i.e. "JIRA (supports 3.3.1 and later)"
- *
+ *
* @since 2.0
*/
@NonNull
@@ -203,7 +203,7 @@ public abstract class AbstractRepositoryConnector {
* Implementations typically match the task identifier based on repository specific patterns. For a Bugzilla task
* URL for example the implementation would match on <code>bugs.cgi</code> and return the repository specific
* portion of the URL: &quot;<i>http://bugs/</i><b>bugs.cgi?bugid=</b>123&quot;.
- *
+ *
* @return a task identifier or <code>null</code>, if <code>taskUrl</code> is not recognized
* @see #getTaskData(TaskRepository, String, IProgressMonitor)
*/
@@ -215,7 +215,7 @@ public abstract class AbstractRepositoryConnector {
* <p>
* The default implementations returns the substring of the text returned by {@link #getLabel()} up to the first
* occurrence of <em>(</em> or a space.
- *
+ *
* @since 2.3
*/
@Nullable
@@ -242,7 +242,7 @@ public abstract class AbstractRepositoryConnector {
* Returns the attachment handler. The method is expected to always return the same instance.
* <p>
* The default implementation returns <code>null</code>.
- *
+ *
* @return the attachment handler, or null, if attachments are not supported
* @since 3.0
*/
@@ -253,7 +253,7 @@ public abstract class AbstractRepositoryConnector {
/**
* Returns the full task data. The method is expected to always return the same instance.
- *
+ *
* @param repository
* the task repository matching this connector
* @param taskIdOrKey
@@ -273,7 +273,7 @@ public abstract class AbstractRepositoryConnector {
* Returns the task data handler. The method is expected to always return the same instance.
* <p>
* The default implementation returns <code>null</code>.
- *
+ *
* @return the task data handler, or null, task data submission is not supported
* @since 3.0
*/
@@ -289,7 +289,7 @@ public abstract class AbstractRepositoryConnector {
* <p>
* Implementations typically match the task identifier based on repository specific patterns such as
* &quot;http://bugs/<b>bugs.cgibugid=123</b>&quot;.
- *
+ *
* @return a task identifier or <code>null</code>, if <code>taskUrl</code> is not recognized
* @see #getTaskData(TaskRepository, String, IProgressMonitor)
* @since 2.0
@@ -310,7 +310,7 @@ public abstract class AbstractRepositoryConnector {
* tasks.
* <p>
* Implementations typically scan <code>comment</code> for repository specific patterns such as KEY-123 for JIRA.
- *
+ *
* @return null, if the method is not supported; an array of task identifiers otherwise
* @since 2.0
*/
@@ -322,7 +322,7 @@ public abstract class AbstractRepositoryConnector {
/**
* Returns a mapping for {@link TaskData}. The mapping maps the connector specific representation to the standard
* schema defined in {@link ITaskMapping}.
- *
+ *
* @since 3.0
*/
@NonNull
@@ -336,7 +336,7 @@ public abstract class AbstractRepositoryConnector {
* For subtasks implementations are expected to return relations creates by {@link TaskRelation#subtask(String)}.
* <p>
* The default implementation returns <code>null</code>.
- *
+ *
* @return a list of relations or null if <code>taskData</code> does not have relations or if task relations are not
* supported
* @since 3.0
@@ -349,7 +349,7 @@ public abstract class AbstractRepositoryConnector {
/**
* Returns a task URL for the task referenced by <code>taskIdOrKey</code> in the repository referenced by
* <code>repositoryUrl</code>.
- *
+ *
* @return a task URL or null if the connector does not support task URLs
* @see #getTaskIdFromTaskUrl(String)
* @see #getRepositoryUrlFromTaskUrl(String)
@@ -362,7 +362,7 @@ public abstract class AbstractRepositoryConnector {
* Returns a URL for <code>element</code> that contains authentication information such as a session ID.
* <p>
* Returns <code>null</code> by default. Clients may override.
- *
+ *
* @param repository
* the repository for <code>element</code>
* @param element
@@ -380,7 +380,7 @@ public abstract class AbstractRepositoryConnector {
* Returns a browsable URL for <code>element</code>.
* <p>
* Returns <code>null</code> by default. Clients may override.
- *
+ *
* @param repository
* the repository for <code>element</code>
* @param element
@@ -398,7 +398,7 @@ public abstract class AbstractRepositoryConnector {
* <code>task</code>.
* <p>
* See {@link AbstractRepositoryConnector} for more details how this method interacts with other methods.
- *
+ *
* @since 3.0
* @see #updateTaskFromTaskData(TaskRepository, ITask, TaskData)
*/
@@ -410,7 +410,7 @@ public abstract class AbstractRepositoryConnector {
* repository which is the common case and default.
* <p>
* The default implementation returns <code>false</code>.
- *
+ *
* @since 3.0
*/
public boolean hasLocalCompletionState(@NonNull TaskRepository repository, @NonNull ITask task) {
@@ -421,7 +421,7 @@ public abstract class AbstractRepositoryConnector {
* Returns <code>true</code>, if <code>task</code> has a due date that is managed on the repository.
* <p>
* The default implementation returns <code>false</code>.
- *
+ *
* @since 3.0
*/
public boolean hasRepositoryDueDate(@NonNull TaskRepository repository, @NonNull ITask task,
@@ -433,7 +433,7 @@ public abstract class AbstractRepositoryConnector {
* Returns <code>true</code> to indication that the repository configuration is stale and requires update
* <p>
* The default implementation returns <code>true</code> every 24 hours.
- *
+ *
* @return true to indicate that the repository configuration is stale and requires update
* @since 3.0
*/
@@ -450,7 +450,7 @@ public abstract class AbstractRepositoryConnector {
* Returns true, if users can manage create repositories for this connector.
* <p>
* The default implementation returns true.
- *
+ *
* @since 2.0
*/
public boolean isUserManaged() {
@@ -464,7 +464,7 @@ public abstract class AbstractRepositoryConnector {
* Implementors must complete executing <code>query</code> before returning from this method.
* <p>
* See {@link AbstractRepositoryConnector} for more details how this method interacts with other methods.
- *
+ *
* @param repository
* task repository to run query against
* @param query
@@ -487,20 +487,20 @@ public abstract class AbstractRepositoryConnector {
/**
* Delete the task from the server
- *
+ *
* @throws UnsupportedOperationException
* if this is not implemented by the connector
* @since 3.3
*/
@NonNull
- public IStatus deleteTask(@NonNull TaskRepository repository, @NonNull ITask task, @NonNull IProgressMonitor monitor)
- throws CoreException {
+ public IStatus deleteTask(@NonNull TaskRepository repository, @NonNull ITask task,
+ @NonNull IProgressMonitor monitor) throws CoreException {
throw new UnsupportedOperationException();
}
/**
* Hook into the synchronization process.
- *
+ *
* @since 3.0
*/
public void postSynchronization(@NonNull ISynchronizationSession event, @NonNull IProgressMonitor monitor)
@@ -516,7 +516,7 @@ public abstract class AbstractRepositoryConnector {
* Hook into the synchronization process.
* <p>
* See {@link AbstractRepositoryConnector} for more details how this method interacts with other methods.
- *
+ *
* @since 3.0
*/
public void preSynchronization(@NonNull ISynchronizationSession event, @NonNull IProgressMonitor monitor)
@@ -532,7 +532,7 @@ public abstract class AbstractRepositoryConnector {
* Updates the local repository configuration cache (e.g. products and components). Connectors are encouraged to
* implement {@link #updateRepositoryConfiguration(TaskRepository, ITask, IProgressMonitor)} in addition this
* method.
- *
+ *
* @param repository
* the repository to update configuration for
* @since 3.0
@@ -544,7 +544,7 @@ public abstract class AbstractRepositoryConnector {
/**
* Updates the local repository configuration cache (e.g. products and components). The default implementation
* invokes {@link #updateRepositoryConfiguration(TaskRepository, IProgressMonitor)}.
- *
+ *
* @param repository
* the repository to update configuration for
* @param task
@@ -562,7 +562,7 @@ public abstract class AbstractRepositoryConnector {
* used to map common attributes.
* <p>
* See {@link AbstractRepositoryConnector} for more details how this method interacts with other methods.
- *
+ *
* @see #hasTaskChanged(TaskRepository, ITask, TaskData)
* @see TaskMapper#applyTo(ITask)
* @since 3.0
@@ -574,7 +574,7 @@ public abstract class AbstractRepositoryConnector {
* Called when a new task is created, before it is opened in a task editor. Connectors should override this method
* if they need information from the {@link TaskData} to determine kind labels or other information that should be
* displayed in a new task editor.
- *
+ *
* @since 3.5
*/
public void updateNewTaskFromTaskData(@NonNull TaskRepository taskRepository, @NonNull ITask task,
@@ -586,7 +586,7 @@ public abstract class AbstractRepositoryConnector {
* is submitted to the repository. Implementers may override to implement custom migration rules.
* <p>
* Does nothing by default.
- *
+ *
* @param event
* provides additional details
* @since 3.4
@@ -596,7 +596,7 @@ public abstract class AbstractRepositoryConnector {
/**
* Returns if the user using the repository is the owner of the task. Subclasses may override.
- *
+ *
* @param repository
* repository task is associated with
* @param task
@@ -611,7 +611,7 @@ public abstract class AbstractRepositoryConnector {
/**
* Retrieves the history for <code>task</code>. Throws {@link UnsupportedOperationException} by default.
- *
+ *
* @param repository
* the repository
* @param task
@@ -635,7 +635,7 @@ public abstract class AbstractRepositoryConnector {
* requires connecting to the repository.
* <p>
* Throws {@link UnsupportedOperationException} if not implemented by clients.
- *
+ *
* @param repository
* the repository
* @param monitor
@@ -654,7 +654,7 @@ public abstract class AbstractRepositoryConnector {
* Set the category of the {@code repository} to the default TaskRepository.CATEGORY_BUGS.
* <p>
* Subclasses may override.
- *
+ *
* @param repository
* the repository
* @since 3.11
@@ -662,4 +662,5 @@ public abstract class AbstractRepositoryConnector {
public void applyDefaultCategory(@NonNull TaskRepository repository) {
repository.setCategory(TaskRepository.CATEGORY_BUGS);
}
+
}
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 2b70dfc66..db258e8c7 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
@@ -44,12 +44,14 @@ public abstract class AbstractTaskSchema {
private final String indexKey;
+ private final String dependsOn;
+
protected Field(String key, String label, String type) {
- this(key, label, type, null, (Flag[]) null);
+ this(key, label, type, null, null, (Flag[]) null);
}
protected Field(String key, String label, String type, Flag... flags) {
- this(key, label, type, null, flags);
+ this(key, label, type, null, null, flags);
}
/**
@@ -68,6 +70,27 @@ public abstract class AbstractTaskSchema {
* @since 3.7
*/
public Field(String key, String label, String type, String indexKey, Flag... flags) {
+ this(key, label, type, indexKey, null, flags);
+ }
+
+ /**
+ * @param key
+ * the task attribute key, which may be a common task attribute key defined in defined in
+ * {@link TaskAttribute}
+ * @param label
+ * the user-visible label that is used by the user to identify this field
+ * @param type
+ * the type of the field, should be one of the constants defined in TaskAttribute (
+ * <code>TaskAttribute.TYPE_*</code>)
+ * @param indexKey
+ * the index key, or null if this should not be indexed
+ * @param dependsOn
+ * the key of the TaskAttribute which is the parent of the dependency
+ * @param flags
+ * the flags, or null
+ * @since 3.17
+ */
+ public Field(String key, String label, String type, String indexKey, String dependsOn, Flag... flags) {
Assert.isNotNull(key);
Assert.isNotNull(label);
Assert.isNotNull(type);
@@ -75,6 +98,7 @@ public abstract class AbstractTaskSchema {
this.label = label;
this.type = type;
this.indexKey = indexKey;
+ this.dependsOn = dependsOn;
if (flags == null || flags.length == 0) {
this.flags = EnumSet.noneOf(Flag.class);
} else {
@@ -91,6 +115,9 @@ public abstract class AbstractTaskSchema {
metaData.setReadOnly(isReadOnly());
metaData.setKind(getKind());
metaData.setRequired(isRequired());
+ if (getDependsOn() != null) {
+ metaData.setDependsOn(getDependsOn());
+ }
// options
Map<String, String> options = getDefaultOptions();
if (options != null) {
@@ -200,23 +227,29 @@ public abstract class AbstractTaskSchema {
return flags.contains(Flag.REQUIRED);
}
+ /**
+ * @since 3.17
+ */
+ public String getDependsOn() {
+ return dependsOn;
+ }
+
}
public enum Flag {
- ATTRIBUTE, OPERATION, PEOPLE, READ_ONLY,
- /**
- * A flag used to indicate that the field is related to a description.
- *
- * @since 3.11
- * @see TaskAttribute#KIND_DESCRIPTION
- */
- DESCRIPTION,
- /**
- * A flag used to indicate that the field is required.
- *
- * @since 3.11
- * @see TaskAttribute#META_REQUIRED
- */
+ ATTRIBUTE, OPERATION, PEOPLE, READ_ONLY, /**
+ * A flag used to indicate that the field is related to a
+ * description.
+ *
+ * @since 3.11
+ * @see TaskAttribute#KIND_DESCRIPTION
+ */
+ DESCRIPTION, /**
+ * A flag used to indicate that the field is required.
+ *
+ * @since 3.11
+ * @see TaskAttribute#META_REQUIRED
+ */
REQUIRED
};
@@ -231,11 +264,14 @@ public abstract class AbstractTaskSchema {
private String type;
+ private String dependsOn;
+
public FieldFactory(Field source) {
this.flags = EnumSet.copyOf(source.flags);
this.key = source.key;
this.label = source.label;
this.type = source.type;
+ this.dependsOn = source.dependsOn;
}
public FieldFactory addFlags(Flag... flags) {
@@ -244,7 +280,8 @@ public abstract class AbstractTaskSchema {
}
public Field create() {
- return createField(key, label, type, (!flags.isEmpty()) ? flags.toArray(new Flag[0]) : null);
+ return createField(key, label, type, null, dependsOn,
+ (!flags.isEmpty()) ? flags.toArray(new Flag[0]) : null);
}
public FieldFactory flags(Flag... flags) {
@@ -272,6 +309,14 @@ public abstract class AbstractTaskSchema {
return this;
}
+ /**
+ * @since 3.17
+ */
+ public FieldFactory dependsOn(String dependsOn) {
+ this.dependsOn = dependsOn;
+ return this;
+ }
+
}
private final Map<String, Field> fieldByKey = new LinkedHashMap<String, Field>();
@@ -316,7 +361,15 @@ public abstract class AbstractTaskSchema {
* @see Field#Field(String, String, String, String, Flag...)
*/
protected Field createField(String key, String label, String type, String indexKey, Flag... flags) {
- Field field = new Field(key, label, type, indexKey, flags);
+ return createField(key, label, type, indexKey, null, flags);
+ }
+
+ /**
+ * @since 3.17
+ */
+ protected Field createField(String key, String label, String type, String indexKey, String dependsOn,
+ Flag... flags) {
+ Field field = new Field(key, label, type, indexKey, dependsOn, flags);
fieldByKey.put(key, field);
return field;
}
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 269488723..7ea11c65e 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
@@ -21,7 +21,7 @@ import org.eclipse.core.runtime.Assert;
/**
* Encapsulates attributes for task data.
- *
+ *
* @author Rob Elves
* @author Steffen Pingel
* @author Miles Parker
@@ -111,7 +111,7 @@ public final class TaskAttribute {
/**
* A {@link TaskAttributeMetaData#getKind() kind} used to indicate that the field is related to a description.
- *
+ *
* @since 3.11
*/
public static final String KIND_DESCRIPTION = "task.common.kind.description"; //$NON-NLS-1$
@@ -127,12 +127,26 @@ public final class TaskAttribute {
public static final String META_ATTRIBUTE_TYPE = "task.meta.type"; //$NON-NLS-1$
/**
- * A key for {@link TaskAttributeMetaData} that is used for specifying the media type of a
- * {@link #TYPE_LONG_RICH_TEXT} or {@link #TYPE_SHORT_RICH_TEXT}. The media type if specified must be a valid <a
- * href="http://en.wikipedia.org/wiki/Internet_media_type">Internet Media Type</a> (also known as Content-Type,
- * mime-type) according to <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045</a> and <a
- * href="http://www.ietf.org/rfc/rfc2046.txt">RFC 2046</a>.
+ * A key for {@link TaskAttributeMetaData} that is used for specifying the ID of the parent {@link TaskAttribute}
+ * for attributes that have a dependency. When the parent is changed we look for all attributes with have a
+ * {@link TaskAttributeMetaData} of this key and an value of the ID from the changed {@link TaskAttribute} and also
+ * trigger a change. With this we can refresh the options of each {@link TaskAttribute}.<br>
+ * <br>
+ * Example: In Bugzilla we have COMPONENT, VERSION, TARGET_MILESTONE as depends on the PRODUCT. We can so update the
+ * options of the attributes to match the definition of the PRODUCT.
*
+ * @see #BugzillaRestCreateTaskSchema
+ * @since 3.16
+ */
+ public static final String META_DEPENDS_ON_ATTRIBUTE_ID = "task.meta.dependson.attribute"; //$NON-NLS-1$
+
+ /**
+ * A key for {@link TaskAttributeMetaData} that is used for specifying the media type of a
+ * {@link #TYPE_LONG_RICH_TEXT} or {@link #TYPE_SHORT_RICH_TEXT}. The media type if specified must be a valid
+ * <a href="http://en.wikipedia.org/wiki/Internet_media_type">Internet Media Type</a> (also known as Content-Type,
+ * mime-type) according to <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045</a> and
+ * <a href="http://www.ietf.org/rfc/rfc2046.txt">RFC 2046</a>.
+ *
* @see #TYPE_LONG_RICH_TEXT
* @see #TYPE_SHORT_RICH_TEXT
* @see #META_ATTRIBUTE_TYPE
@@ -152,7 +166,7 @@ public final class TaskAttribute {
* Key for {@link TaskAttributeMetaData} used to specify that a field requires a value before it can be submitted to
* the server. This meta-data is used by the framework as a UI hint and does not guarantee that a connector will
* enforce compliance before attempting to post task data.
- *
+ *
* @since 3.11
*/
public static final String META_REQUIRED = "task.meta.required"; //$NON-NLS-1$
@@ -165,7 +179,7 @@ public final class TaskAttribute {
/**
* Key for the meta datum that determines if an attribute is disabled. This is used to indicate that an attribute
* should not be modified, e.g. due to work-flow state but it may still be generally writeable.
- *
+ *
* @since 3.5
* @see TaskAttributeMetaData#isDisabled()
*/
@@ -173,7 +187,7 @@ public final class TaskAttribute {
/**
* Key for the meta datum that provides a description of an attribute, e.g. for display in a tooltip.
- *
+ *
* @since 3.5
* @see TaskAttributeMetaData
*/
@@ -184,7 +198,7 @@ public final class TaskAttribute {
* content. Provides a way for connectors to specify non-standard attributes as plain-text indexable. By default,
* {@link #SUMMARY summary} and {@link #DESCRIPTION description} are indexed. Note that setting this meta-data is
* advisory only and will not guarantee that content is indexed.
- *
+ *
* @since 3.7
*/
public static final String META_INDEXED_AS_CONTENT = "task.meta.index.content"; //$NON-NLS-1$
@@ -471,8 +485,9 @@ public final class TaskAttribute {
public TaskAttribute getMappedAttribute(String attributeId) {
Assert.isNotNull(attributeId);
- return (attributeById != null) ? attributeById.get(getTaskData().getAttributeMapper().mapToRepositoryKey(this,
- attributeId)) : null;
+ return (attributeById != null)
+ ? attributeById.get(getTaskData().getAttributeMapper().mapToRepositoryKey(this, attributeId))
+ : null;
}
public TaskAttribute getMappedAttribute(String[] path) {
@@ -555,7 +570,7 @@ public final class TaskAttribute {
* testing whether or not {@link #getValue()} returns an empty string, as it is possible that an empty string value
* has been explicitly set for the attribute. Call {@link #clearValues()} to return the attribute to the unset
* state.
- *
+ *
* @return true if any value is set (may be an empty string), false if no value is set.
* @since 3.9
*/
@@ -582,7 +597,7 @@ public final class TaskAttribute {
/**
* Adds an attribute option value
- *
+ *
* @param key
* The option value used when sending the form to the server
* @param value
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 c73fec783..fae2b654a 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
@@ -39,8 +39,8 @@ public class TaskAttributeMapper {
@NonNull
public TaskAttribute createTaskAttachment(@NonNull TaskData taskData) {
- TaskAttribute taskAttribute = taskData.getRoot().createAttribute(
- mapToRepositoryKey(taskData.getRoot(), TaskAttribute.NEW_ATTACHMENT));
+ TaskAttribute taskAttribute = taskData.getRoot()
+ .createAttribute(mapToRepositoryKey(taskData.getRoot(), TaskAttribute.NEW_ATTACHMENT));
// TaskAttachmentMapper mapper = TaskAttachmentMapper.createFrom(taskAttribute);
// mapper.setContentType("");
// mapper.setFileName("");
@@ -54,11 +54,11 @@ public class TaskAttributeMapper {
if (newAttribute.getValues().equals(oldAttribute.getValues())) {
return true;
}
- // the comment mapping accidentally changed throughout the Mylyn 3.7 cycle therefore some
+ // the comment mapping accidentally changed throughout the Mylyn 3.7 cycle therefore some
// cases need to be considered equal even though attribute values differ
if (oldAttribute != null) {
TaskAttribute commentIdAttribute = oldAttribute.getAttribute("task.common.comment.id"); //$NON-NLS-1$
- // ID not present
+ // ID not present
if ((commentIdAttribute == null || commentIdAttribute.getValue().equals("")) //$NON-NLS-1$
&& newAttribute.getValue().equals("")) { //$NON-NLS-1$
return true;
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttributeMetaData.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttributeMetaData.java
index 5a52aa36e..e574b9bd2 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttributeMetaData.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskAttributeMetaData.java
@@ -115,6 +115,14 @@ public class TaskAttributeMetaData {
return taskAttribute.getMetaDatum(TaskAttribute.META_ATTRIBUTE_MEDIA_TYPE);
}
+ /**
+ * @since 3.17
+ * @see TaskAttribute#META_DEPENDS_ON_ATTRIBUTE_ID
+ */
+ public String getDependsOn() {
+ return taskAttribute.getMetaDatum(TaskAttribute.META_DEPENDS_ON_ATTRIBUTE_ID);
+ }
+
public TaskAttributeMetaData putValue(String key, String value) {
taskAttribute.putMetaDatum(key, value);
return this;
@@ -124,7 +132,7 @@ public class TaskAttributeMetaData {
* The default option property is not used. Connectors are expected to set default values in
* {@link AbstractTaskDataHandler#initializeTaskData(org.eclipse.mylyn.tasks.core.TaskRepository, TaskData, org.eclipse.mylyn.tasks.core.ITaskMapping, org.eclipse.core.runtime.IProgressMonitor)}
* .
- *
+ *
* @deprecated Not used, set default value in
* {@link AbstractTaskDataHandler#initializeTaskData(org.eclipse.mylyn.tasks.core.TaskRepository, TaskData, org.eclipse.mylyn.tasks.core.ITaskMapping, org.eclipse.core.runtime.IProgressMonitor)}
* instead.
@@ -146,7 +154,7 @@ public class TaskAttributeMetaData {
// taskAttribute.removeMetaDatum(TaskAttribute.META_DETAIL_LEVEL);
// }
// return this;
-// }
+// }
public TaskAttributeMetaData setKind(String value) {
if (value != null) {
@@ -214,4 +222,14 @@ public class TaskAttributeMetaData {
return this;
}
+ /**
+ * @since 3.17
+ * @see TaskAttribute#META_DEPENDS_ON_ATTRIBUTE_ID
+ * @return this
+ */
+ public TaskAttributeMetaData setDependsOn(String value) {
+ taskAttribute.putMetaDatum(TaskAttribute.META_DEPENDS_ON_ATTRIBUTE_ID, value);
+ return this;
+ }
+
}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskDataModel.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskDataModel.java
index 5202887b8..69ced64ed 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskDataModel.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskDataModel.java
@@ -66,7 +66,7 @@ public class TaskDataModel {
/**
* Invoke upon change to attribute value.
- *
+ *
* @param attribute
* changed attribute
*/
@@ -77,14 +77,15 @@ public class TaskDataModel {
}
unsavedChangedAttributes.add(attribute);
-
if (this.listeners != null) {
final TaskDataModelEvent event = new TaskDataModelEvent(this, EventKind.CHANGED, attribute);
TaskDataModelListener[] listeners = this.listeners.toArray(new TaskDataModelListener[0]);
+
for (final TaskDataModelListener listener : listeners) {
SafeRunner.run(new ISafeRunnable() {
public void handleException(Throwable e) {
- StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, "Listener failed", e)); //$NON-NLS-1$
+ StatusHandler
+ .log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, "Listener failed", e)); //$NON-NLS-1$
}
public void run() throws Exception {
@@ -97,7 +98,7 @@ public class TaskDataModel {
/**
* Returns the instance of <code>taskAttribute</code> that the user last read.
- *
+ *
* @param taskAttribute
* the attribute
* @return the last read state; null, if <code>taskAttribute</code> has never been read
@@ -181,7 +182,8 @@ public class TaskDataModel {
for (final TaskDataModelListener listener : listeners) {
SafeRunner.run(new ISafeRunnable() {
public void handleException(Throwable e) {
- StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, "Listener failed", e)); //$NON-NLS-1$
+ StatusHandler
+ .log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, "Listener failed", e)); //$NON-NLS-1$
}
public void run() throws Exception {
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskDataModelListener.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskDataModelListener.java
index 95f6c955f..74a6f2402 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskDataModelListener.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskDataModelListener.java
@@ -28,5 +28,4 @@ public abstract class TaskDataModelListener {
*/
public void modelRefreshed() {
}
-
}

Back to the top