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

Bug 229315

Summary: Some GraphNode constructors ignore 'data' parameter
Product: [Tools] GEF Reporter: Stefan Tucker <stefan.tucker>
Component: GEF-Legacy ZestAssignee: Ian Bull <irbull>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: irbull
Version: 3.4   
Target Milestone: ---   
Hardware: PC   
OS: Windows Server 2003   
Whiteboard:
Attachments:
Description Flags
org.eclipse.zest.core
none
mylyn/context/zip none

Description Stefan Tucker CLA 2008-04-29 10:07:12 EDT
The following GraphNode constructors do not pass the 'data' parameter to the super constructor. This prevents the data member from being set.

GraphNode(IContainer graphModel, int style, String text, Object data)
GraphNode(IContainer graphModel, int style, String text, Image image, Object data)

The fix is to modify the following lines:

105#super(graphModel.getGraph(), style);
to
105#super(graphModel.getGraph(), style, data);

and

126#super(graphModel.getGraph(), style);
to
126#super(graphModel.getGraph(), style, data);

The workaround is to call setData(data) after constructing an object.

If the ctors collapsed so that the more general ones call the more specific ones (with " " and null), this can be fixed in one place.

public GraphNode(IContainer graphModel, int style, Object data) {
	this(graphModel, style, " " /*text*/, null /*image*/, data);
}

public GraphNode(IContainer graphModel, int style, String text, Object data) {
	this(graphModel, style, text, null /*image*/, data);
}
Comment 1 Ian Bull CLA 2008-06-17 01:41:26 EDT
Created attachment 105134 [details]
org.eclipse.zest.core

Patch to fix this.
Comment 2 Ian Bull CLA 2008-06-17 01:41:29 EDT
Created attachment 105135 [details]
mylyn/context/zip
Comment 3 Ian Bull CLA 2008-06-17 01:43:06 EDT
Thanks for pointing this out. I have cleaned up the constructors so they are properly chained.