Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 319410 - CCombo does not return it's actual children
Summary: CCombo does not return it's actual children
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-09 12:56 EDT by Elias Volanakis CLA
Modified: 2010-07-15 13:16 EDT (History)
2 users (show)

See Also:


Attachments
Patch (751 bytes, application/octet-stream)
2010-07-09 12:56 EDT, Elias Volanakis CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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).