| Summary: | Different parents for double association when setting Layout (invalid error that stops editing) | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | Christian Campo <christian.campo> |
| Component: | WindowBuilder | Assignee: | Konstantin Scheglov <Konstantin.Scheglov> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P5 | CC: | clayberg |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
WindowBuilder does not support visiting single AST node several times. We create JavaInfo model for ASTNode and bind it to this ASTNode. This is not a bug, but one of the stated limitations of the WB parser. See the FAQ... http://code.google.com/javadevtools/wbpro/faq.html#CantParse This is actually a very complex case with a lot of ramifications and use cases. Enhancing the tool to handle this case (and related cases) will require major mods to the parser and property editors. This would be a good long term project for someone, but it would not be an easy change at all. I'm changing this to an enhancement. |
When setting the layout like this: public void createPartControl(Composite parent) { Composite container = new Composite(parent, SWT.NONE); Group group1 = new Group(container, SWT.NONE); group1.setLayout(createGridLayout(2)); Group group2 = new Group(container, SWT.NONE); group2.setLayout(createGridLayout(4)); } private GridLayout createGridLayout(final int numColumns) { final GridLayout layout = new GridLayout(numColumns, false); layout.marginWidth = 20; layout.marginHeight = 20; return layout; } The Window Builder brings the error "Different parents for double association when setting Layout and refuses to switch into design mode. It probably assumes that the result of createGridLayout returns the same instance in both cases which it doesnt. Replacing one call to setLayout(createGridLayout(4)) with setLayout(new GridLayout(4, false)) solves the problem. I am a new committer and willing to look for myself if somebody can give me a hint on where to start looking. Or if its easy anybody might directly fix the bug.