Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 350020

Summary: [ui] InstalledIUElement.equals/AvailableIUElement.equals should consider the parent element
Product: [Eclipse Project] Equinox Reporter: Meng Xin Zhu <kane.zhu>
Component: p2Assignee: Meng Xin Zhu <kane.zhu>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: kane.mx, pascal
Version: 3.7   
Target Milestone: Juno   
Hardware: PC   
OS: Linux   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=550265
Whiteboard:
Attachments:
Description Flags
proposed fix none

Description Meng Xin Zhu CLA 2011-06-22 05:19:54 EDT
The available IU page has a checkbox viewer to show the available IUs that could be belonged to more than one category.

If using org.eclipse.jface.viewers.CheckboxTreeViewer.setSubtreeChecked(Object, boolean) to check the tree items, some duplicated items couldn't be checked. Because the implementation of CheckboxTreeViewer.setSubtreeChecked finds the tree item via the content's equals() method.
Comment 1 Meng Xin Zhu CLA 2011-06-22 05:20:51 EDT
Created attachment 198379 [details]
proposed fix
Comment 2 Pascal Rapicault CLA 2011-06-23 23:01:03 EDT
I'm not familiar with that code, could you please describe an example of where this will be happening and the sort of pb that could cause to the user? I may have misunderstood. Thx.
Comment 3 Meng Xin Zhu CLA 2011-06-28 01:30:25 EDT
(In reply to comment #2)
> I'm not familiar with that code, could you please describe an example of where
> this will be happening and the sort of pb that could cause to the user? I may
> have misunderstood. Thx.
Use the Indigo repository(http://download.eclipse.org/releases/indigo) in the install wizard, you can find 'PHP Development Tool' under three different categories(General purpose, Language and Web development tool).

The viewer is a checkbox tree viewer, clients might want to programmaticsly check the entire category such as 'Web development tool'. The clients probably calls the API org.eclipse.jface.viewers.CheckboxTreeViewer.setSubtreeChecked(Object, boolean) that find the children tree items via comparing to the data objects(call obj1.equals(obj2)).

Current implementation of AvailableIUElement.equals has flaw, the same name item(PHP Development Tool) under other categories might be checked.
Comment 4 Pascal Rapicault CLA 2011-06-28 17:38:13 EDT
Thx for the explanation. Go ahead and release the change. If you want to have this be backported to Indigo, please clone this bug and assign it 3.7.1.
Comment 5 Meng Xin Zhu CLA 2011-06-29 01:37:04 EDT
fixed in HEAD
Comment 6 Pascal Rapicault CLA 2011-06-29 05:25:26 EDT
Should you want to release it in 3.7.x please clone this bug for easier traceability
Comment 7 Meng Xin Zhu CLA 2011-06-29 05:29:25 EDT
(In reply to comment #6)
> Should you want to release it in 3.7.x please clone this bug for easier
> traceability
I see. But there is no strong reason to release it in 3.7.x. :)
Comment 8 Pascal Rapicault CLA 2011-06-29 06:42:07 EDT
Then I'm happy to not fix it for 3.7.x :)