| Summary: | [Gallery] Gallery.remove(GalleryItem item) doesn't succeed to remove an item GalleryItem from a group GalleryItem. | ||||||
|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Vincent Monfort <nobelius> | ||||
| Component: | Nebula | Assignee: | Nicolas Richeton <nicolas.richeton> | ||||
| Status: | CLOSED FIXED | QA Contact: | |||||
| Severity: | major | ||||||
| Priority: | P1 | Keywords: | plan | ||||
| Version: | unspecified | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | All | ||||||
| OS: | All | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Fixed in CVS > 20090515 Added unit test Thanks Created attachment 135940 [details]
mylyn/context/zip
Fixed Closing this bug |
Build ID: M20080221-1800 Steps To Reproduce: Case 1: 1.Create one Gallery with one GalleryItem "group" and one GalleryItem "item" which has "group" as parent. 2. Use Gallery.remove("item") 3. The GalleryItem "group" is removed because it remove the GalleryItem with index==0 of Gallery. Case 2: 1.Create one Gallery with one GalleryItem "group" and two GalleryItem "item1" and "item2" which have both "group" as parent. 2. Use Gallery.remove("item2") 3. The Exception : "java.lang.ArrayIndexOutOfBoundsException: 1 at org.eclipse.nebula.widgets.gallery.Gallery._remove(Gallery.java:2141) at org.eclipse.nebula.widgets.gallery.Gallery.remove(Gallery.java:2128) at org.eclipse.nebula.widgets.gallery.Gallery.remove(Gallery.java:2136)" will be thrown because Gallery try to remove the GalleryItem group with index==1 which doesn't exists. Indeed the good index in the group was found ("1") but it try to remove a group and not the item. More information: I did a correction for my personnal purpose which resolve the problem described. It is based on the mechanism to find the good index : Gallery.indexof(GalleryItem). Corrected method: "public void remove(GalleryItem item) { int index = indexOf(item); if (item.getParentItem() == null){ this.remove(index); }else{ this._remove(item.getParentItem(), index); //To update the view otherwise it's not done updateStructuralValues(null, false); updateScrollBarsProperties(); } } "