Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 341111 - Different parents for double association when setting Layout (invalid error that stops editing)
Summary: Different parents for double association when setting Layout (invalid error t...
Status: CLOSED WONTFIX
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: WindowBuilder (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P5 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Konstantin Scheglov CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-28 10:21 EDT by Christian Campo CLA
Modified: 2021-06-04 16:45 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Campo CLA 2011-03-28 10:21:59 EDT
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.
Comment 1 Konstantin Scheglov CLA 2011-05-02 14:42:35 EDT
WindowBuilder does not support visiting single AST node several times.
We create JavaInfo model for ASTNode and bind it to this ASTNode.
Comment 2 Eric Clayberg CLA 2011-05-02 16:01:19 EDT
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.