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

Bug 336455

Summary: Duplicated Nodes due to copy-paste bug in GraphModelFactory and AbstractStylingModelFactory
Product: [Tools] GEF Reporter: alejandrocorbellini
Component: GEF-Legacy ZestAssignee: gef-inbox <gef-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: steeg
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Duplicated Nodes Test steeg: iplog+

Description alejandrocorbellini CLA 2011-02-06 11:27:22 EST
Build Identifier: 20100917-0705

there is a programming error at both GraphModelFactory and AbstractStylingModelFactory that makes graphs that use IFigureProvider for customizing nodes to have duplicated nodes.

in GraphModelFactory:

if (source == null) {
					// just create the node for the destination
					if (dest != null) {
						if (figureProvider != null) {
							createNode(model, dest, figureProvider.getFigure(dest));
						} else {
							createNode(model, dest);
						}
					}
					continue;
				} else if (dest == null) {
					// just create the node for the source
					if (source != null) {
						if (figureProvider != null) {
							createNode(model, source, figureProvider.getFigure(dest));<-- Should be source here.
						} else {
							createNode(model, source);
						}
					}
					continue;
				}

in AbstractStylingModelFactory:

              if (sn == null) {
			IFigure figure = null;
			if (figureProvider != null) {
				figure = figureProvider.getFigure(source);
			}
			if (figure != null) {
				sn = createNode(graph, source, figure);
			} else {
				sn = createNode(graph, source);
			}
		}
		if (dn == null) {
			IFigure figure = null;
			if (figureProvider != null) {
				figure = figureProvider.getFigure(source);<-- should be dest here
			}
			if (figure != null) {
				dn = createNode(graph, dest, figure);
			} else {
				dn = createNode(graph, dest);
			}
		}

Reproducible: Always
Comment 1 Fabian Steeg CLA 2011-02-06 21:12:08 EST
Could you attach a snippet that hits this issue? I tried reproducing it but the sample with IFigureProvider I ran doesn't enter GraphModelFactory#doBuildGraph.
Comment 2 alejandrocorbellini CLA 2011-02-06 22:13:15 EST
Created attachment 188418 [details]
Duplicated Nodes Test

Here it goes. Maybe i'm using graphviewer the wrong way.
Comment 3 Fabian Steeg CLA 2011-02-08 15:46:46 EST
Thanks Alejandro!

Fixed in HEAD and Zest 2.0 master (see IFigureProviderTests).