Bug 226150

Summary: Arrange All Command need to check whether the EditPart is active
Product: [Modeling] GMF-Runtime Reporter: Jacques LESCOT <jlescot>
Component: GeneralAssignee: Alex Boyko <aboyko>
Status: RESOLVED FIXED QA Contact:
Severity: critical    
Priority: P3 CC: ahunter.eclipse, github
Version: unspecifiedKeywords: contributed
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 219592    
Attachments:
Description Flags
Provide an additional check on the active state of an EditPart while calculating the Arrange All Command none

Description Jacques LESCOT CLA 2008-04-08 12:28:33 EDT
Created attachment 95230 [details]
Provide an additional check on the active state of an EditPart while calculating the Arrange All Command

While fixing bug 203520, I am encountering a new bug while deleting an element from the diagram because of the synchronisation between the editor and the outline view.

Here is an snippet of the raised exception :
...
Caused by: java.lang.IllegalArgumentException: Argument 'nodes' contains objects which have a different parent containment
at org.eclipse.gmf.runtime.diagram.ui.services.layout.LayoutService.checkValidLayoutNodes(LayoutService.java:120)
at org.eclipse.gmf.runtime.diagram.ui.services.layout.LayoutService.layoutLayoutNodes(LayoutService.java:294)
at org.eclipse.gmf.runtime.diagram.ui.editpolicies.ContainerEditPolicy.layoutNodes(ContainerEditPolicy.java:374)
at org.eclipse.gmf.runtime.diagram.ui.editpolicies.ContainerEditPolicy.getArrangeCommand(ContainerEditPolicy.java:329)
at org.eclipse.gmf.runtime.diagram.ui.editpolicies.ContainerEditPolicy.getCommand(ContainerEditPolicy.java:509)
at org.eclipse.gef.editparts.AbstractEditPart.getCommand(AbstractEditPart.java:473)
at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.access$1(GraphicalEditPart.java:1)
at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart$1.run(GraphicalEditPart.java:463)
at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.runExclusive(TransactionalEditingDomainImpl.java:289)
at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.getCommand(GraphicalEditPart.java:458)
at org.eclipse.gmf.runtime.diagram.ui.actions.internal.ArrangeAction.getCommand(ArrangeAction.java:90)
at org.eclipse.gmf.runtime.diagram.ui.actions.DiagramAction.calculateEnabled(DiagramAction.java:124)
at org.eclipse.gmf.runtime.diagram.ui.actions.DiagramAction.refresh(DiagramAction.java:114)
at org.eclipse.gmf.runtime.common.ui.action.AbstractActionHandler.selectionChanged(AbstractActionHandler.java:387)
at org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditor$4.fireSelectionChanged(EcoreDiagramEditor.java:357)
...

The attached patch provide an additional check on the active state of an EditPart while calculating the Arrange All Command and there is no more Exception.
Comment 1 Anthony Hunter CLA 2008-04-28 17:03:45 EDT
Hi Alex, can you review this patch?
Comment 2 Alex Boyko CLA 2008-04-28 18:55:25 EDT
The patch looks ok and harmless. If an editpart is not active it cannot be moved anywhere anyway, so it shouldn't be supplied to the graph layout algorithm.
Committed the patch to head.
Comment 3 Eclipse Webmaster CLA 2010-07-19 12:30:27 EDT
[GMF Restructure] Bug 319140 : product GMF and component Runtime Diagram was the original product and component for this bug