Author: bbrodt
Date: 2010-08-09 18:24:56 -0400 (Mon, 09 Aug 2010)
New Revision: 24013
Modified:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/BPELEditor.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/editparts/FlowEditPart.java
Log:
https://jira.jboss.org/browse/JBIDE-6784
Revert fix from JBIDE-6032. The right place to do an initial auto layout if the *.bpelex
model is missing, is in BPELEditor.arrangeEditParts()
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/BPELEditor.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/BPELEditor.java 2010-08-09
22:23:04 UTC (rev 24012)
+++
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/BPELEditor.java 2010-08-09
22:24:56 UTC (rev 24013)
@@ -679,6 +679,7 @@
public void arrangeEditParts(GraphicalViewer graphicalViewer) {
// Make a list of all FlowEditParts whose children all have no positional metadata
List<FlowEditPart> flowsToArrange = new ArrayList<FlowEditPart>();
+ List<Point> flowChildlocations = new ArrayList<Point>();
for (TreeIterator<EObject> it = getProcess().eAllContents(); it.hasNext(); ) {
EObject model = it.next();
@@ -691,7 +692,29 @@
if (child == null) continue;
Point loc = ModelHelper.getLocation(child);
if (loc.x == Integer.MIN_VALUE) missingLoc = true;
+ flowChildlocations.add(new Point(loc));
}
+ //
https://jira.jboss.org/browse/JBIDE-6784
+ // The problem with the above check for a "missing location" of Flow
+ // children is that the default x & y values are zero if the extension
+ // model is missing. This would be the case if the BPEL process was
+ // imported as text from somewhere. In this case, all x/y coordinates
+ // of all Flow children will be 0, so it suffices to check if two children
+ // have the same x & y coordinates.
+ if (flowChildlocations.size()>1)
+ {
+ for ( int i=0; !missingLoc && i<flowChildlocations.size(); ++i )
+ {
+ int x = flowChildlocations.get(i).x;
+ int y = flowChildlocations.get(i).y;
+ for ( int j=i+1; !missingLoc && j<flowChildlocations.size(); ++j )
+ {
+ Point loc = flowChildlocations.get(j);
+ if (loc.x == x && loc.y==y)
+ missingLoc = true;
+ }
+ }
+ }
if (missingLoc) {
EditPart editPart = (EditPart)graphicalViewer.getEditPartRegistry().get(model);
if (editPart instanceof FlowEditPart) flowsToArrange.add((FlowEditPart)
editPart);
Modified:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/editparts/FlowEditPart.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/editparts/FlowEditPart.java 2010-08-09
22:23:04 UTC (rev 24012)
+++
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/editparts/FlowEditPart.java 2010-08-09
22:24:56 UTC (rev 24013)
@@ -235,9 +235,14 @@
IFigure child = ((GraphicalEditPart) childEditPart).getFigure();
getContentPane().add(child,
getFigure().getLayoutManager().getConstraint(child), index);
+ //https://jira.jboss.org/browse/JBIDE-6784
+ // addChildVisual() is also called by reorderChild() to rearrange the order of
children.
+ // This causes auto layout to reference a child object with a model that has no
parent.
+ // The right place to auto arrange Flow children if no *.bpelex exists yet, is in
+ // BPELEditor.arrangeEditParts() after the model is loaded
// JBIDE-6032: force an auto layout at startup
- if (getShowFreeformFlow() && getAutoLayout())
- doAutoLayout(false);
+// if (getShowFreeformFlow() && getAutoLayout())
+// doAutoLayout(false);
}
protected void setFlowEditPolicies() {