Author: dazarov
Date: 2007-07-05 10:56:04 -0400 (Thu, 05 Jul 2007)
New Revision: 2326
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ShapeEditPart.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/model/OrmDiagram.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2007-07-05
14:00:00 UTC (rev 2325)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2007-07-05
14:56:04 UTC (rev 2326)
@@ -254,7 +254,8 @@
for (int j = 0; j < databaseColumns.size(); j++) {
if
(databaseColumn.getName().equals(((Column)((Shape)databaseColumns.get(j)).getOrmElement()).getName()))
{
Shape databaseShape = (Shape)databaseColumns.remove(j);
- new Connection(shape, databaseShape);
+ if(!isConnectionExist(shape, databaseShape))
+ new Connection(shape, databaseShape);
databaseColumns2.add(i++, databaseShape);
}
}
@@ -264,7 +265,16 @@
}
databaseColumns.addAll(databaseColumns2);
}
-
+
+ private boolean isConnectionExist(Shape source, Shape target){
+ Connection conn;
+ for(int i=0;i<source.getSourceConnections().size();i++){
+ conn = (Connection)source.getSourceConnections().get(i);
+ if(conn.getTarget().equals(target)) return true;
+ }
+ return false;
+ }
+
public String[] getChildrenLocations() {
return childrenLocations;
}
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ShapeEditPart.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ShapeEditPart.java 2007-07-05
14:00:00 UTC (rev 2325)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ShapeEditPart.java 2007-07-05
14:56:04 UTC (rev 2326)
@@ -231,8 +231,9 @@
return ResourceManager.getInstance().getColor(new RGB(112,161,99));
else if (getCastedModel().getOrmElement() instanceof Table ||
getCastedModel().getOrmElement() instanceof Column)
return ResourceManager.getInstance().getColor(new RGB(66,173,247));
- else
- throw new IllegalArgumentException();
+ //else
+ //throw new IllegalArgumentException();
+ return ResourceManager.getInstance().getColor(new RGB(190,190,190));
}
private class ShapesSelectionEditPolicy extends SelectionEditPolicy {