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

Bug 319410

Summary: CCombo does not return it's actual children
Product: [Eclipse Project] Platform Reporter: Elias Volanakis <elias>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: eclipse.felipe, remy.suen
Version: 3.7   
Target Milestone: ---   
Hardware: PC   
OS: Windows Vista   
Whiteboard:
Attachments:
Description Flags
Patch none

Description Elias Volanakis CLA 2010-07-09 12:56:48 EDT
Created attachment 173882 [details]
Patch

CCombo extends Composite but ccombo.getChildren() always returns a 0-length array. It should return the actual children of the composite.

(Background: Not returning the actual children controls causes the contents of CCombo to be ignored by Riena's styling code. We have to use reflective access to private fields to get the CCombo's children :(.)

The attached patch removes getChildren() so that the default implementation is used.
Comment 1 Felipe Heidrich CLA 2010-07-15 10:01:02 EDT
This patch is wrong.

The code in ccombo overrides getChildren() so it does not return any children (as you saw). This behaviour is intentional, if the code wasn't there (as in your patch) getChildren() would return the internal children that make up the CCombo (the Text/Button/List). These children are private and should never be accessed outside of CCombo's implementation.

Here the java doc in CCombo:

 * Note that although this class is a subclass of <code>Composite</code>,
 * it does not make sense to add children to it, or set a layout on it.


What are you trying to do ?
Comment 2 Elias Volanakis CLA 2010-07-15 13:16:38 EDT
We have styling code iterates over parts of the widget tree (i.e. starting at an element and moving down to all branches and children) and applies certain settings uniformily to all contents. The CCombo looks odd because it hides it's contents. I've added a special case + reflection to work around (brittle but works for us).