Author: mdryakhlenkov
Date: 2007-07-24 13:33:33 -0400 (Tue, 24 Jul 2007)
New Revision: 2639
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/SpecialOrmShape.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/SpecialRootClass.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ShapeEditPart.java
Log:
EXIN-366: Adding elements on the diagram by double-click on fields of classes which have
additional information in mapping files
Lost inner classes bug fixed (example legacy). Lost key columns bug fixed (example
manytomany)
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-24
17:29:25 UTC (rev 2638)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2007-07-24
17:33:33 UTC (rev 2639)
@@ -443,21 +443,27 @@
} else /* if (collection.isMap() || collection.isSet()) */ {
childShape = getOrCreateDatabaseTable(collection.getCollectionTable());
- Shape keyShape =
childShape.getChild((Column)((DependantValue)((Shape)componentShape.getChildren().get(0)).getOrmElement()).getColumnIterator().next());
- if(!isConnectionExist((Shape)componentShape.getChildren().get(0), keyShape)){
- new Connection((Shape)componentShape.getChildren().get(0), keyShape);
- ((Shape)componentShape.getChildren().get(0)).firePropertyChange(REFRESH, null,
null);
- keyShape.firePropertyChange(REFRESH, null, null);
+ Iterator columnIterator =
((DependantValue)((Shape)componentShape.getChildren().get(0)).getOrmElement()).getColumnIterator();
+ while (columnIterator.hasNext()) {
+ Shape keyShape = childShape.getChild((Column)(columnIterator.next()));
+ if(!isConnectionExist((Shape)componentShape.getChildren().get(0), keyShape)){
+ new Connection((Shape)componentShape.getChildren().get(0), keyShape);
+ ((Shape)componentShape.getChildren().get(0)).firePropertyChange(REFRESH, null,
null);
+ keyShape.firePropertyChange(REFRESH, null, null);
+ }
}
Iterator iter =
((SimpleValue)((Shape)componentShape.getChildren().get(1)).getOrmElement()).getColumnIterator();
while (iter.hasNext()) {
- Column col = (Column)iter.next();
- Shape elementShape = childShape.getChild(col);
- if(!isConnectionExist((Shape)componentShape.getChildren().get(1), elementShape)){
- new Connection((Shape)componentShape.getChildren().get(1), elementShape);
- ((Shape)componentShape.getChildren().get(1)).firePropertyChange(REFRESH, null,
null);
- elementShape.firePropertyChange(REFRESH, null, null);
+ Object element = iter.next();
+ if (element instanceof Column) {
+ Column col = (Column)element;
+ Shape elementShape = childShape.getChild(col);
+ if(!isConnectionExist((Shape)componentShape.getChildren().get(1), elementShape)){
+ new Connection((Shape)componentShape.getChildren().get(1), elementShape);
+ ((Shape)componentShape.getChildren().get(1)).firePropertyChange(REFRESH, null,
null);
+ elementShape.firePropertyChange(REFRESH, null, null);
+ }
}
}
}
@@ -484,11 +490,13 @@
tableShape.firePropertyChange(REFRESH, null, null);
}
Shape parentShape = ((SpecialOrmShape)classShape).getParentShape();
- OrmShape parentClassShape =
(OrmShape)elements.get(((Property)parentShape.getOrmElement()).getPersistentClass().getEntityName());
- if(!isConnectionExist(parentShape, parentClassShape)){
- new Connection(parentShape, parentClassShape);
- parentShape.firePropertyChange(REFRESH, null, null);
- parentClassShape.firePropertyChange(REFRESH, null, null);
+ if (parentShape != null) {
+ OrmShape parentClassShape =
(OrmShape)elements.get(((Property)parentShape.getOrmElement()).getPersistentClass().getEntityName());
+ if(!isConnectionExist(parentShape, parentClassShape)){
+ new Connection(parentShape, parentClassShape);
+ parentShape.firePropertyChange(REFRESH, null, null);
+ parentClassShape.firePropertyChange(REFRESH, null, null);
+ }
}
}
} else if (property.getValue() instanceof Component) {
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/SpecialOrmShape.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/SpecialOrmShape.java 2007-07-24
17:29:25 UTC (rev 2638)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/SpecialOrmShape.java 2007-07-24
17:33:33 UTC (rev 2639)
@@ -20,6 +20,7 @@
public SpecialOrmShape(SpecialRootClass ioe) {
super(ioe);
+// generate();
}
protected void generate() {
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/SpecialRootClass.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/SpecialRootClass.java 2007-07-24
17:29:25 UTC (rev 2638)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/SpecialRootClass.java 2007-07-24
17:33:33 UTC (rev 2639)
@@ -43,14 +43,16 @@
setClassName(component.getComponentClassName());
PersistentClass ownerClass = component.getOwner();
if (component.getParentProperty() != null) {
- Property property = null;
- try {
- property = ownerClass.getProperty(component.getParentProperty());
- } catch (Exception e) {}
- if (property == null &&
ownerClass.getIdentifierProperty().getName().equals(component.getParentProperty())) {
- property = ownerClass.getIdentifierProperty();
- }
- if (property != null) parentProperty = ownerClass.getIdentifierProperty();
+ parentProperty = new Property();
+ parentProperty.setName(component.getParentProperty());
+ parentProperty.setPersistentClass(ownerClass);
+// Property property = null;
+// try {
+// property = ownerClass.getProperty(component.getParentProperty());
+// } catch (Exception e) {
+// property = ownerClass.getIdentifierProperty();
+// }
+// if (property != null) parentProperty = ownerClass.getIdentifierProperty();
}
Iterator iterator = component.getPropertyIterator();
while (iterator.hasNext()) {
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-24
17:29:25 UTC (rev 2638)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ShapeEditPart.java 2007-07-24
17:33:33 UTC (rev 2639)
@@ -220,7 +220,8 @@
Integer.parseInt(Messages.Colors_DatabaseTableG),
Integer.parseInt(Messages.Colors_DatabaseTableB)));
else
- throw new IllegalArgumentException();
+ return ResourceManager.getInstance().getColor(new RGB(255, 0, 0));
+// throw new IllegalArgumentException();
}
protected Color getSelectionColor() {