diff options
author | kmoore | 2008-01-31 19:14:58 +0000 |
---|---|---|
committer | kmoore | 2008-01-31 19:14:58 +0000 |
commit | 9b6090611d4b2bf2fd05e4dbd677e5953e5cd0e9 (patch) | |
tree | 2725485a5b81bd4029b6c614f045114b79a7cf47 | |
parent | 92afb043f3285d866aaa5117d3ab1442e3010a1c (diff) | |
download | webtools.dali-9b6090611d4b2bf2fd05e4dbd677e5953e5cd0e9.tar.gz webtools.dali-9b6090611d4b2bf2fd05e4dbd677e5953e5cd0e9.tar.xz webtools.dali-9b6090611d4b2bf2fd05e4dbd677e5953e5cd0e9.zip |
preventing invalid thread access exceptions when adding a new annotation and setting a value
7 files changed, 237 insertions, 21 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaColumn.java index 5046815018..99566f0a81 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaColumn.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaColumn.java @@ -72,6 +72,18 @@ public abstract class AbstractJavaColumn<T extends AbstractColumn> extends JavaN columnResource().setTable(newSpecifiedTable); firePropertyChanged(IAbstractColumn.SPECIFIED_TABLE_PROPERTY, oldSpecifiedTable, newSpecifiedTable); } + + /** + * internal setter used only for updating from the resource model. + * There were problems with InvalidThreadAccess exceptions in the UI + * when you set a value from the UI and the annotation doesn't exist yet. + * Adding the annotation causes an update to occur and then the exception. + */ + protected void setSpecifiedTable_(String newSpecifiedTable) { + String oldSpecifiedTable = this.specifiedTable; + this.specifiedTable = newSpecifiedTable; + firePropertyChanged(IAbstractColumn.SPECIFIED_TABLE_PROPERTY, oldSpecifiedTable, newSpecifiedTable); + } public String getDefaultTable() { return this.defaultTable; @@ -102,6 +114,18 @@ public abstract class AbstractJavaColumn<T extends AbstractColumn> extends JavaN firePropertyChanged(IAbstractColumn.SPECIFIED_UNIQUE_PROPERTY, oldSpecifiedUnique, newSpecifiedUnique); } + /** + * internal setter used only for updating from the resource model. + * There were problems with InvalidThreadAccess exceptions in the UI + * when you set a value from the UI and the annotation doesn't exist yet. + * Adding the annotation causes an update to occur and then the exception. + */ + protected void setSpecifiedUnique_(Boolean newSpecifiedUnique) { + Boolean oldSpecifiedUnique = this.specifiedUnique; + this.specifiedUnique = newSpecifiedUnique; + firePropertyChanged(IAbstractColumn.SPECIFIED_UNIQUE_PROPERTY, oldSpecifiedUnique, newSpecifiedUnique); + } + public Boolean getNullable() { return (this.getSpecifiedNullable() == null) ? this.getDefaultNullable() : this.getSpecifiedNullable(); } @@ -121,6 +145,18 @@ public abstract class AbstractJavaColumn<T extends AbstractColumn> extends JavaN firePropertyChanged(IAbstractColumn.SPECIFIED_NULLABLE_PROPERTY, oldSpecifiedNullable, newSpecifiedNullable); } + /** + * internal setter used only for updating from the resource model. + * There were problems with InvalidThreadAccess exceptions in the UI + * when you set a value from the UI and the annotation doesn't exist yet. + * Adding the annotation causes an update to occur and then the exception. + */ + protected void setSpecifiedNullable_(Boolean newSpecifiedNullable) { + Boolean oldSpecifiedNullable = this.specifiedNullable; + this.specifiedNullable = newSpecifiedNullable; + firePropertyChanged(IAbstractColumn.SPECIFIED_NULLABLE_PROPERTY, oldSpecifiedNullable, newSpecifiedNullable); + } + public Boolean getInsertable() { return (this.getSpecifiedInsertable() == null) ? this.getDefaultInsertable() : this.getSpecifiedInsertable(); } @@ -140,6 +176,18 @@ public abstract class AbstractJavaColumn<T extends AbstractColumn> extends JavaN firePropertyChanged(IAbstractColumn.SPECIFIED_INSERTABLE_PROPERTY, oldSpecifiedInsertable, newSpecifiedInsertable); } + /** + * internal setter used only for updating from the resource model. + * There were problems with InvalidThreadAccess exceptions in the UI + * when you set a value from the UI and the annotation doesn't exist yet. + * Adding the annotation causes an update to occur and then the exception. + */ + protected void setSpecifiedInsertable_(Boolean newSpecifiedInsertable) { + Boolean oldSpecifiedInsertable = this.specifiedInsertable; + this.specifiedInsertable = newSpecifiedInsertable; + firePropertyChanged(IAbstractColumn.SPECIFIED_INSERTABLE_PROPERTY, oldSpecifiedInsertable, newSpecifiedInsertable); + } + public Boolean getUpdatable() { return (this.getSpecifiedUpdatable() == null) ? this.getDefaultUpdatable() : this.getSpecifiedUpdatable(); } @@ -159,6 +207,17 @@ public abstract class AbstractJavaColumn<T extends AbstractColumn> extends JavaN firePropertyChanged(IAbstractColumn.SPECIFIED_UPDATABLE_PROPERTY, oldSpecifiedUpdatable, newSpecifiedUpdatable); } + /** + * internal setter used only for updating from the resource model. + * There were problems with InvalidThreadAccess exceptions in the UI + * when you set a value from the UI and the annotation doesn't exist yet. + * Adding the annotation causes an update to occur and then the exception. + */ + protected void setSpecifiedUpdatable_(Boolean newSpecifiedUpdatable) { + Boolean oldSpecifiedUpdatable = this.specifiedUpdatable; + this.specifiedUpdatable = newSpecifiedUpdatable; + firePropertyChanged(IAbstractColumn.SPECIFIED_UPDATABLE_PROPERTY, oldSpecifiedUpdatable, newSpecifiedUpdatable); + } @Override protected String tableName() { @@ -207,11 +266,11 @@ public abstract class AbstractJavaColumn<T extends AbstractColumn> extends JavaN protected void update(T column) { super.update(column); this.setDefaultTable(this.defaultTable()); - this.setSpecifiedTable(this.specifiedTable(column)); - this.setSpecifiedUnique(this.specifiedUnique(column)); - this.setSpecifiedNullable(this.specifiedNullable(column)); - this.setSpecifiedInsertable(this.specifiedInsertable(column)); - this.setSpecifiedUpdatable(this.specifiedUpdatable(column)); + this.setSpecifiedTable_(this.specifiedTable(column)); + this.setSpecifiedUnique_(this.specifiedUnique(column)); + this.setSpecifiedNullable_(this.specifiedNullable(column)); + this.setSpecifiedInsertable_(this.specifiedInsertable(column)); + this.setSpecifiedUpdatable_(this.specifiedUpdatable(column)); } protected String defaultTable() { diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTable.java index b3e09ee003..4358f073d2 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTable.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTable.java @@ -67,6 +67,18 @@ public abstract class AbstractJavaTable extends JavaContextModel tableResource().setName(newSpecifiedName); firePropertyChanged(ITable.SPECIFIED_NAME_PROPERTY, oldSpecifiedName, newSpecifiedName); } + + /** + * internal setter used only for updating from the resource model. + * There were problems with InvalidThreadAccess exceptions in the UI + * when you set a value from the UI and the annotation doesn't exist yet. + * Adding the annotation causes an update to occur and then the exception. + */ + protected void setSpecifiedName_(String newSpecifiedName) { + String oldSpecifiedName = this.specifiedName; + this.specifiedName = newSpecifiedName; + firePropertyChanged(ITable.SPECIFIED_NAME_PROPERTY, oldSpecifiedName, newSpecifiedName); + } public String getDefaultName() { return this.defaultName; @@ -87,6 +99,18 @@ public abstract class AbstractJavaTable extends JavaContextModel firePropertyChanged(ITable.SPECIFIED_CATALOG_PROPERTY, oldSpecifiedCatalog, newSpecifiedCatalog); } + /** + * internal setter used only for updating from the resource model. + * There were problems with InvalidThreadAccess exceptions in the UI + * when you set a value from the UI and the annotation doesn't exist yet. + * Adding the annotation causes an update to occur and then the exception. + */ + protected void setSpecifiedCatalog_(String newSpecifiedCatalog) { + String oldSpecifiedCatalog = this.specifiedCatalog; + this.specifiedCatalog = newSpecifiedCatalog; + firePropertyChanged(ITable.SPECIFIED_CATALOG_PROPERTY, oldSpecifiedCatalog, newSpecifiedCatalog); + } + public String getDefaultCatalog() { return this.defaultCatalog; } @@ -105,6 +129,18 @@ public abstract class AbstractJavaTable extends JavaContextModel tableResource().setSchema(newSpecifiedSchema); firePropertyChanged(ITable.SPECIFIED_SCHEMA_PROPERTY, oldSpecifiedSchema, newSpecifiedSchema); } + + /** + * internal setter used only for updating from the resource model. + * There were problems with InvalidThreadAccess exceptions in the UI + * when you set a value from the UI and the annotation doesn't exist yet. + * Adding the annotation causes an update to occur and then the exception. + */ + protected void setSpecifiedSchema_(String newSpecifiedSchema) { + String oldSpecifiedSchema = this.specifiedSchema; + this.specifiedSchema = newSpecifiedSchema; + firePropertyChanged(ITable.SPECIFIED_SCHEMA_PROPERTY, oldSpecifiedSchema, newSpecifiedSchema); + } public String getDefaultSchema() { return this.defaultSchema; @@ -172,9 +208,9 @@ public abstract class AbstractJavaTable extends JavaContextModel protected void update(Table table) { - this.setSpecifiedName(table.getName()); - this.setSpecifiedSchema(table.getSchema()); - this.setSpecifiedCatalog(table.getCatalog()); + this.setSpecifiedName_(table.getName()); + this.setSpecifiedSchema_(table.getSchema()); + this.setSpecifiedCatalog_(table.getCatalog()); this.setDefaultName(this.defaultName()); this.setDefaultSchema(this.defaultSchema()); this.setDefaultCatalog(this.defaultCatalog()); diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaBasicMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaBasicMapping.java index 6988872fec..18f09a383c 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaBasicMapping.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaBasicMapping.java @@ -130,6 +130,18 @@ public class JavaBasicMapping extends JavaAttributeMapping implements IJavaBasic this.basicResource().setFetch(FetchType.toJavaResourceModel(newSpecifiedFetch)); firePropertyChanged(IFetchable.SPECIFIED_FETCH_PROPERTY, oldFetch, newSpecifiedFetch); } + + /** + * internal setter used only for updating from the resource model. + * There were problems with InvalidThreadAccess exceptions in the UI + * when you set a value from the UI and the annotation doesn't exist yet. + * Adding the annotation causes an update to occur and then the exception. + */ + protected void setSpecifiedFetch_(FetchType newSpecifiedFetch) { + FetchType oldFetch = this.specifiedFetch; + this.specifiedFetch = newSpecifiedFetch; + firePropertyChanged(IFetchable.SPECIFIED_FETCH_PROPERTY, oldFetch, newSpecifiedFetch); + } public Boolean getOptional() { return (this.getSpecifiedOptional() == null) ? this.getDefaultOptional() : this.getSpecifiedOptional(); @@ -182,6 +194,18 @@ public class JavaBasicMapping extends JavaAttributeMapping implements IJavaBasic firePropertyChanged(IColumnMapping.TEMPORAL_PROPERTY, oldTemporal, newTemporal); } + /** + * internal setter used only for updating from the resource model. + * There were problems with InvalidThreadAccess exceptions in the UI + * when you set a value from the UI and the annotation doesn't exist yet. + * Adding the annotation causes an update to occur and then the exception. + */ + protected void setTemporal_(TemporalType newTemporal) { + TemporalType oldTemporal = this.temporal; + this.temporal = newTemporal; + firePropertyChanged(IColumnMapping.TEMPORAL_PROPERTY, oldTemporal, newTemporal); + } + public EnumType getEnumerated() { return (this.getSpecifiedEnumerated() == null) ? this.getDefaultEnumerated() : this.getSpecifiedEnumerated(); } @@ -200,17 +224,29 @@ public class JavaBasicMapping extends JavaAttributeMapping implements IJavaBasic this.enumeratedResource().setValue(EnumType.toJavaResourceModel(newSpecifiedEnumerated)); firePropertyChanged(IBasicMapping.SPECIFIED_ENUMERATED_PROPERTY, oldEnumerated, newSpecifiedEnumerated); } + + /** + * internal setter used only for updating from the resource model. + * There were problems with InvalidThreadAccess exceptions in the UI + * when you set a value from the UI and the annotation doesn't exist yet. + * Adding the annotation causes an update to occur and then the exception. + */ + protected void setSpecifiedEnumerated_(EnumType newSpecifiedEnumerated) { + EnumType oldEnumerated = this.specifiedEnumerated; + this.specifiedEnumerated = newSpecifiedEnumerated; + firePropertyChanged(IBasicMapping.SPECIFIED_ENUMERATED_PROPERTY, oldEnumerated, newSpecifiedEnumerated); + } @Override public void update(JavaPersistentAttributeResource persistentAttributeResource) { super.update(persistentAttributeResource); this.column.update(this.columnResource()); Basic basicResource = this.basicResource(); - this.setSpecifiedFetch(this.specifiedFetchType(basicResource)); + this.setSpecifiedFetch_(this.specifiedFetchType(basicResource)); this.setSpecifiedOptional(this.specifiedOptional(basicResource)); - this.setSpecifiedEnumerated(this.specifiedEnumerated(this.enumeratedResource())); + this.setSpecifiedEnumerated_(this.specifiedEnumerated(this.enumeratedResource())); this.setLob(this.lob(persistentAttributeResource)); - this.setTemporal(this.temporal(this.temporalResource())); + this.setTemporal_(this.temporal(this.temporalResource())); } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaDiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaDiscriminatorColumn.java index b952f9ddde..11914143a6 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaDiscriminatorColumn.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaDiscriminatorColumn.java @@ -70,6 +70,18 @@ public class JavaDiscriminatorColumn extends JavaNamedColumn<DiscriminatorColumn columnResource().setDiscriminatorType(DiscriminatorType.toJavaResourceModel(newSpecifiedDiscriminatorType)); firePropertyChanged(IDiscriminatorColumn.SPECIFIED_DISCRIMINATOR_TYPE_PROPERTY, oldDiscriminatorType, newSpecifiedDiscriminatorType); } + + /** + * internal setter used only for updating from the resource model. + * There were problems with InvalidThreadAccess exceptions in the UI + * when you set a value from the UI and the annotation doesn't exist yet. + * Adding the annotation causes an update to occur and then the exception. + */ + protected void setSpecifiedDiscriminatorType_(DiscriminatorType newSpecifiedDiscriminatorType) { + DiscriminatorType oldDiscriminatorType = this.specifiedDiscriminatorType; + this.specifiedDiscriminatorType = newSpecifiedDiscriminatorType; + firePropertyChanged(IDiscriminatorColumn.SPECIFIED_DISCRIMINATOR_TYPE_PROPERTY, oldDiscriminatorType, newSpecifiedDiscriminatorType); + } public Integer getLength() { return (this.getSpecifiedLength() == null) ? this.getDefaultLength() : this.getSpecifiedLength(); @@ -90,6 +102,18 @@ public class JavaDiscriminatorColumn extends JavaNamedColumn<DiscriminatorColumn firePropertyChanged(IDiscriminatorColumn.SPECIFIED_LENGTH_PROPERTY, oldSpecifiedLength, newSpecifiedLength); } + /** + * internal setter used only for updating from the resource model. + * There were problems with InvalidThreadAccess exceptions in the UI + * when you set a value from the UI and the annotation doesn't exist yet. + * Adding the annotation causes an update to occur and then the exception. + */ + protected void setSpecifiedLength_(Integer newSpecifiedLength) { + Integer oldSpecifiedLength = this.specifiedLength; + this.specifiedLength = newSpecifiedLength; + firePropertyChanged(IDiscriminatorColumn.SPECIFIED_LENGTH_PROPERTY, oldSpecifiedLength, newSpecifiedLength); + } + @Override protected String tableName() { return javaEntity().getTableName(); @@ -111,8 +135,8 @@ public class JavaDiscriminatorColumn extends JavaNamedColumn<DiscriminatorColumn @Override public void update(DiscriminatorColumn discriminatorColumn) { super.update(discriminatorColumn); - this.setSpecifiedDiscriminatorType(this.discriminatorType(discriminatorColumn)); - this.setSpecifiedLength(this.length(discriminatorColumn)); + this.setSpecifiedDiscriminatorType_(this.discriminatorType(discriminatorColumn)); + this.setSpecifiedLength_(this.length(discriminatorColumn)); } protected DiscriminatorType discriminatorType(DiscriminatorColumn discriminatorColumn) { diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEntity.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEntity.java index 5fce1e1e9c..adfa9a7d16 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEntity.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEntity.java @@ -454,6 +454,18 @@ public class JavaEntity extends JavaTypeMapping implements IJavaEntity inheritanceResource().setStrategy(InheritanceType.toJavaResourceModel(newInheritanceType)); firePropertyChanged(SPECIFIED_INHERITANCE_STRATEGY_PROPERTY, oldInheritanceType, newInheritanceType); } + + /** + * internal setter used only for updating from the resource model. + * There were problems with InvalidThreadAccess exceptions in the UI + * when you set a value from the UI and the annotation doesn't exist yet. + * Adding the annotation causes an update to occur and then the exception. + */ + protected void setSpecifiedInheritanceStrategy_(InheritanceType newInheritanceType) { + InheritanceType oldInheritanceType = this.specifiedInheritanceStrategy; + this.specifiedInheritanceStrategy = newInheritanceType; + firePropertyChanged(SPECIFIED_INHERITANCE_STRATEGY_PROPERTY, oldInheritanceType, newInheritanceType); + } public IJavaDiscriminatorColumn getDiscriminatorColumn() { return this.discriminatorColumn; @@ -480,6 +492,18 @@ public class JavaEntity extends JavaTypeMapping implements IJavaEntity firePropertyChanged(SPECIFIED_DISCRIMINATOR_VALUE_PROPERTY, oldSpecifiedDiscriminatorValue, newSpecifiedDiscriminatorValue); } + /** + * internal setter used only for updating from the resource model. + * There were problems with InvalidThreadAccess exceptions in the UI + * when you set a value from the UI and the annotation doesn't exist yet. + * Adding the annotation causes an update to occur and then the exception. + */ + protected void setSpecifiedDiscriminatorValue_(String newSpecifiedDiscriminatorValue) { + String oldSpecifiedDiscriminatorValue = this.specifiedDiscriminatorValue; + this.specifiedDiscriminatorValue = newSpecifiedDiscriminatorValue; + firePropertyChanged(SPECIFIED_DISCRIMINATOR_VALUE_PROPERTY, oldSpecifiedDiscriminatorValue, newSpecifiedDiscriminatorValue); + } + public String getDiscriminatorValue() { return (this.getSpecifiedDiscriminatorValue() == null) ? getDefaultDiscriminatorValue() : this.getSpecifiedDiscriminatorValue(); } @@ -956,7 +980,7 @@ public class JavaEntity extends JavaTypeMapping implements IJavaEntity } protected void updateInheritance(Inheritance inheritanceResource) { - this.setSpecifiedInheritanceStrategy(this.specifiedInheritanceStrategy(inheritanceResource)); + this.setSpecifiedInheritanceStrategy_(this.specifiedInheritanceStrategy(inheritanceResource)); this.setDefaultInheritanceStrategy(this.defaultInheritanceStrategy()); } @@ -976,7 +1000,7 @@ public class JavaEntity extends JavaTypeMapping implements IJavaEntity } protected void updateDiscriminatorValue(DiscriminatorValue discriminatorValueResource) { - this.setSpecifiedDiscriminatorValue(discriminatorValueResource.getValue()); + this.setSpecifiedDiscriminatorValue_(discriminatorValueResource.getValue()); this.setDefaultDiscriminatorValue(this.javaDefaultDiscriminatorValue()); } diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaIdMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaIdMapping.java index 350e731907..ec5dead556 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaIdMapping.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaIdMapping.java @@ -133,6 +133,18 @@ public class JavaIdMapping extends JavaAttributeMapping implements IJavaIdMappin firePropertyChanged(IColumnMapping.TEMPORAL_PROPERTY, oldTemporal, newTemporal); } + /** + * internal setter used only for updating from the resource model. + * There were problems with InvalidThreadAccess exceptions in the UI + * when you set a value from the UI and the annotation doesn't exist yet. + * Adding the annotation causes an update to occur and then the exception. + */ + protected void setTemporal_(TemporalType newTemporal) { + TemporalType oldTemporal = this.temporal; + this.temporal = newTemporal; + firePropertyChanged(IColumnMapping.TEMPORAL_PROPERTY, oldTemporal, newTemporal); + } + public IJavaGeneratedValue addGeneratedValue() { if (getGeneratedValue() != null) { throw new IllegalStateException("gemeratedValue already exists"); @@ -228,7 +240,7 @@ public class JavaIdMapping extends JavaAttributeMapping implements IJavaIdMappin public void update(JavaPersistentAttributeResource persistentAttributeResource) { super.update(persistentAttributeResource); this.column.update(this.columnResource()); - this.setTemporal(this.temporal(this.temporalResource())); + this.setTemporal_(this.temporal(this.temporalResource())); this.updateTableGenerator(persistentAttributeResource); this.updateSequenceGenerator(persistentAttributeResource); this.updateGeneratedValue(persistentAttributeResource); diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNamedColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNamedColumn.java index cb5882c46c..4b463c6c71 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNamedColumn.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNamedColumn.java @@ -12,6 +12,7 @@ package org.eclipse.jpt.core.internal.context.java; import java.util.Iterator; import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.internal.context.base.INamedColumn; import org.eclipse.jpt.core.internal.resource.java.NamedColumn; import org.eclipse.jpt.db.internal.Column; import org.eclipse.jpt.db.internal.Table; @@ -63,7 +64,19 @@ public abstract class JavaNamedColumn<T extends NamedColumn> extends JavaContext String oldSpecifiedName = this.specifiedName; this.specifiedName = newSpecifiedName; columnResource().setName(newSpecifiedName); - firePropertyChanged(SPECIFIED_NAME_PROPERTY, oldSpecifiedName, newSpecifiedName); + firePropertyChanged(INamedColumn.SPECIFIED_NAME_PROPERTY, oldSpecifiedName, newSpecifiedName); + } + + /** + * internal setter used only for updating from the resource model. + * There were problems with InvalidThreadAccess exceptions in the UI + * when you set a value from the UI and the annotation doesn't exist yet. + * Adding the annotation causes an update to occur and then the exception. + */ + protected void setSpecifiedName_(String newSpecifiedName) { + String oldSpecifiedName = this.specifiedName; + this.specifiedName = newSpecifiedName; + firePropertyChanged(INamedColumn.SPECIFIED_NAME_PROPERTY, oldSpecifiedName, newSpecifiedName); } public String getDefaultName() { @@ -73,7 +86,7 @@ public abstract class JavaNamedColumn<T extends NamedColumn> extends JavaContext protected void setDefaultName(String newDefaultName) { String oldDefaultName = this.defaultName; this.defaultName = newDefaultName; - firePropertyChanged(DEFAULT_NAME_PROPERTY, oldDefaultName, newDefaultName); + firePropertyChanged(INamedColumn.DEFAULT_NAME_PROPERTY, oldDefaultName, newDefaultName); } public String getColumnDefinition() { @@ -84,7 +97,19 @@ public abstract class JavaNamedColumn<T extends NamedColumn> extends JavaContext String oldColumnDefinition = this.columnDefinition; this.columnDefinition = newColumnDefinition; columnResource().setColumnDefinition(newColumnDefinition); - firePropertyChanged(COLUMN_DEFINITION_PROPERTY, oldColumnDefinition, newColumnDefinition); + firePropertyChanged(INamedColumn.COLUMN_DEFINITION_PROPERTY, oldColumnDefinition, newColumnDefinition); + } + + /** + * internal setter used only for updating from the resource model. + * There were problems with InvalidThreadAccess exceptions in the UI + * when you set a value from the UI and the annotation doesn't exist yet. + * Adding the annotation causes an update to occur and then the exception. + */ + protected void setColumnDefinition_(String newColumnDefinition) { + String oldColumnDefinition = this.columnDefinition; + this.columnDefinition = newColumnDefinition; + firePropertyChanged(INamedColumn.COLUMN_DEFINITION_PROPERTY, oldColumnDefinition, newColumnDefinition); } public Owner owner() { @@ -146,9 +171,9 @@ public abstract class JavaNamedColumn<T extends NamedColumn> extends JavaContext // ******************* update from java resource model ******************** protected void update(T column) { - this.setSpecifiedName(column.getName()); + this.setSpecifiedName_(column.getName()); this.setDefaultName(this.defaultName()); - this.setColumnDefinition(column.getColumnDefinition()); + this.setColumnDefinition_(column.getColumnDefinition()); } /** |