Author: vyemialyanchyk
Date: 2009-12-16 08:54:03 -0500 (Wed, 16 Dec 2009)
New Revision: 19300
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/BaseElement.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/Connection.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmShape.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/Shape.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/DiagramEditPart.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5341 - fixed
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/BaseElement.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/BaseElement.java 2009-12-16
12:47:44 UTC (rev 19299)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/BaseElement.java 2009-12-16
13:54:03 UTC (rev 19300)
@@ -388,4 +388,11 @@
it.next().saveInProperties(properties);
}
}
+
+ protected Object toEmptyStr(Object obj) {
+ if (obj == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return obj;
+ }
}
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/Connection.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/Connection.java 2009-12-16
12:47:44 UTC (rev 19299)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/Connection.java 2009-12-16
13:54:03 UTC (rev 19300)
@@ -10,7 +10,12 @@
******************************************************************************/
package org.jboss.tools.hibernate.ui.diagram.editors.model;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.TextPropertyDescriptor;
import org.hibernate.mapping.Column;
+import org.hibernate.mapping.ManyToOne;
+import org.hibernate.mapping.OneToMany;
+import org.hibernate.mapping.OneToOne;
import org.hibernate.mapping.Property;
import org.hibernate.mapping.RootClass;
import org.hibernate.mapping.Table;
@@ -23,6 +28,66 @@
*/
public class Connection extends BaseElement {
+ private static IPropertyDescriptor[] descriptors_connection_class_mapping;
+ private static IPropertyDescriptor[] descriptors_connection_property_mapping;
+ private static IPropertyDescriptor[] descriptors_connection_association;
+ private static IPropertyDescriptor[] descriptors_connection_foreign_key_constraint;
+
+ private static final String PROPERTY_SOURCE = "source"; //$NON-NLS-1$
+ private static final String PROPERTY_TARGET = "targer"; //$NON-NLS-1$
+ private static final String PROPERTY_TYPE = "type"; //$NON-NLS-1$
+ private static final String PROPERTY_CLASS_NAME = "className"; //$NON-NLS-1$
+ private static final String PROPERTY_TABLE_NAME = "tableName"; //$NON-NLS-1$
+ private static final String PROPERTY_CLASS_FIELD = "classField";
//$NON-NLS-1$
+ private static final String PROPERTY_TABLE_FIELD = "tableField";
//$NON-NLS-1$
+ private static final String PROPERTY_CLASS_FIELD_TYPE = "classFieldType";
//$NON-NLS-1$
+ private static final String PROPERTY_TABLE_FIELD_TYPE = "tableFieldType";
//$NON-NLS-1$
+ private static final String PROPERTY_ASSOCIATION_TYPE = "associationType";
//$NON-NLS-1$
+ private static final String PROPERTY_SOURCE_CLASS_FIELD = "sourceClassField";
//$NON-NLS-1$
+ private static final String PROPERTY_SOURCE_CLASS_FIELD_TYPE =
"sourceClassFieldType"; //$NON-NLS-1$
+ private static final String PROPERTY_SOURCE_TABLE_FIELD = "sourceTableField";
//$NON-NLS-1$
+ private static final String PROPERTY_TARGET_TABLE_FIELD = "targetTableField";
//$NON-NLS-1$
+ private static final String PROPERTY_SOURCE_TABLE_FIELD_TYPE =
"sourceTableFieldType"; //$NON-NLS-1$
+ private static final String PROPERTY_TARGET_TABLE_FIELD_TYPE =
"targetTableFieldType"; //$NON-NLS-1$
+
+ static {
+ descriptors_connection_class_mapping = new IPropertyDescriptor[] {
+ new TextPropertyDescriptor(PROPERTY_SOURCE, PROPERTY_SOURCE),
+ new TextPropertyDescriptor(PROPERTY_TARGET, PROPERTY_TARGET),
+ new TextPropertyDescriptor(PROPERTY_TYPE, PROPERTY_TYPE),
+ new TextPropertyDescriptor(PROPERTY_CLASS_NAME, PROPERTY_CLASS_NAME),
+ new TextPropertyDescriptor(PROPERTY_TABLE_NAME, PROPERTY_TABLE_NAME),
+ };
+ descriptors_connection_property_mapping = new IPropertyDescriptor[] {
+ new TextPropertyDescriptor(PROPERTY_SOURCE, PROPERTY_SOURCE),
+ new TextPropertyDescriptor(PROPERTY_TARGET, PROPERTY_TARGET),
+ new TextPropertyDescriptor(PROPERTY_TYPE, PROPERTY_TYPE),
+ new TextPropertyDescriptor(PROPERTY_CLASS_NAME, PROPERTY_CLASS_NAME),
+ new TextPropertyDescriptor(PROPERTY_TABLE_NAME, PROPERTY_TABLE_NAME),
+ new TextPropertyDescriptor(PROPERTY_CLASS_FIELD, PROPERTY_CLASS_FIELD),
+ new TextPropertyDescriptor(PROPERTY_TABLE_FIELD, PROPERTY_TABLE_FIELD),
+ new TextPropertyDescriptor(PROPERTY_CLASS_FIELD_TYPE, PROPERTY_CLASS_FIELD_TYPE),
+ new TextPropertyDescriptor(PROPERTY_TABLE_FIELD_TYPE, PROPERTY_TABLE_FIELD_TYPE),
+ };
+ descriptors_connection_association = new IPropertyDescriptor[] {
+ new TextPropertyDescriptor(PROPERTY_SOURCE, PROPERTY_SOURCE),
+ new TextPropertyDescriptor(PROPERTY_TARGET, PROPERTY_TARGET),
+ new TextPropertyDescriptor(PROPERTY_TYPE, PROPERTY_TYPE),
+ new TextPropertyDescriptor(PROPERTY_ASSOCIATION_TYPE, PROPERTY_ASSOCIATION_TYPE),
+ new TextPropertyDescriptor(PROPERTY_SOURCE_CLASS_FIELD, PROPERTY_SOURCE_CLASS_FIELD),
+ new TextPropertyDescriptor(PROPERTY_SOURCE_CLASS_FIELD_TYPE,
PROPERTY_SOURCE_CLASS_FIELD_TYPE),
+ };
+ descriptors_connection_foreign_key_constraint = new IPropertyDescriptor[] {
+ new TextPropertyDescriptor(PROPERTY_SOURCE, PROPERTY_SOURCE),
+ new TextPropertyDescriptor(PROPERTY_TARGET, PROPERTY_TARGET),
+ new TextPropertyDescriptor(PROPERTY_TYPE, PROPERTY_TYPE),
+ new TextPropertyDescriptor(PROPERTY_SOURCE_TABLE_FIELD, PROPERTY_SOURCE_TABLE_FIELD),
+ new TextPropertyDescriptor(PROPERTY_TARGET_TABLE_FIELD, PROPERTY_TARGET_TABLE_FIELD),
+ new TextPropertyDescriptor(PROPERTY_SOURCE_TABLE_FIELD_TYPE,
PROPERTY_SOURCE_TABLE_FIELD_TYPE),
+ new TextPropertyDescriptor(PROPERTY_TARGET_TABLE_FIELD_TYPE,
PROPERTY_TARGET_TABLE_FIELD_TYPE),
+ };
+ }
+
protected Shape source;
protected Shape target;
@@ -145,4 +210,133 @@
public String getKey() {
return null;
}
+
+ @Override
+ public IPropertyDescriptor[] getPropertyDescriptors() {
+ ConnectionType connectType = getConnectionType();
+ if (connectType == ConnectionType.ClassMapping) {
+ return descriptors_connection_class_mapping;
+ } else if (connectType == ConnectionType.PropertyMapping) {
+ return descriptors_connection_property_mapping;
+ } else if (connectType == ConnectionType.Association) {
+ return descriptors_connection_association;
+ } else if (connectType == ConnectionType.ForeignKeyConstraint) {
+ return descriptors_connection_foreign_key_constraint;
+ }
+ return super.getPropertyDescriptors();
+ }
+
+ @Override
+ public Object getPropertyValue(Object propertyId) {
+ Object res = null;
+ ConnectionType connectType = getConnectionType();
+ if (PROPERTY_SOURCE.equals(propertyId)) {
+ res = source;
+ } else if (PROPERTY_TARGET.equals(propertyId)) {
+ res = target;
+ } else if (PROPERTY_TYPE.equals(propertyId)) {
+ if (connectType == ConnectionType.ClassMapping) {
+ res = "ClassMapping"; //$NON-NLS-1$
+ } else if (connectType == ConnectionType.PropertyMapping) {
+ res = "PropertyMapping"; //$NON-NLS-1$
+ } else if (connectType == ConnectionType.Association) {
+ res = "Association"; //$NON-NLS-1$
+ } else if (connectType == ConnectionType.ForeignKeyConstraint) {
+ res = "ForeignKeyConstraint"; //$NON-NLS-1$
+ }
+ } else if (PROPERTY_CLASS_NAME.equals(propertyId)) {
+ if (connectType == ConnectionType.ClassMapping) {
+ if (source.getOrmElement() instanceof RootClass) {
+ res = ((RootClass)(source.getOrmElement())).getClassName();
+ } else if (target.getOrmElement() instanceof RootClass) {
+ res = ((RootClass)(target.getOrmElement())).getClassName();
+ }
+ } else if (connectType == ConnectionType.PropertyMapping) {
+ if (((Shape)source.getParent()).getOrmElement() instanceof RootClass) {
+ res = ((RootClass)(((Shape)source.getParent()).getOrmElement())).getClassName();
+ } else if (((Shape)target.getParent()).getOrmElement() instanceof RootClass) {
+ res = ((RootClass)(((Shape)target.getParent()).getOrmElement())).getClassName();
+ }
+ }
+ } else if (PROPERTY_TABLE_NAME.equals(propertyId)) {
+ if (connectType == ConnectionType.ClassMapping) {
+ if (source.getOrmElement() instanceof Table) {
+ res = ((Table)(source.getOrmElement())).getName();
+ } else if (target.getOrmElement() instanceof Table) {
+ res = ((Table)(target.getOrmElement())).getName();
+ }
+ } else if (connectType == ConnectionType.PropertyMapping) {
+ if (((Shape)source.getParent()).getOrmElement() instanceof Table) {
+ res = ((Table)(((Shape)source.getParent()).getOrmElement())).getName();
+ } else if (((Shape)target.getParent()).getOrmElement() instanceof Table) {
+ res = ((Table)(((Shape)target.getParent()).getOrmElement())).getName();
+ }
+ }
+ } else if (PROPERTY_CLASS_FIELD.equals(propertyId)) {
+ if (source.getOrmElement() instanceof Property) {
+ res = ((Property)(source.getOrmElement())).getName();
+ } else if (target.getOrmElement() instanceof Property) {
+ res = ((Property)(target.getOrmElement())).getName();
+ }
+ } else if (PROPERTY_TABLE_FIELD.equals(propertyId)) {
+ if (source.getOrmElement() instanceof Column) {
+ res = ((Column)(source.getOrmElement())).getName();
+ } else if (target.getOrmElement() instanceof Column) {
+ res = ((Column)(target.getOrmElement())).getName();
+ }
+ } else if (PROPERTY_CLASS_FIELD_TYPE.equals(propertyId)) {
+ if (source.getOrmElement() instanceof Property) {
+ res = ((Property)(source.getOrmElement())).getType();
+ } else if (target.getOrmElement() instanceof Property) {
+ res = ((Property)(target.getOrmElement())).getType();
+ }
+ } else if (PROPERTY_TABLE_FIELD_TYPE.equals(propertyId)) {
+ if (source.getOrmElement() instanceof Column) {
+ res = ((Column)(source.getOrmElement())).getSqlType();
+ } else if (target.getOrmElement() instanceof Column) {
+ res = ((Column)(target.getOrmElement())).getSqlType();
+ }
+ } else if (PROPERTY_ASSOCIATION_TYPE.equals(propertyId)) {
+ if (source.getOrmElement() instanceof Property) {
+ res = ((Property)(source.getOrmElement())).getValue();
+ } else if (target.getOrmElement() instanceof Property) {
+ res = ((Property)(target.getOrmElement())).getValue();
+ }
+ if (res instanceof OneToOne) {
+ res = "OneToOne"; //$NON-NLS-1$
+ } else if (res instanceof OneToMany) {
+ res = "OneToMany"; //$NON-NLS-1$
+ } else if (res instanceof ManyToOne) {
+ res = "ManyToOne"; //$NON-NLS-1$
+ }
+ } else if (PROPERTY_SOURCE_CLASS_FIELD.equals(propertyId)) {
+ if (source.getOrmElement() instanceof Property) {
+ res = ((Property)(source.getOrmElement())).getName();
+ }
+ } else if (PROPERTY_SOURCE_CLASS_FIELD_TYPE.equals(propertyId)) {
+ if (source.getOrmElement() instanceof Property) {
+ res = ((Property)(source.getOrmElement())).getType();
+ }
+ } else if (PROPERTY_SOURCE_TABLE_FIELD.equals(propertyId)) {
+ if (source.getOrmElement() instanceof Column) {
+ res = ((Column)(source.getOrmElement())).getName();
+ }
+ } else if (PROPERTY_TARGET_TABLE_FIELD.equals(propertyId)) {
+ if (target.getOrmElement() instanceof Column) {
+ res = ((Column)(target.getOrmElement())).getName();
+ }
+ } else if (PROPERTY_SOURCE_TABLE_FIELD_TYPE.equals(propertyId)) {
+ if (source.getOrmElement() instanceof Column) {
+ res = ((Column)(source.getOrmElement())).getSqlType();
+ }
+ } else if (PROPERTY_TARGET_TABLE_FIELD_TYPE.equals(propertyId)) {
+ if (target.getOrmElement() instanceof Column) {
+ res = ((Column)(target.getOrmElement())).getSqlType();
+ }
+ }
+ if (res == null) {
+ res = super.getPropertyValue(propertyId);
+ }
+ return toEmptyStr(res);
+ }
}
\ No newline at end of file
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java 2009-12-16
12:47:44 UTC (rev 19299)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java 2009-12-16
13:54:03 UTC (rev 19300)
@@ -44,6 +44,8 @@
import org.eclipse.ui.IMemento;
import org.eclipse.ui.WorkbenchException;
import org.eclipse.ui.XMLMemento;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.TextPropertyDescriptor;
import org.hibernate.HibernateException;
import org.hibernate.cfg.Configuration;
import org.hibernate.console.ConsoleConfiguration;
@@ -52,6 +54,7 @@
import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.eclipse.console.utils.ProjectUtils;
import org.hibernate.mapping.RootClass;
+import org.hibernate.mapping.Table;
import org.jboss.tools.hibernate.ui.diagram.DiagramViewerMessages;
import org.jboss.tools.hibernate.ui.diagram.UiPlugin;
import org.jboss.tools.hibernate.ui.diagram.editors.model.Connection.ConnectionType;
@@ -94,6 +97,8 @@
protected boolean snapToGeometry = false;
protected boolean gridEnabled = false;
protected double zoom = 1.0;
+ protected int width = 0;
+ protected int height = 0;
protected float fontHeight = 8.5f;
protected boolean deepIntoSort = false;
protected boolean flagManhattanConnectionRouter = true;
@@ -102,7 +107,31 @@
// this is workaround to load diagram state in the case if Console Config loaded later
// so we can correctly refresh diagram state
private IMemento memento = null;
+
+ private static final String PROPERTY_NAME = "name"; //$NON-NLS-1$
+ private static final String PROPERTY_WIDTH = "width"; //$NON-NLS-1$
+ private static final String PROPERTY_HEIGHT = "height"; //$NON-NLS-1$
+ private static final String PROPERTY_ZOOM = "zoom"; //$NON-NLS-1$
+ private static final String PROPERTY_ITEMS = "items"; //$NON-NLS-1$
+ private static final String PROPERTY_ENTITIES = "entities"; //$NON-NLS-1$
+ private static final String PROPERTY_TABLES = "tables"; //$NON-NLS-1$
+ private static final String PROPERTY_INVISIBLE = "invisible"; //$NON-NLS-1$
+
+ private static IPropertyDescriptor[] descriptors_diagram;
+ static {
+ descriptors_diagram = new IPropertyDescriptor[] {
+ new TextPropertyDescriptor(PROPERTY_NAME, PROPERTY_NAME),
+ new TextPropertyDescriptor(PROPERTY_WIDTH, PROPERTY_WIDTH),
+ new TextPropertyDescriptor(PROPERTY_HEIGHT, PROPERTY_HEIGHT),
+ new TextPropertyDescriptor(PROPERTY_ZOOM, PROPERTY_ZOOM),
+ new TextPropertyDescriptor(PROPERTY_ITEMS, PROPERTY_ITEMS),
+ new TextPropertyDescriptor(PROPERTY_ENTITIES, PROPERTY_ENTITIES),
+ new TextPropertyDescriptor(PROPERTY_TABLES, PROPERTY_TABLES),
+ new TextPropertyDescriptor(PROPERTY_INVISIBLE, PROPERTY_INVISIBLE),
+ };
+ }
+
public class RootClassComparator implements Comparator<RootClass> {
public int compare(RootClass o1, RootClass o2) {
return getItemName(o1).compareTo(getItemName(o2));
@@ -976,4 +1005,66 @@
public void setupFanConnectionRouter() {
flagManhattanConnectionRouter = false;
}
+
+ public void updateWidthAndHeight(int width, int height) {
+ this.width = width;
+ this.height = height;
+ }
+
+ @Override
+ public IPropertyDescriptor[] getPropertyDescriptors() {
+ return descriptors_diagram;
+ }
+
+ @Override
+ public Object getPropertyValue(Object propertyId) {
+ Object res = null;
+ if (PROPERTY_NAME.equals(propertyId)) {
+ res = getDiagramName();
+ } else if (PROPERTY_WIDTH.equals(propertyId)) {
+ res = width;
+ } else if (PROPERTY_HEIGHT.equals(propertyId)) {
+ res = height;
+ } else if (PROPERTY_ZOOM.equals(propertyId)) {
+ res = zoom;
+ } else if (PROPERTY_ITEMS.equals(propertyId)) {
+ res = elements.size();
+ } else if (PROPERTY_ENTITIES.equals(propertyId)) {
+ int nEntities = 0;
+ Iterator<OrmShape> it = elements.values().iterator();
+ while (it.hasNext()) {
+ final OrmShape shape = it.next();
+ Object ormElement = shape.getOrmElement();
+ if (ormElement instanceof RootClass) {
+ nEntities++;
+ }
+ }
+ res = nEntities;
+ } else if (PROPERTY_TABLES.equals(propertyId)) {
+ int nTables = 0;
+ Iterator<OrmShape> it = elements.values().iterator();
+ while (it.hasNext()) {
+ final OrmShape shape = it.next();
+ Object ormElement = shape.getOrmElement();
+ if (ormElement instanceof Table) {
+ nTables++;
+ }
+ }
+ res = nTables;
+ } else if (PROPERTY_INVISIBLE.equals(propertyId)) {
+ int nInvisible = 0;
+ Iterator<OrmShape> it = elements.values().iterator();
+ while (it.hasNext()) {
+ final OrmShape shape = it.next();
+ if (!shape.isVisible()) {
+ nInvisible++;
+ }
+ }
+ res = nInvisible;
+ }
+ if (res == null) {
+ res = super.getPropertyValue(propertyId);
+ }
+ return toEmptyStr(res);
+ }
}
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmShape.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmShape.java 2009-12-16
12:47:44 UTC (rev 19299)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmShape.java 2009-12-16
13:54:03 UTC (rev 19300)
@@ -15,6 +15,8 @@
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.ui.IMemento;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.TextPropertyDescriptor;
import org.hibernate.mapping.Collection;
import org.hibernate.mapping.Column;
import org.hibernate.mapping.Component;
@@ -32,7 +34,7 @@
* @author some modifications from Vitali
*/
public class OrmShape extends ExpandableShape {
-
+
public static final String LOCATION_PROP = "location"; //$NON-NLS-1$
/**
* up-left point element location on diagram
@@ -43,7 +45,108 @@
* additional way to change shape location on diagram
*/
private DiagramGuide verticalGuide, horizontalGuide;
+
+ private static IPropertyDescriptor[] descriptors_entity;
+ private static IPropertyDescriptor[] descriptors_table;
+
+ private static final String ENTITY_isAbstract = "isAbstract"; //$NON-NLS-1$
+ private static final String ENTITY_isCustomDeleteCallable =
"isCustomDeleteCallable"; //$NON-NLS-1$
+ private static final String ENTITY_isCustomInsertCallable =
"isCustomInsertCallable"; //$NON-NLS-1$
+ private static final String ENTITY_isCustomUpdateCallable =
"isCustomUpdateCallable"; //$NON-NLS-1$
+ private static final String ENTITY_isDiscriminatorInsertable =
"isDiscriminatorInsertable"; //$NON-NLS-1$
+ private static final String ENTITY_isDiscriminatorValueNotNull =
"isDiscriminatorValueNotNull"; //$NON-NLS-1$
+ private static final String ENTITY_isDiscriminatorValueNull =
"isDiscriminatorValueNull"; //$NON-NLS-1$
+ private static final String ENTITY_isExplicitPolymorphism =
"isExplicitPolymorphism"; //$NON-NLS-1$
+ private static final String ENTITY_isForceDiscriminator =
"isForceDiscriminator"; //$NON-NLS-1$
+ private static final String ENTITY_isInherited = "isInherited"; //$NON-NLS-1$
+ private static final String ENTITY_isJoinedSubclass = "isJoinedSubclass";
//$NON-NLS-1$
+ private static final String ENTITY_isLazy = "isLazy"; //$NON-NLS-1$
+ private static final String ENTITY_isLazyPropertiesCacheable =
"isLazyPropertiesCacheable"; //$NON-NLS-1$
+ private static final String ENTITY_isMutable = "isMutable"; //$NON-NLS-1$
+ private static final String ENTITY_isPolymorphic = "isPolymorphic";
//$NON-NLS-1$
+ private static final String ENTITY_isVersioned = "isVersioned"; //$NON-NLS-1$
+ private static final String ENTITY_batchSize = "batchSize"; //$NON-NLS-1$
+ private static final String ENTITY_cacheConcurrencyStrategy =
"cacheConcurrencyStrategy"; //$NON-NLS-1$
+ private static final String ENTITY_className = "className"; //$NON-NLS-1$
+ private static final String ENTITY_customSQLDelete = "customSQLDelete";
//$NON-NLS-1$
+ private static final String ENTITY_customSQLInsert = "customSQLInsert";
//$NON-NLS-1$
+ private static final String ENTITY_customSQLUpdate = "customSQLUpdate";
//$NON-NLS-1$
+ private static final String ENTITY_discriminatorValue = "discriminatorValue";
//$NON-NLS-1$
+ private static final String ENTITY_entityName = "entityName"; //$NON-NLS-1$
+ private static final String ENTITY_loaderName = "loaderName"; //$NON-NLS-1$
+ private static final String ENTITY_nodeName = "nodeName"; //$NON-NLS-1$
+ private static final String ENTITY_optimisticLockMode = "optimisticLockMode";
//$NON-NLS-1$
+ private static final String ENTITY_table = "table"; //$NON-NLS-1$
+ private static final String ENTITY_temporaryIdTableDDL =
"temporaryIdTableDDL"; //$NON-NLS-1$
+ private static final String ENTITY_temporaryIdTableName =
"temporaryIdTableName"; //$NON-NLS-1$
+ private static final String ENTITY_where = "where"; //$NON-NLS-1$
+ private static final String ENTITY_cacheRegionName = "cacheRegionName";
//$NON-NLS-1$
+
+ private static final String TABLE_catalog = "catalog"; //$NON-NLS-1$
+ private static final String TABLE_comment = "comment"; //$NON-NLS-1$
+ private static final String TABLE_name = "name"; //$NON-NLS-1$
+ private static final String TABLE_primaryKey = "primaryKey"; //$NON-NLS-1$
+ private static final String TABLE_rowId = "rowId"; //$NON-NLS-1$
+ private static final String TABLE_schema = "schema"; //$NON-NLS-1$
+ private static final String TABLE_subselect = "subselect"; //$NON-NLS-1$
+ private static final String TABLE_hasDenormalizedTables =
"hasDenormalizedTables"; //$NON-NLS-1$
+ private static final String TABLE_isAbstract = "isAbstract"; //$NON-NLS-1$
+ private static final String TABLE_isAbstractUnionTable =
"isAbstractUnionTable"; //$NON-NLS-1$
+ private static final String TABLE_isPhysicalTable = "isPhysicalTable";
//$NON-NLS-1$
+ static {
+
+ descriptors_entity = new IPropertyDescriptor[] {
+ new TextPropertyDescriptor(ENTITY_isAbstract, ENTITY_isAbstract),
+ new TextPropertyDescriptor(ENTITY_isCustomDeleteCallable,
ENTITY_isCustomDeleteCallable),
+ new TextPropertyDescriptor(ENTITY_isCustomInsertCallable,
ENTITY_isCustomInsertCallable),
+ new TextPropertyDescriptor(ENTITY_isCustomUpdateCallable,
ENTITY_isCustomUpdateCallable),
+ new TextPropertyDescriptor(ENTITY_isDiscriminatorInsertable,
ENTITY_isDiscriminatorInsertable),
+ new TextPropertyDescriptor(ENTITY_isDiscriminatorValueNotNull,
ENTITY_isDiscriminatorValueNotNull),
+ new TextPropertyDescriptor(ENTITY_isDiscriminatorValueNull,
ENTITY_isDiscriminatorValueNull),
+ new TextPropertyDescriptor(ENTITY_isExplicitPolymorphism,
ENTITY_isExplicitPolymorphism),
+ new TextPropertyDescriptor(ENTITY_isForceDiscriminator, ENTITY_isForceDiscriminator),
+ new TextPropertyDescriptor(ENTITY_isInherited, ENTITY_isInherited),
+ new TextPropertyDescriptor(ENTITY_isJoinedSubclass, ENTITY_isJoinedSubclass),
+ new TextPropertyDescriptor(ENTITY_isLazy, ENTITY_isLazy),
+ new TextPropertyDescriptor(ENTITY_isLazyPropertiesCacheable,
ENTITY_isLazyPropertiesCacheable),
+ new TextPropertyDescriptor(ENTITY_isMutable, ENTITY_isMutable),
+ new TextPropertyDescriptor(ENTITY_isPolymorphic, ENTITY_isPolymorphic),
+ new TextPropertyDescriptor(ENTITY_isVersioned, ENTITY_isVersioned),
+ new TextPropertyDescriptor(ENTITY_batchSize, ENTITY_batchSize),
+ new TextPropertyDescriptor(ENTITY_cacheConcurrencyStrategy,
ENTITY_cacheConcurrencyStrategy),
+ new TextPropertyDescriptor(ENTITY_className, ENTITY_className),
+ new TextPropertyDescriptor(ENTITY_customSQLDelete, ENTITY_customSQLDelete),
+ new TextPropertyDescriptor(ENTITY_customSQLInsert, ENTITY_customSQLInsert),
+ new TextPropertyDescriptor(ENTITY_customSQLUpdate, ENTITY_customSQLUpdate),
+ new TextPropertyDescriptor(ENTITY_discriminatorValue, ENTITY_discriminatorValue),
+ new TextPropertyDescriptor(ENTITY_entityName, ENTITY_entityName),
+ new TextPropertyDescriptor(ENTITY_loaderName, ENTITY_loaderName),
+ new TextPropertyDescriptor(ENTITY_nodeName, ENTITY_nodeName),
+ new TextPropertyDescriptor(ENTITY_optimisticLockMode, ENTITY_optimisticLockMode),
+ new TextPropertyDescriptor(ENTITY_table, ENTITY_table),
+ new TextPropertyDescriptor(ENTITY_temporaryIdTableDDL, ENTITY_temporaryIdTableDDL),
+ new TextPropertyDescriptor(ENTITY_temporaryIdTableName, ENTITY_temporaryIdTableName),
+ new TextPropertyDescriptor(ENTITY_where, ENTITY_where),
+ new TextPropertyDescriptor(ENTITY_cacheRegionName, ENTITY_cacheRegionName),
+ };
+
+ descriptors_table = new IPropertyDescriptor[] {
+ new TextPropertyDescriptor(TABLE_catalog, TABLE_catalog),
+ new TextPropertyDescriptor(TABLE_comment, TABLE_comment),
+ new TextPropertyDescriptor(TABLE_name, TABLE_name),
+ new TextPropertyDescriptor(TABLE_primaryKey, TABLE_primaryKey),
+ new TextPropertyDescriptor(TABLE_rowId, TABLE_rowId),
+ new TextPropertyDescriptor(TABLE_schema, TABLE_schema),
+ new TextPropertyDescriptor(TABLE_subselect, TABLE_subselect),
+ new TextPropertyDescriptor(TABLE_hasDenormalizedTables, TABLE_hasDenormalizedTables),
+ new TextPropertyDescriptor(TABLE_isAbstract, TABLE_isAbstract),
+ new TextPropertyDescriptor(TABLE_isAbstractUnionTable, TABLE_isAbstractUnionTable),
+ new TextPropertyDescriptor(TABLE_isPhysicalTable, TABLE_isPhysicalTable),
+ };
+
+ } // static
+
public OrmShape(Object ioe) {
super(ioe);
initModel();
@@ -330,4 +433,137 @@
setPosition(properties);
super.saveInProperties(properties);
}
+
+ @Override
+ public IPropertyDescriptor[] getPropertyDescriptors() {
+ IPropertyDescriptor[] res = super.getPropertyDescriptors();
+ if (res.length > 0) {
+ return res;
+ }
+ Object ormElement = getOrmElement();
+ if (ormElement instanceof RootClass) {
+ //RootClass rootClass = (RootClass)ormElement;
+ res = descriptors_entity;
+ } else if (ormElement instanceof Subclass) {
+ //RootClass rootClass = ((Subclass)ormElement).getRootClass();
+ } else if (ormElement instanceof Table) {
+ //Iterator iterator = ((Table)getOrmElement()).getColumnIterator();
+ //while (iterator.hasNext()) {
+ // Column column = (Column)iterator.next();
+ // Shape bodyOrmShape = new Shape(column);
+ // addChild(bodyOrmShape);
+ //}
+ res = descriptors_table;
+ }
+ return res;
+ }
+
+ @Override
+ public Object getPropertyValue(Object propertyId) {
+ Object res = null;
+ RootClass rootClass = null;
+ Table table = null;
+ Object ormElement = getOrmElement();
+ if (ormElement instanceof RootClass) {
+ rootClass = (RootClass)ormElement;
+ } else if (ormElement instanceof Subclass) {
+ //rootClass = ((Subclass)ormElement).getRootClass();
+ } else if (ormElement instanceof Table) {
+ table = (Table)getOrmElement();
+ }
+ if (rootClass != null) {
+ if (ENTITY_isAbstract.equals(propertyId)) {
+ res = rootClass.isAbstract();
+ } else if (ENTITY_isCustomDeleteCallable.equals(propertyId)) {
+ res = rootClass.isCustomDeleteCallable();
+ } else if (ENTITY_isCustomInsertCallable.equals(propertyId)) {
+ res = rootClass.isCustomInsertCallable();
+ } else if (ENTITY_isCustomUpdateCallable.equals(propertyId)) {
+ res = rootClass.isCustomUpdateCallable();
+ } else if (ENTITY_isDiscriminatorInsertable.equals(propertyId)) {
+ res = rootClass.isDiscriminatorInsertable();
+ } else if (ENTITY_isDiscriminatorValueNotNull.equals(propertyId)) {
+ res = rootClass.isDiscriminatorValueNotNull();
+ } else if (ENTITY_isDiscriminatorValueNull.equals(propertyId)) {
+ res = rootClass.isDiscriminatorValueNull();
+ } else if (ENTITY_isExplicitPolymorphism.equals(propertyId)) {
+ res = rootClass.isExplicitPolymorphism();
+ } else if (ENTITY_isForceDiscriminator.equals(propertyId)) {
+ res = rootClass.isForceDiscriminator();
+ } else if (ENTITY_isInherited.equals(propertyId)) {
+ res = rootClass.isInherited();
+ } else if (ENTITY_isJoinedSubclass.equals(propertyId)) {
+ res = rootClass.isJoinedSubclass();
+ } else if (ENTITY_isLazy.equals(propertyId)) {
+ res = rootClass.isLazy();
+ } else if (ENTITY_isLazyPropertiesCacheable.equals(propertyId)) {
+ res = rootClass.isLazyPropertiesCacheable();
+ } else if (ENTITY_isMutable.equals(propertyId)) {
+ res = rootClass.isMutable();
+ } else if (ENTITY_isPolymorphic.equals(propertyId)) {
+ res = rootClass.isPolymorphic();
+ } else if (ENTITY_isVersioned.equals(propertyId)) {
+ res = rootClass.isVersioned();
+ } else if (ENTITY_batchSize.equals(propertyId)) {
+ res = rootClass.getBatchSize();
+ } else if (ENTITY_cacheConcurrencyStrategy.equals(propertyId)) {
+ res = rootClass.getCacheConcurrencyStrategy();
+ } else if (ENTITY_className.equals(propertyId)) {
+ res = rootClass.getClassName();
+ } else if (ENTITY_customSQLDelete.equals(propertyId)) {
+ res = rootClass.getCustomSQLDelete();
+ } else if (ENTITY_customSQLInsert.equals(propertyId)) {
+ res = rootClass.getCustomSQLInsert();
+ } else if (ENTITY_customSQLUpdate.equals(propertyId)) {
+ res = rootClass.getCustomSQLUpdate();
+ } else if (ENTITY_discriminatorValue.equals(propertyId)) {
+ res = rootClass.getDiscriminatorValue();
+ } else if (ENTITY_entityName.equals(propertyId)) {
+ res = rootClass.getEntityName();
+ } else if (ENTITY_loaderName.equals(propertyId)) {
+ res = rootClass.getLoaderName();
+ } else if (ENTITY_nodeName.equals(propertyId)) {
+ res = rootClass.getNodeName();
+ } else if (ENTITY_optimisticLockMode.equals(propertyId)) {
+ res = rootClass.getOptimisticLockMode();
+ } else if (ENTITY_table.equals(propertyId)) {
+ res = rootClass.getTable();
+ } else if (ENTITY_temporaryIdTableDDL.equals(propertyId)) {
+ res = rootClass.getTemporaryIdTableDDL();
+ } else if (ENTITY_temporaryIdTableName.equals(propertyId)) {
+ res = rootClass.getTemporaryIdTableName();
+ } else if (ENTITY_where.equals(propertyId)) {
+ res = rootClass.getWhere();
+ }
+ }
+ if (table != null) {
+ if (TABLE_catalog.equals(propertyId)) {
+ res = table.getCatalog();
+ } else if (TABLE_comment.equals(propertyId)) {
+ res = table.getComment();
+ } else if (TABLE_name.equals(propertyId)) {
+ res = table.getName();
+ } else if (TABLE_primaryKey.equals(propertyId)) {
+ res = table.getPrimaryKey();
+ } else if (TABLE_rowId.equals(propertyId)) {
+ res = table.getRowId();
+ } else if (TABLE_schema.equals(propertyId)) {
+ res = table.getSchema();
+ } else if (TABLE_subselect.equals(propertyId)) {
+ res = table.getSubselect();
+ } else if (TABLE_hasDenormalizedTables.equals(propertyId)) {
+ res = table.hasDenormalizedTables();
+ } else if (TABLE_isAbstract.equals(propertyId)) {
+ res = table.isAbstract();
+ } else if (TABLE_isAbstractUnionTable.equals(propertyId)) {
+ res = table.isAbstractUnionTable();
+ } else if (TABLE_isPhysicalTable.equals(propertyId)) {
+ res = table.isPhysicalTable();
+ }
+ }
+ if (res == null) {
+ res = super.getPropertyValue(propertyId);
+ }
+ return toEmptyStr(res);
+ }
}
\ No newline at end of file
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/Shape.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/Shape.java 2009-12-16
12:47:44 UTC (rev 19299)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/Shape.java 2009-12-16
13:54:03 UTC (rev 19300)
@@ -77,28 +77,27 @@
static {
descriptors_property = new IPropertyDescriptor[] {
- new TextPropertyDescriptor(PROPERTY_NAME, PROPERTY_NAME),
- new TextPropertyDescriptor(PROPERTY_TYPE, PROPERTY_TYPE),
- new TextPropertyDescriptor(PROPERTY_VALUE, PROPERTY_VALUE),
- new TextPropertyDescriptor(PROPERTY_CLASS, PROPERTY_CLASS),
- new TextPropertyDescriptor(PROPERTY_SELECT, PROPERTY_SELECT),
- new TextPropertyDescriptor(PROPERTY_INSERT, PROPERTY_INSERT),
- new TextPropertyDescriptor(PROPERTY_UPDATE, PROPERTY_UPDATE),
- new TextPropertyDescriptor(PROPERTY_CASCADE, PROPERTY_CASCADE),
- new TextPropertyDescriptor(PROPERTY_LAZY, PROPERTY_LAZY),
- new TextPropertyDescriptor(PROPERTY_OPTIONAL, PROPERTY_OPTIONAL),
- new TextPropertyDescriptor(PROPERTY_NATURAL_IDENTIFIER,
PROPERTY_NATURAL_IDENTIFIER),
- new TextPropertyDescriptor(PROPERTY_NODE_NAME, PROPERTY_NODE_NAME),
- new TextPropertyDescriptor(PROPERTY_OPTIMISTIC_LOCKED, PROPERTY_OPTIMISTIC_LOCKED),
+ new TextPropertyDescriptor(PROPERTY_NAME, PROPERTY_NAME),
+ new TextPropertyDescriptor(PROPERTY_TYPE, PROPERTY_TYPE),
+ new TextPropertyDescriptor(PROPERTY_VALUE, PROPERTY_VALUE),
+ new TextPropertyDescriptor(PROPERTY_CLASS, PROPERTY_CLASS),
+ new TextPropertyDescriptor(PROPERTY_SELECT, PROPERTY_SELECT),
+ new TextPropertyDescriptor(PROPERTY_INSERT, PROPERTY_INSERT),
+ new TextPropertyDescriptor(PROPERTY_UPDATE, PROPERTY_UPDATE),
+ new TextPropertyDescriptor(PROPERTY_CASCADE, PROPERTY_CASCADE),
+ new TextPropertyDescriptor(PROPERTY_LAZY, PROPERTY_LAZY),
+ new TextPropertyDescriptor(PROPERTY_OPTIONAL, PROPERTY_OPTIONAL),
+ new TextPropertyDescriptor(PROPERTY_NATURAL_IDENTIFIER, PROPERTY_NATURAL_IDENTIFIER),
+ new TextPropertyDescriptor(PROPERTY_NODE_NAME, PROPERTY_NODE_NAME),
+ new TextPropertyDescriptor(PROPERTY_OPTIMISTIC_LOCKED, PROPERTY_OPTIMISTIC_LOCKED),
};
-
descriptors_column = new IPropertyDescriptor[] {
- new TextPropertyDescriptor(PROPERTY_NAME, PROPERTY_NAME),
- new TextPropertyDescriptor(PROPERTY_TYPE, PROPERTY_TYPE),
- new TextPropertyDescriptor(PROPERTY_VALUE, PROPERTY_VALUE),
- new TextPropertyDescriptor(PROPERTY_NULLABLE, PROPERTY_NULLABLE),
- new TextPropertyDescriptor(PROPERTY_UNIQUE, PROPERTY_UNIQUE),
+ new TextPropertyDescriptor(PROPERTY_NAME, PROPERTY_NAME),
+ new TextPropertyDescriptor(PROPERTY_TYPE, PROPERTY_TYPE),
+ new TextPropertyDescriptor(PROPERTY_VALUE, PROPERTY_VALUE),
+ new TextPropertyDescriptor(PROPERTY_NULLABLE, PROPERTY_NULLABLE),
+ new TextPropertyDescriptor(PROPERTY_UNIQUE, PROPERTY_UNIQUE),
};
} // static
@@ -254,11 +253,11 @@
* @see #getPropertyValue(Object)
* @see #setPropertyValue(Object, Object)
*/
+ @Override
public IPropertyDescriptor[] getPropertyDescriptors() {
if (getOrmElement() instanceof Property) {
return descriptors_property;
- }
- else if (getOrmElement() instanceof Column) {
+ } else if (getOrmElement() instanceof Column) {
return descriptors_column;
}
return super.getPropertyDescriptors();
@@ -271,6 +270,7 @@
* @see #descriptors
* @see #getPropertyDescriptors()
*/
+ @Override
public Object getPropertyValue(Object propertyId) {
Object res = null;
Column col = null;
@@ -281,21 +281,45 @@
if (getOrmElement() instanceof Property) {
prop = (Property)getOrmElement();
}
- if (PROPERTY_NAME.equals(propertyId)) {
- if (prop != null) {
+ if (prop != null) {
+ if (PROPERTY_NAME.equals(propertyId)) {
res = prop.getName();
- } else if (col != null) {
- res = col.getName();
- }
- } else if (PROPERTY_TYPE.equals(propertyId)) {
- if (prop != null) {
+ } else if (PROPERTY_TYPE.equals(propertyId)) {
Value value = prop.getValue();
if (value instanceof Component) {
res = prop.getValue().toString();
} else {
res = prop.getType().getReturnedClass().getName();
}
- } else if (col != null) {
+ } else if (PROPERTY_VALUE.equals(propertyId)) {
+ res = prop.getValue().toString();
+ } else if (PROPERTY_CLASS.equals(propertyId)) {
+ if (prop.getPersistentClass() != null) {
+ res = prop.getPersistentClass().getClassName();
+ }
+ } else if (PROPERTY_SELECT.equals(propertyId)) {
+ res = Boolean.valueOf(prop.isSelectable()).toString();
+ } else if (PROPERTY_INSERT.equals(propertyId)) {
+ res = Boolean.valueOf(prop.isInsertable()).toString();
+ } else if (PROPERTY_UPDATE.equals(propertyId)) {
+ res = Boolean.valueOf(prop.isUpdateable()).toString();
+ } else if (PROPERTY_CASCADE.equals(propertyId)) {
+ res = prop.getCascade();
+ } else if (PROPERTY_LAZY.equals(propertyId)) {
+ res = Boolean.valueOf(prop.isLazy()).toString();
+ } else if (PROPERTY_OPTIONAL.equals(propertyId)) {
+ res = Boolean.valueOf(prop.isOptional()).toString();
+ } else if (PROPERTY_NATURAL_IDENTIFIER.equals(propertyId)) {
+ res = Boolean.valueOf(prop.isNaturalIdentifier()).toString();
+ } else if (PROPERTY_NODE_NAME.equals(propertyId)) {
+ res = prop.getNodeName();
+ } else if (PROPERTY_OPTIMISTIC_LOCKED.equals(propertyId)) {
+ res = Boolean.valueOf(prop.isOptimisticLocked()).toString();
+ }
+ } else if (col != null) {
+ if (PROPERTY_NAME.equals(propertyId)) {
+ res = col.getName();
+ } else if (PROPERTY_TYPE.equals(propertyId)) {
String sqlType = col.getSqlType();
if (sqlType == null) {
getOrmDiagram().getLabelProvider().updateColumnSqlType(col);
@@ -310,61 +334,11 @@
&& HibernateUtils.isForeignKey(col) ? " FK" : "");
//$NON-NLS-1$ //$NON-NLS-2$
}
res = name.toString();
- }
- } else if (PROPERTY_VALUE.equals(propertyId)) {
- if (prop != null) {
- res = prop.getValue().toString();
- } else if (getOrmElement() instanceof Column) {
+ } else if (PROPERTY_VALUE.equals(propertyId)) {
res = col.getValue().toString();
- }
- } else if (PROPERTY_CLASS.equals(propertyId)) {
- if (prop != null) {
- if (prop.getPersistentClass() != null) {
- res = prop.getPersistentClass().getClassName();
- }
- }
- } else if (PROPERTY_SELECT.equals(propertyId)) {
- if (prop != null) {
- res = Boolean.valueOf(prop.isSelectable()).toString();
- }
- } else if (PROPERTY_INSERT.equals(propertyId)) {
- if (prop != null) {
- res = Boolean.valueOf(prop.isInsertable()).toString();
- }
- } else if (PROPERTY_UPDATE.equals(propertyId)) {
- if (prop != null) {
- res = Boolean.valueOf(prop.isUpdateable()).toString();
- }
- } else if (PROPERTY_CASCADE.equals(propertyId)) {
- if (prop != null) {
- res = prop.getCascade();
- }
- } else if (PROPERTY_LAZY.equals(propertyId)) {
- if (prop != null) {
- res = Boolean.valueOf(prop.isLazy()).toString();
- }
- } else if (PROPERTY_OPTIONAL.equals(propertyId)) {
- if (prop != null) {
- res = Boolean.valueOf(prop.isOptional()).toString();
- }
- } else if (PROPERTY_NATURAL_IDENTIFIER.equals(propertyId)) {
- if (prop != null) {
- res = Boolean.valueOf(prop.isNaturalIdentifier()).toString();
- }
- } else if (PROPERTY_NODE_NAME.equals(propertyId)) {
- if (prop != null) {
- res = prop.getNodeName();
- }
- } else if (PROPERTY_OPTIMISTIC_LOCKED.equals(propertyId)) {
- if (prop != null) {
- res = Boolean.valueOf(prop.isOptimisticLocked()).toString();
- }
- } else if (PROPERTY_NULLABLE.equals(propertyId)) {
- if (col != null) {
+ } else if (PROPERTY_NULLABLE.equals(propertyId)) {
res = Boolean.valueOf(col.isNullable()).toString();
- }
- } else if (PROPERTY_UNIQUE.equals(propertyId)) {
- if (col != null) {
+ } else if (PROPERTY_UNIQUE.equals(propertyId)) {
res = Boolean.valueOf(col.isUnique()).toString();
}
}
@@ -373,12 +347,4 @@
}
return toEmptyStr(res);
}
-
- protected Object toEmptyStr(Object obj) {
- if (obj == null) {
- return ""; //$NON-NLS-1$
- }
- return obj;
- }
-
}
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/DiagramEditPart.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/DiagramEditPart.java 2009-12-16
12:47:44 UTC (rev 19299)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/DiagramEditPart.java 2009-12-16
13:54:03 UTC (rev 19300)
@@ -104,6 +104,16 @@
refresh();
}
+ @Override
+ public void refresh() {
+ IFigure layer = getLayer(LayerConstants.PRIMARY_LAYER);
+ getOrmDiagram().updateWidthAndHeight(layer.getBounds().width,
layer.getBounds().height);
+ double zoom = ((DiagramViewer) ((DefaultEditDomain) getViewer().getEditDomain())
+ .getEditorPart()).getZoom();
+ getOrmDiagram().setZoom(zoom);
+ super.refresh();
+ }
+
/**
* Returns a <code>List</code> containing the children model objects.
* @return the List of children