Bug 130643 - [Cleanup] Duplicate wires in when creating from top of Circuit to bottom
Summary: [Cleanup] Duplicate wires in when creating from top of Circuit to bottom
Status: RESOLVED FIXED
Alias: None
Product: GMF-Runtime
Classification: Modeling
Component: General (show other bugs)
Version: 1.0   Edit
Hardware: PC Windows XP
: P3 normal
Target Milestone: 2.1   Edit
Assignee: Carson Li CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2006-03-06 16:28 EST by Steven R. Shaw CLA
Modified: 2010-07-19 21:57 EDT (History)
2 users (show)

See Also:


Attachments
Proposed Patch (2.43 KB, patch)
2007-09-28 10:39 EDT, Carson Li CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Steven R. Shaw CLA 2006-03-06 16:28:14 EST
- Create a Circuit
- Create a wire from top terminal to bottom terminal

Result:
- Duplicate wires appear.

Note:
- Probably some something to do with the ToggleCanonical
Comment 1 Anthony Hunter CLA 2007-06-19 11:19:45 EDT
Moving to the next release, GMF 2.1.
Comment 2 Alex Boyko CLA 2007-09-25 09:54:35 EDT
This is probably an issue in CircuitCompartmentCanonicalEditPolicy. Connections between pins on different circuits are found as compartment semantic children but not found as notational children. If this is the case then we should either not append such connections to the list of semantic childern or should be able to append such connections' views to the list of notational children.
Comment 3 Carson Li CLA 2007-09-28 10:39:50 EDT
Created attachment 79402 [details]
Proposed Patch

Added a check to determine if wire came and ended to the same source, in the getSemanticCommenctionsList().
if this checked evaluated to true, do not add the wire, since it is not a semantic connection.
Comment 4 Carson Li CLA 2007-09-28 14:46:25 EDT
Comment on attachment 79402 [details]
Proposed Patch

>### Eclipse Workspace Patch 1.0
>#P org.eclipse.gmf.examples.runtime.diagram.logic
>Index: src/org/eclipse/gmf/examples/runtime/diagram/logic/internal/editpolicies/CircuitCompartmentCanonicalEditPolicy.java
>===================================================================
>RCS file: /cvsroot/modeling/org.eclipse.gmf/examples/org.eclipse.gmf.examples.runtime.diagram.logic/src/org/eclipse/gmf/examples/runtime/diagram/logic/internal/editpolicies/CircuitCompartmentCanonicalEditPolicy.java,v
>retrieving revision 1.8
>diff -u -r1.8 CircuitCompartmentCanonicalEditPolicy.java
>--- src/org/eclipse/gmf/examples/runtime/diagram/logic/internal/editpolicies/CircuitCompartmentCanonicalEditPolicy.java	3 Oct 2006 14:40:40 -0000	1.8
>+++ src/org/eclipse/gmf/examples/runtime/diagram/logic/internal/editpolicies/CircuitCompartmentCanonicalEditPolicy.java	27 Sep 2007 20:15:12 -0000
>@@ -70,20 +70,27 @@
> 		ListIterator li = allChildren.listIterator();
> 		UniqueEList wires = new UniqueEList();
> 		while (li.hasNext()) {
>-			Object obj = li.next();
>+			Object obj = li.next();	
> 			if (obj instanceof Wire) {
>-				Wire wire = (Wire)obj;
>+				Wire wire = (Wire)obj;				
>                 if (isWirePartOfContainer(circuitElement, wire))
>-                    wires.add(wire);
>+                	//checks if the wire maps to the same circuit
>+                	if (wire.getSource().eContainer().equals(circuitElement)
>+                		&& (wire.getTarget().eContainer().equals(circuitElement))){               	
>+                     // do nothing
>+                	}
>+                	else{
>+                		wires.add(wire);                		
>+                	}
> 			}
>-		}
>-		
>+		}		
> 		return wires;
> 	}
>     
>     private boolean isWirePartOfContainer(Circuit circuitElement, Wire wire) {
>         if (EcoreUtil.isAncestor(circuitElement, wire.getSource()) &&
>                 EcoreUtil.isAncestor(circuitElement, wire.getTarget())) {>                 
>                 return true;
>             }
>             else {
>@@ -91,6 +98,7 @@
>                     EcoreUtil.isAncestor(circuitElement, wire.getSource().eContainer())) ||
>                     (!wire.getTarget().eContainer().equals(circuitElement) &&
>                     EcoreUtil.isAncestor(circuitElement, wire.getTarget().eContainer()))) {
>+                	System.out.println("the other one");
>                     return true;
>                 }
>             }
Comment 5 Anthony Hunter CLA 2007-11-16 14:49:18 EST
Committed to HEAD (removed the println() :-).
Comment 6 Richard Gronback CLA 2008-08-13 13:08:35 EDT
[target cleanup] 2.1 M4 was the original target milestone for this bug
Comment 7 Eclipse Webmaster CLA 2010-07-19 21:57:27 EDT
[GMF Restructure] Bug 319140 : product GMF and component
Runtime was the original product and component for this bug