Author: dazarov
Date: 2007-07-17 11:21:33 -0400 (Tue, 17 Jul 2007)
New Revision: 2472
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ExpandeableShapeEditPart.java
Log:
http://jira.jboss.com/jira/browse/EXIN-365
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ExpandeableShapeEditPart.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ExpandeableShapeEditPart.java 2007-07-17
14:38:55 UTC (rev 2471)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ExpandeableShapeEditPart.java 2007-07-17
15:21:33 UTC (rev 2472)
@@ -11,6 +11,7 @@
package org.jboss.tools.hibernate.ui.veditor.editors.parts;
import java.beans.PropertyChangeEvent;
+import java.util.ArrayList;
import java.util.List;
import org.eclipse.draw2d.IFigure;
@@ -68,6 +69,7 @@
}
}else if (ExpandeableShape.SHOW_REFERENCES.equals(prop)) {
+ referenceList.add(getCastedModel().getParent());
refreshReference((ExpandeableShape)getCastedModel());
// ((IFigure)getFigure().getChildren().get(0)).setBackgroundColor(getSelectionColor());
// ((IFigure)getFigure().getChildren().get(0)).setForegroundColor(ResourceManager.getInstance().getColor(new
RGB(255,255,255)));
@@ -76,9 +78,12 @@
}
}
+ private ArrayList referenceList = new ArrayList();
+
protected void refreshReference(ExpandeableShape shape){
OrmShape refShape = shape.getReference();
if(refShape == null) return;
+
OrmEditPart refPart = (OrmEditPart)getViewer().getEditPartRegistry().get(refShape);
if(refPart != null){
refPart.getFigure().setVisible(shape.isReferenceVisible());
@@ -95,13 +100,25 @@
setLinksVisible(tablePart, shape.isReferenceVisible());
}
}
- for(int i=0;i<refShape.getChildren().size();i++){
- if(refShape.getChildren().get(i) instanceof ExpandeableShape){
- refreshReference((ExpandeableShape)refShape.getChildren().get(i));
+ if(isReferencesCorrect(refShape)){
+ referenceList.add(refShape);
+ for(int i=0;i<refShape.getChildren().size();i++){
+ if(refShape.getChildren().get(i) instanceof ExpandeableShape){
+ refreshReference((ExpandeableShape)refShape.getChildren().get(i));
+ }
}
+ referenceList.remove(refShape);
}
}
+ private boolean isReferencesCorrect(OrmShape shape){
+ if(shape == null) return false;
+ for(int i=0;i < referenceList.size();i++){
+ if(shape.equals(referenceList.get(i))) return false;
+ }
+ return true;
+ }
+
private void setLinksVisible(OrmEditPart editPart, boolean flag){
ConnectionEditPart link;
OrmEditPart child;