Community
Participate
Working Groups
The modify(...) method on ICellModifier is passed the Item widget, not the element object. This is contrary to how it is spec'ed. See also: 1G7CG5V: ITPUI:ALL - API : What object should an ICellModifier receive NOTES: KH (8/13/2001 2:03:38 PM) No breaking API changes.
PRODUCT VERSION: 0.047
Can't change implementation. Need to fix spec to document current behaviour.
*** Bug 14491 has been marked as a duplicate of this bug. ***
Should still do this.
The offending code (which cannot be fixed without breaking many existing implementations of ICellModifier) is in org.eclipse.jface.viewers.TableViewerImpl.saveEditorValue(CellEditor, Item).
Changing the spec for ICellModifier.modify(...) from: /** * Modifies the value for the given property of the given element. * Has no effect if the element does not have the given property, * or if the property cannot be modified. * * @param element the model element * @param property the property * @param value the new property value */ to: /** * Modifies the value for the given property of the given element. * Has no effect if the element does not have the given property, * or if the property cannot be modified. * <p> * Note that due to an implementation bug (#1938), an SWT Item * can get passed instead of the model element. * Unfortunately, fixing this bug would break most existing implementations * of this method which now assume an Item is always passed. * To work around this in a safe way, use: * <pre> * if (element instanceof Item) { * element = ((Item) element).getData(); * } * // modify the element's property here * </pre> * </p> * * @param element the model element or SWT Item (see above) * @param property the property * @param value the new property value * * @see org.eclipse.swt.widgets.Item */
Created attachment 1516 [details] ICellModifier.java with changed spec for modify
Reviewed spec change, OK to release.
Released change with slightly different wording recommended by KH. Randy, could you please double-check it again?
*** Bug 11581 has been marked as a duplicate of this bug. ***
*** Bug 22805 has been marked as a duplicate of this bug. ***