492500: read-only required attributes should not have error decorator
Change-Id: Ib378fddaa2b96cac892fdae55514448daaa53979
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=492500
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 41ec2a8..a7f2c9f 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 @@
/**
* 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()
@@ -315,7 +315,10 @@
protected boolean needsValue() {
boolean isRequired = getTaskAttribute().getMetaData().isRequired();
boolean hasValue = !StringUtils.isEmpty(getAttributeMapper().getValue(getTaskAttribute()));
- return isRequired && !hasValue;
+ boolean isReadOnly = getTaskAttribute().getMetaData().isReadOnly();
+ // for an empty required read only attribute we do not show the error decorator
+ // because the user can not change the value (see bug#492500 ).
+ return isRequired && !hasValue && !isReadOnly;
}
/**
@@ -355,7 +358,7 @@
* <code>UnsupportedOperationException</code>.
* <p>
* Subclasses should overwrite this method.
- *
+ *
* @since 3.1
* @throws UnsupportedOperationException
* if this method is not supported by the editor
@@ -367,7 +370,7 @@
/**
* 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
*/