Can I modify an attribute during the execution of TaskDataModelListener.attributeChanged(),
refresh the editor page via AbstractTaskEditorPage.refreshFormContent(),
and expect to be in a consistent state? I’m finding that upon refresh, the
modifications I make in attributeChanged() are gone.
Here’s my task editor page’s init method:
@Override
public void
init(IEditorSite site, IEditorInput input) {
super.init(site,
input);
getModel().addModelListener(new
ModelListener(this));
}
In my model listener, I have this method, which updates the
read-only state of an attribute depending on the value of another attribute:
@Override
public void
attributeChanged(TaskDataModelEvent event) {
TaskAttribute changed =
event.getTaskAttribute();
TaskData taskData =
changed.getTaskData();
if (changed.getId().equals(ATTRIBUTE_TO_BE_WATCHED))
{
TaskAttribute
dependent = taskData.getRoot().getAttribute(DEPENDENT_ATTRIBUTE);
if
(changed.getValue().equals(INTERESTING_VALUE)) {
dependent.getMetaData().setReadOnly(true);
} else {
dependent.getMetaData().setReadOnly(false);
}
editorPage.refreshFormContent();
}
}
What I’m seeing is that after the refreshFormContent()
call, the dependent attribute’s state is back to what it was before; the
change doesn’t take effect.
Any ideas?
Larry Edelstein
Senior Member of Technical Staff
Salesforce.com
ledelstein@xxxxxxxxxxxxxx