diff options
author | chris.poon | 2015-11-17 22:11:21 +0000 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org | 2015-12-02 01:15:00 +0000 |
commit | 444fcccff52839d95667e5bf2f9a816e1c51af4f (patch) | |
tree | 66ddad81c01be924cac1c64fedaaa94377d5df49 | |
parent | ff319144e7d78418205f186ae571b94048d08c46 (diff) | |
download | org.eclipse.mylyn.tasks-444fcccff52839d95667e5bf2f9a816e1c51af4f.tar.gz org.eclipse.mylyn.tasks-444fcccff52839d95667e5bf2f9a816e1c51af4f.tar.xz org.eclipse.mylyn.tasks-444fcccff52839d95667e5bf2f9a816e1c51af4f.zip |
483421: enable attribute editors to be used for child attributes
Change-Id: I9f4f8bb7b62dd173850907dc5b5f17e819b66b35
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=483421
Signed-off-by: chris.poon <chris.poon@tasktop.com>
2 files changed, 10 insertions, 14 deletions
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 eab2bd361..a02a5b2d2 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,16 +66,11 @@ public class TaskDataModel { /** * Invoke upon change to attribute value. - * + * * @param attribute * changed attribute */ public void attributeChanged(TaskAttribute attribute) { - if (attribute.getParentAttribute() != getTaskData().getRoot()) { - throw new RuntimeException( - "Editing is only supported for attributes that are attached to the root of task data"); //$NON-NLS-1$ - } - unsavedChangedAttributes.add(attribute); if (this.listeners != null) { final TaskDataModelEvent event = new TaskDataModelEvent(this, EventKind.CHANGED, attribute); @@ -84,8 +79,7 @@ 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 { @@ -98,7 +92,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 @@ -182,8 +176,7 @@ 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.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractAttributeEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractAttributeEditor.java index dda18cfed..41ec2a872 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractAttributeEditor.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractAttributeEditor.java @@ -45,7 +45,7 @@ public abstract class AbstractAttributeEditor { /** * The key used to associate the editor control with the corresponding task attribute. This enables lookup of the * model element from the widget hierarchy. - * + * * @since 3.5 * @see Control#getData(String) * @see #getControl() @@ -136,6 +136,9 @@ public abstract class AbstractAttributeEditor { protected void attributeChanged() { if (!refreshInProgress) { getModel().attributeChanged(getTaskAttribute()); + if (!getTaskAttribute().getTaskData().getRoot().equals(getTaskAttribute().getParentAttribute())) { + getModel().attributeChanged(getTaskAttribute().getParentAttribute()); + } } } @@ -352,7 +355,7 @@ public abstract class AbstractAttributeEditor { * <code>UnsupportedOperationException</code>. * <p> * Subclasses should overwrite this method. - * + * * @since 3.1 * @throws UnsupportedOperationException * if this method is not supported by the editor @@ -364,7 +367,7 @@ public abstract class AbstractAttributeEditor { /** * Subclasses that implement refresh should override this method to return true, so that they will be automatically * refreshed when the model changes. - * + * * @return whether the editor should be automatically refreshed when the model changes * @since 3.6 */ |