summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNan Li2012-09-25 16:55:19 (EDT)
committer Karen Butzke2012-09-26 08:42:16 (EDT)
commit1821c15112f586ba99efc7ed2801aee4081ed134 (patch)
tree484f3c43285cf9d51d29622bf2396e2bb67c93ad
parent094956d08dcbe56139e153032f482e2cd194be40 (diff)
downloadwebtools.dali-1821c15112f586ba99efc7ed2801aee4081ed134.zip
webtools.dali-1821c15112f586ba99efc7ed2801aee4081ed134.tar.gz
webtools.dali-1821c15112f586ba99efc7ed2801aee4081ed134.tar.bz2
Bug 348145 - The list of discriminator column not updated when table of entity changed - now with all the tests passing
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyNamedColumn.java1
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaNamedColumn.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualNamedColumn.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmNamedColumn.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualNamedColumn.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOrderable.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOrderable.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/DiscriminatorColumnComposite.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/OrderColumnComposite.java13
9 files changed, 77 insertions, 7 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyNamedColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyNamedColumn.java
index 4cdd707..8475a29 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyNamedColumn.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyNamedColumn.java
@@ -69,6 +69,7 @@ public interface ReadOnlyNamedColumn
* Return the column's datasource table.
*/
Table getDbTable();
+ String DB_TABLE_PROPERTY = "dbTable"; //$NON-NLS-1$
/**
* Return whether the column is found on the datasource.
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaNamedColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaNamedColumn.java
index 74b8443..735064c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaNamedColumn.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaNamedColumn.java
@@ -51,6 +51,7 @@ public abstract class AbstractJavaNamedColumn<A extends NamedColumnAnnotation, O
protected String columnDefinition;
+ protected Table dbTable;
protected AbstractJavaNamedColumn(JpaContextNode parent, O owner) {
this(parent, owner, null);
@@ -85,6 +86,7 @@ public abstract class AbstractJavaNamedColumn<A extends NamedColumnAnnotation, O
public void update() {
super.update();
this.setDefaultName(this.buildDefaultName());
+ this.setDbTable(this.buildDbTable());
}
@@ -191,6 +193,16 @@ public abstract class AbstractJavaNamedColumn<A extends NamedColumnAnnotation, O
}
public Table getDbTable() {
+ return this.dbTable;
+ }
+
+ protected void setDbTable(Table dbTable) {
+ Table old = this.dbTable;
+ this.dbTable = dbTable;
+ this.firePropertyChanged(DB_TABLE_PROPERTY, old, dbTable);
+ }
+
+ protected Table buildDbTable() {
return this.owner.resolveDbTable(this.getTable());
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualNamedColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualNamedColumn.java
index ece6bb8..e090bd8 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualNamedColumn.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualNamedColumn.java
@@ -40,6 +40,7 @@ public abstract class AbstractJavaVirtualNamedColumn<O extends ReadOnlyNamedColu
protected String columnDefinition;
+ protected Table dbTable;
protected AbstractJavaVirtualNamedColumn(JpaContextNode parent, O owner) {
super(parent);
@@ -57,6 +58,8 @@ public abstract class AbstractJavaVirtualNamedColumn<O extends ReadOnlyNamedColu
this.setDefaultName(this.buildDefaultName());
this.setColumnDefinition(this.buildColumnDefinition());
+
+ this.setDbTable(this.buildDbTable());
}
@@ -128,6 +131,16 @@ public abstract class AbstractJavaVirtualNamedColumn<O extends ReadOnlyNamedColu
}
public Table getDbTable() {
+ return this.dbTable;
+ }
+
+ protected void setDbTable(Table dbTable) {
+ Table old = this.dbTable;
+ this.dbTable = dbTable;
+ this.firePropertyChanged(DB_TABLE_PROPERTY, old, dbTable);
+ }
+
+ protected Table buildDbTable() {
return this.owner.resolveDbTable(this.getTable());
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmNamedColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmNamedColumn.java
index 28013bc..b5174cf 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmNamedColumn.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmNamedColumn.java
@@ -52,6 +52,7 @@ public abstract class AbstractOrmNamedColumn<X extends XmlNamedColumn, O extends
protected String columnDefinition;
+ protected Table dbTable;
// ********** constructor/initialization **********
@@ -81,6 +82,7 @@ public abstract class AbstractOrmNamedColumn<X extends XmlNamedColumn, O extends
public void update() {
super.update();
this.setDefaultName(this.buildDefaultName());
+ this.setDbTable(this.buildDbTable());
}
@@ -199,6 +201,16 @@ public abstract class AbstractOrmNamedColumn<X extends XmlNamedColumn, O extends
}
public Table getDbTable() {
+ return this.dbTable;
+ }
+
+ protected void setDbTable(Table dbTable) {
+ Table old = this.dbTable;
+ this.dbTable = dbTable;
+ this.firePropertyChanged(DB_TABLE_PROPERTY, old, dbTable);
+ }
+
+ protected Table buildDbTable() {
return this.owner.resolveDbTable(this.getTable());
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualNamedColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualNamedColumn.java
index df24982..792d412 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualNamedColumn.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualNamedColumn.java
@@ -41,6 +41,7 @@ public abstract class AbstractOrmVirtualNamedColumn<O extends ReadOnlyNamedColum
protected String columnDefinition;
+ protected Table dbTable;
protected AbstractOrmVirtualNamedColumn(JpaContextNode parent, O owner) {
super(parent);
@@ -58,6 +59,8 @@ public abstract class AbstractOrmVirtualNamedColumn<O extends ReadOnlyNamedColum
this.setDefaultName(this.buildDefaultName());
this.setColumnDefinition(this.buildColumnDefinition());
+
+ this.setDbTable(this.buildDbTable());
}
@@ -129,6 +132,16 @@ public abstract class AbstractOrmVirtualNamedColumn<O extends ReadOnlyNamedColum
}
public Table getDbTable() {
+ return this.dbTable;
+ }
+
+ protected void setDbTable(Table dbTable) {
+ Table old = this.dbTable;
+ this.dbTable = dbTable;
+ this.firePropertyChanged(DB_TABLE_PROPERTY, old, dbTable);
+ }
+
+ protected Table buildDbTable() {
return this.owner.resolveDbTable(this.getTable());
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOrderable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOrderable.java
index 965bd3c..5bab411 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOrderable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOrderable.java
@@ -388,12 +388,12 @@ public class GenericJavaOrderable
// JPA 2.0 only
public String getDefaultTableName() {
- return this.owner.getTableName();
+ return this.owner == null ? null : this.owner.getTableName();
}
// JPA 2.0 only
protected Table resolveDbTable(String tableName) {
- return this.owner.resolveDbTable(tableName);
+ return this.owner == null ? null : this.owner.resolveDbTable(tableName);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOrderable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOrderable.java
index 8bffd44..968ecb6 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOrderable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOrderable.java
@@ -373,12 +373,12 @@ public class GenericOrmOrderable
// JPA 2.0
public String getDefaultTableName() {
- return this.owner.getTableName();
+ return this.owner == null ? null : this.owner.getTableName();
}
// JPA 2.0
protected Table resolveDbTable(String tableName) {
- return this.owner.resolveDbTable(tableName);
+ return this.owner == null ? null : this.owner.resolveDbTable(tableName);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/DiscriminatorColumnComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/DiscriminatorColumnComposite.java
index fd831c7..e3e2495 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/DiscriminatorColumnComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/DiscriminatorColumnComposite.java
@@ -15,8 +15,8 @@ import org.eclipse.jpt.common.ui.internal.widgets.EnumFormComboViewer;
import org.eclipse.jpt.common.ui.internal.widgets.IntegerCombo;
import org.eclipse.jpt.common.ui.internal.widgets.Pane;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel;
+import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.jpa.core.context.DiscriminatorColumn;
import org.eclipse.jpt.jpa.core.context.DiscriminatorType;
import org.eclipse.jpt.jpa.core.context.Entity;
@@ -150,6 +150,16 @@ public class DiscriminatorColumnComposite<T extends Entity> extends Pane<T> {
super.addPropertyNames(propertyNames);
propertyNames.add(ReadOnlyNamedColumn.SPECIFIED_NAME_PROPERTY);
propertyNames.add(ReadOnlyNamedColumn.DEFAULT_NAME_PROPERTY);
+ propertyNames.add(ReadOnlyNamedColumn.DB_TABLE_PROPERTY);
+ }
+
+ @Override
+ protected void propertyChanged(String propertyName) {
+ if (propertyName.equals(ReadOnlyNamedColumn.DB_TABLE_PROPERTY)) {
+ this.doPopulate();
+ } else {
+ super.propertyChanged(propertyName);
+ }
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/OrderColumnComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/OrderColumnComposite.java
index c8f5124..595d794 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/OrderColumnComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/OrderColumnComposite.java
@@ -10,14 +10,13 @@
package org.eclipse.jpt.jpa.ui.internal.jpa2.details;
import java.util.Collection;
-
import org.eclipse.jpt.common.ui.internal.JptCommonUiMessages;
import org.eclipse.jpt.common.ui.internal.widgets.Pane;
import org.eclipse.jpt.common.ui.internal.widgets.TriStateCheckBox;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter;
import org.eclipse.jpt.common.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel;
+import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.jpa.core.context.BaseColumn;
import org.eclipse.jpt.jpa.core.context.NamedColumn;
import org.eclipse.jpt.jpa.core.jpa2.context.OrderColumn2_0;
@@ -84,6 +83,16 @@ public class OrderColumnComposite extends Pane<OrderColumn2_0> {
super.addPropertyNames(propertyNames);
propertyNames.add(NamedColumn.DEFAULT_NAME_PROPERTY);
propertyNames.add(NamedColumn.SPECIFIED_NAME_PROPERTY);
+ propertyNames.add(NamedColumn.DB_TABLE_PROPERTY);
+ }
+
+ @Override
+ protected void propertyChanged(String propertyName) {
+ if (propertyName.equals(NamedColumn.DB_TABLE_PROPERTY)) {
+ this.doPopulate();
+ } else {
+ super.propertyChanged(propertyName);
+ }
}
@Override