summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNan Li2012-09-20 10:31:50 (EDT)
committer Karen Butzke2012-09-20 10:31:50 (EDT)
commit0079c7c700e873a05fb547c9ee7ee63b4c777316 (patch)
tree5a3b0e0e4efb145faacf7a95f34561c453a8d2ee
parente02029568c8b3a90bfbc0a1f647b799660a387ca (diff)
downloadwebtools.dali-0079c7c700e873a05fb547c9ee7ee63b4c777316.zip
webtools.dali-0079c7c700e873a05fb547c9ee7ee63b4c777316.tar.gz
webtools.dali-0079c7c700e873a05fb547c9ee7ee63b4c777316.tar.bz2
Bug 348145 - The list of discriminator columns/order columns not updated when table of entity changed
-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.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
7 files changed, 73 insertions, 3 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.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