Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'jpa/plugins')
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/model/jptResourceModels.genmodel1
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/model/orm.ecore4
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JpaFactory.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/SecondaryTable.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmEntity.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmPrimaryKeyJoinColumn.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmSecondaryTable.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmNamedColumn.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmEntity.java89
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmPrimaryKeyJoinColumn.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmSecondaryTable.java117
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlPrimaryKeyJoinColumn.java71
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlSecondaryTable.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/GenericJpaFactory.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/PrimaryKeyJoinColumnTranslator.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/OrmFactory.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/OrmPackage.java143
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlPrimaryKeyJoinColumn.java151
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlPrimaryKeyJoinColumnImpl.java239
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/META-INF/MANIFEST.MF3
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui_mappings.properties3
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/JpaUiFactory.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/details/AttributeMappingUiProvider.java (renamed from jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/java/details/AttributeMappingUiProvider.java)15
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/details/TypeMappingUiProvider.java (renamed from jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/java/details/TypeMappingUiProvider.java)7
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/BaseJpaUiFactory.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/AbstractJpaDetailsPage.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/BasicMappingUiProvider.java (renamed from jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/BasicMappingUiProvider.java)6
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/EmbeddableUiProvider.java (renamed from jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/EmbeddableUiProvider.java)9
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/EmbeddedIdMappingUiProvider.java (renamed from jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/EmbeddedIdMappingUiProvider.java)6
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/EmbeddedMappingUiProvider.java (renamed from jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/EmbeddedMappingUiProvider.java)6
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/IdMappingUiProvider.java (renamed from jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/IdMappingUiProvider.java)6
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/ManyToManyMappingUiProvider.java (renamed from jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/ManyToManyMappingUiProvider.java)6
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/ManyToOneMappingUiProvider.java (renamed from jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/ManyToOneMappingUiProvider.java)6
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/MappedSuperclassUiProvider.java (renamed from jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/MappedSuperclassUiProvider.java)9
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/OneToManyMappingUiProvider.java (renamed from jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/OneToManyMappingUiProvider.java)6
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/OneToOneMappingUiProvider.java (renamed from jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/OneToOneMappingUiProvider.java)6
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/PersistentAttributeDetailsPage.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/PersistentTypeDetailsPage.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/TransientMappingUiProvider.java (renamed from jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/TransientMappingUiProvider.java)6
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/VersionMappingUiProvider.java (renamed from jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/VersionMappingUiProvider.java)6
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/dialogs/AddPersistentAttributeToXmlAndMapDialog.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/dialogs/AddPersistentClassDialog.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/DefaultBasicMappingUiProvider.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/DefaultEmbeddedMappingUiProvider.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaEntityComposite.java95
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaEntityUiProvider.java (renamed from jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/EntityUiProvider.java)21
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaPersistentAttributeDetailsPage.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaPersistentTypeDetailsPage.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaSecondaryTablesComposite.java130
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/NullAttributeMappingUiProvider.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/NullTypeMappingUiProvider.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/JptUiMappingsMessages.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/AbstractEntityComposite.java (renamed from jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EntityComposite.java)18
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/AbstractSecondaryTablesComposite.java (renamed from jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/SecondaryTablesComposite.java)81
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnsInSecondaryTableComposite.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/QueriesComposite.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/SecondaryTableDialog.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/orm/details/OrmEntityComposite.java87
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/orm/details/OrmEntityUiProvider.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/orm/details/OrmPersistentAttributeDetailsPage.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/orm/details/OrmPersistentTypeDetailsPage.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/orm/details/OrmSecondaryTablesComposite.java190
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/platform/base/BaseJpaPlatformUi.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/AddRemovePane.java16
64 files changed, 1539 insertions, 528 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/model/jptResourceModels.genmodel b/jpa/plugins/org.eclipse.jpt.core/model/jptResourceModels.genmodel
index 40b9091a6f..0c3d1c6107 100644
--- a/jpa/plugins/org.eclipse.jpt.core/model/jptResourceModels.genmodel
+++ b/jpa/plugins/org.eclipse.jpt.core/model/jptResourceModels.genmodel
@@ -313,6 +313,7 @@
<genClasses ecoreClass="orm.ecore#//XmlPrimaryKeyJoinColumn">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//XmlPrimaryKeyJoinColumn/referencedColumnName"/>
</genClasses>
+ <genClasses ecoreClass="orm.ecore#//XmlPrimaryKeyJoinColumnImpl"/>
<genClasses ecoreClass="orm.ecore#//XmlQueryHint">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//XmlQueryHint/name"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//XmlQueryHint/value"/>
diff --git a/jpa/plugins/org.eclipse.jpt.core/model/orm.ecore b/jpa/plugins/org.eclipse.jpt.core/model/orm.ecore
index 8fcf2862e2..3b3667941d 100644
--- a/jpa/plugins/org.eclipse.jpt.core/model/orm.ecore
+++ b/jpa/plugins/org.eclipse.jpt.core/model/orm.ecore
@@ -385,9 +385,11 @@
<eClassifiers xsi:type="ecore:EClass" name="PrePersist" eSuperTypes="#//EventMethod"/>
<eClassifiers xsi:type="ecore:EClass" name="PreRemove" eSuperTypes="#//EventMethod"/>
<eClassifiers xsi:type="ecore:EClass" name="PreUpdate" eSuperTypes="#//EventMethod"/>
- <eClassifiers xsi:type="ecore:EClass" name="XmlPrimaryKeyJoinColumn" eSuperTypes="#//AbstractXmlNamedColumn">
+ <eClassifiers xsi:type="ecore:EClass" name="XmlPrimaryKeyJoinColumn" abstract="true"
+ interface="true" eSuperTypes="#//XmlNamedColumn">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="referencedColumnName" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
</eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="XmlPrimaryKeyJoinColumnImpl" eSuperTypes="#//AbstractXmlNamedColumn #//XmlPrimaryKeyJoinColumn"/>
<eClassifiers xsi:type="ecore:EClass" name="XmlQueryHint">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="value" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JpaFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JpaFactory.java
index d1da7aa946..1b5569a42f 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JpaFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JpaFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -103,6 +103,7 @@ import org.eclipse.jpt.core.resource.orm.OrmResource;
import org.eclipse.jpt.core.resource.orm.XmlAssociationOverride;
import org.eclipse.jpt.core.resource.orm.XmlAttributeOverride;
import org.eclipse.jpt.core.resource.orm.XmlEntityMappings;
+import org.eclipse.jpt.core.resource.orm.XmlSecondaryTable;
import org.eclipse.jpt.core.resource.persistence.PersistenceResource;
import org.eclipse.jpt.core.resource.persistence.XmlJavaClassRef;
import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
@@ -212,7 +213,7 @@ public interface JpaFactory
OrmTable buildOrmTable(OrmEntity parent);
- OrmSecondaryTable buildOrmSecondaryTable(OrmEntity parent);
+ OrmSecondaryTable buildOrmSecondaryTable(OrmEntity parent, XmlSecondaryTable xmlSecondaryTable);
OrmPrimaryKeyJoinColumn buildOrmPrimaryKeyJoinColumn(OrmJpaContextNode parent, OrmAbstractJoinColumn.Owner owner);
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/SecondaryTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/SecondaryTable.java
index 2d2ecd3593..efe29892f8 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/SecondaryTable.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/SecondaryTable.java
@@ -75,9 +75,10 @@ public interface SecondaryTable extends Table
* Move the specified primary key join column from the source index to the target index.
*/
void moveSpecifiedPrimaryKeyJoinColumn(int targetIndex, int sourceIndex);
-
-// boolean containsSpecifiedPrimaryKeyJoinColumns();
-//
-// boolean isVirtual();
+ /**
+ * Return true if the secondary table exists as specified on the owning object,
+ * or false if the secondary table is a result of defaults calculation
+ */
+ boolean isVirtual();
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmEntity.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmEntity.java
index eb7c75a4ce..e10ad2ffcb 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmEntity.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmEntity.java
@@ -23,8 +23,55 @@ import org.eclipse.jpt.core.resource.orm.XmlEntity;
* pioneering adopters on the understanding that any code that uses this API
* will almost certainly be broken (repeatedly) as the API evolves.
*/
-public interface OrmEntity extends Entity, OrmTypeMapping
+public interface OrmEntity extends OrmTypeMapping, Entity
{
+
+ /**
+ * Return a list iterator of the virtual(not specified) secondary tables.
+ * This will not be null.
+ */
+ ListIterator<OrmSecondaryTable> virtualSecondaryTables();
+ String VIRTUAL_SECONDARY_TABLES_LIST = "virtualSecondaryTablesList";
+
+ /**
+ * Return the number of virtual secondary tables.
+ */
+ int virtualSecondaryTablesSize();
+
+ /**
+ * Return whether the entity contains the given secondary table in its list of
+ * virtual secondary tables
+ */
+ boolean containsVirtualSecondaryTable(OrmSecondaryTable secondaryTable);
+
+ /**
+ * Return true if there are no virtual secondary tables on the orm entity.
+ * This is used to determine whether you can add specified secondary tables.
+ * You must first make sure all virtual secondary tables have been specified
+ * in xml before adding more. This is because adding one secondary table to xml
+ * will override all the secondary tables specified in the java entity
+ */
+ boolean secondaryTablesDefinedInXml();
+
+ /**
+ * If true, then all virtual secondary tables are added in as specified secondary tables to the xml.
+ * If false, then all the specified secondary tables are remvoed from the xml.
+ */
+ void setSecondaryTablesDefinedInXml(boolean defineInXml);
+
+ /**
+ * Return the Java Entity this ORM Entity corresponds to. Return null if there is no
+ * java entity.
+ */
+ JavaEntity javaEntity();
+
+ void initialize(XmlEntity entity);
+
+ void update(XmlEntity entity);
+
+
+ //************ covariant overrides *************
+
OrmTable getTable();
OrmDiscriminatorColumn getDiscriminatorColumn();
@@ -41,12 +88,6 @@ public interface OrmEntity extends Entity, OrmTypeMapping
ListIterator<OrmSecondaryTable> specifiedSecondaryTables();
OrmSecondaryTable addSpecifiedSecondaryTable(int index);
- ListIterator<OrmSecondaryTable> virtualSecondaryTables();
- int virtualSecondaryTablesSize();
- boolean containsVirtualSecondaryTable(OrmSecondaryTable secondaryTable);
- //TODO this might need to move to IEntity, for the UI
- String VIRTUAL_SECONDARY_TABLES_LIST = "virtualSecondaryTablesList";
-
@SuppressWarnings("unchecked")
ListIterator<OrmPrimaryKeyJoinColumn> primaryKeyJoinColumns();
@@ -79,10 +120,4 @@ public interface OrmEntity extends Entity, OrmTypeMapping
@SuppressWarnings("unchecked")
ListIterator<OrmNamedNativeQuery> namedNativeQueries();
OrmNamedNativeQuery addNamedNativeQuery(int index);
-
- JavaEntity javaEntity();
-
- void initialize(XmlEntity entity);
-
- void update(XmlEntity entity);
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmPrimaryKeyJoinColumn.java
index 67eb42f65a..9aafa28f73 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmPrimaryKeyJoinColumn.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmPrimaryKeyJoinColumn.java
@@ -26,4 +26,6 @@ public interface OrmPrimaryKeyJoinColumn extends PrimaryKeyJoinColumn, OrmAbstra
void initialize(XmlPrimaryKeyJoinColumn column);
void update(XmlPrimaryKeyJoinColumn column);
+
+ void initializeFrom(PrimaryKeyJoinColumn oldPkJoinColumn);
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmSecondaryTable.java
index 6b960551ec..2061fb6b50 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmSecondaryTable.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmSecondaryTable.java
@@ -24,6 +24,14 @@ import org.eclipse.jpt.core.resource.orm.XmlSecondaryTable;
*/
public interface OrmSecondaryTable extends SecondaryTable, OrmJpaContextNode
{
+
+ void update(XmlSecondaryTable secondaryTable);
+
+ void initializeFrom(SecondaryTable oldSecondaryTable);
+
+
+ //************ covariant overrides *************
+
OrmEntity parent();
@SuppressWarnings("unchecked")
@@ -36,7 +44,4 @@ public interface OrmSecondaryTable extends SecondaryTable, OrmJpaContextNode
OrmPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index);
- void initialize(XmlSecondaryTable secondaryTable);
-
- void update(XmlSecondaryTable secondaryTable);
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmNamedColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmNamedColumn.java
index 7f042863ec..f66a3787ba 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmNamedColumn.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmNamedColumn.java
@@ -54,14 +54,6 @@ public abstract class AbstractOrmNamedColumn<T extends XmlNamedColumn> extends
return this.owner;
}
-// @Override
-// protected void addInsignificantXmlFeatureIdsTo(Set<Integer> insignificantXmlFeatureIds) {
-// super.addInsignificantXmlFeatureIdsTo(insignificantXmlFeatureIds);
-// insignificantXmlFeatureIds.add(JpaCoreMappingsPackage.INAMED_COLUMN__DEFAULT_NAME);
-// insignificantXmlFeatureIds.add(JpaCoreMappingsPackage.INAMED_COLUMN__NAME);
-// }
-
-
public String getName() {
return (this.specifiedName != null) ? this.specifiedName : this.defaultName;
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmEntity.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmEntity.java
index 903a0d5220..d0e85c137f 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmEntity.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmEntity.java
@@ -274,10 +274,12 @@ public class GenericOrmEntity extends AbstractOrmTypeMapping<XmlEntity> implemen
}
public OrmSecondaryTable addSpecifiedSecondaryTable(int index) {
- OrmSecondaryTable secondaryTable = jpaFactory().buildOrmSecondaryTable(this);
- this.specifiedSecondaryTables.add(index, secondaryTable);
+ if (!secondaryTablesDefinedInXml()) {
+ throw new IllegalStateException("Virtual secondary tables exist, must first call setSecondaryTablesDefinedInXml(true)");
+ }
XmlSecondaryTable secondaryTableResource = OrmFactory.eINSTANCE.createXmlSecondaryTableImpl();
- secondaryTable.initialize(secondaryTableResource);
+ OrmSecondaryTable secondaryTable = buildSecondaryTable(secondaryTableResource);
+ this.specifiedSecondaryTables.add(index, secondaryTable);
typeMappingResource().getSecondaryTables().add(index, secondaryTableResource);
fireItemAdded(Entity.SPECIFIED_SECONDARY_TABLES_LIST, index, secondaryTable);
return secondaryTable;
@@ -333,6 +335,70 @@ public class GenericOrmEntity extends AbstractOrmTypeMapping<XmlEntity> implemen
return false;
}
+ public boolean secondaryTablesDefinedInXml() {
+ return virtualSecondaryTablesSize() == 0;
+ }
+
+ public void setSecondaryTablesDefinedInXml(boolean defineInXml) {
+ if (defineInXml == secondaryTablesDefinedInXml()) {
+ return;
+ }
+ if (defineInXml) {
+ specifySecondaryTablesInXml();
+ }
+ else {
+ removeSecondaryTablesFromXml();
+ }
+ }
+
+ /**
+ * This is used to take all the java secondary tables and specify them in the xml. You must
+ * use setSecondaryTablesDefinedInXml(boolean) before calling addSpecifiedSecondaryTable().
+ *
+ * Yes this code looks odd, but be careful making changes to it
+ */
+ protected void specifySecondaryTablesInXml() {
+ if (virtualSecondaryTablesSize() != 0) {
+ List<OrmSecondaryTable> virtualSecondaryTables = CollectionTools.list(this.virtualSecondaryTables());
+ List<OrmSecondaryTable> virtualSecondaryTable2 = CollectionTools.list(this.virtualSecondaryTables());
+ //remove all the virtual secondary tables without firing change notification.
+ for (OrmSecondaryTable virtualSecondaryTable : CollectionTools.iterable(virtualSecondaryTables())) {
+ this.virtualSecondaryTables.remove(virtualSecondaryTable);
+ }
+ //add specified secondary tables for each virtual secondary table. If the virtual secondary tables
+ //are not removed first, they will be removed as a side effect of adding the first specified secondary table.
+ //This screws up the change notification to the UI, since that change notification is in a different thread
+ for (OrmSecondaryTable virtualSecondaryTable : virtualSecondaryTable2) {
+ XmlSecondaryTable secondaryTableResource = OrmFactory.eINSTANCE.createXmlSecondaryTableImpl();
+ OrmSecondaryTable specifiedSecondaryTable = buildSecondaryTable(secondaryTableResource);
+ this.specifiedSecondaryTables.add(specifiedSecondaryTable);
+ typeMappingResource().getSecondaryTables().add(secondaryTableResource);
+ specifiedSecondaryTable.initializeFrom(virtualSecondaryTable);
+ }
+ //fire change notification at the end
+ fireItemsRemoved(OrmEntity.VIRTUAL_SECONDARY_TABLES_LIST, 0, virtualSecondaryTables);
+ fireItemsAdded(Entity.SPECIFIED_SECONDARY_TABLES_LIST, 0, this.specifiedSecondaryTables);
+ }
+ }
+
+ protected void removeSecondaryTablesFromXml() {
+ if (specifiedSecondaryTablesSize() != 0) {
+ List<OrmSecondaryTable> specifiedSecondaryTables = CollectionTools.list(this.specifiedSecondaryTables());
+ for (OrmSecondaryTable specifiedSecondaryTable : CollectionTools.iterable(specifiedSecondaryTables())) {
+ int index = this.specifiedSecondaryTables.indexOf(specifiedSecondaryTable);
+ this.specifiedSecondaryTables.remove(specifiedSecondaryTable);
+ if (this.specifiedSecondaryTables.size() == 0) {
+ initializeVirtualSecondaryTables();
+ }
+ typeMappingResource().getSecondaryTables().remove(index);
+ }
+ fireItemsRemoved(Entity.SPECIFIED_SECONDARY_TABLES_LIST, 0, specifiedSecondaryTables);
+ if (this.virtualSecondaryTables.size() != 0) {
+ fireItemsAdded(OrmEntity.VIRTUAL_SECONDARY_TABLES_LIST, 0, this.virtualSecondaryTables);
+ }
+ }
+ }
+
protected Iterator<String> tableNames(Iterator<Table> tables) {
return new TransformationIterator<Table, String>(tables) {
@Override
@@ -566,7 +632,7 @@ public class GenericOrmEntity extends AbstractOrmTypeMapping<XmlEntity> implemen
public OrmPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index) {
OrmPrimaryKeyJoinColumn primaryKeyJoinColumn = jpaFactory().buildOrmPrimaryKeyJoinColumn(this, createPrimaryKeyJoinColumnOwner());
this.specifiedPrimaryKeyJoinColumns.add(index, primaryKeyJoinColumn);
- this.typeMappingResource().getPrimaryKeyJoinColumns().add(index, OrmFactory.eINSTANCE.createXmlPrimaryKeyJoinColumn());
+ this.typeMappingResource().getPrimaryKeyJoinColumns().add(index, OrmFactory.eINSTANCE.createXmlPrimaryKeyJoinColumnImpl());
this.fireItemAdded(Entity.SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST, index, primaryKeyJoinColumn);
return primaryKeyJoinColumn;
}
@@ -1012,7 +1078,7 @@ public class GenericOrmEntity extends AbstractOrmTypeMapping<XmlEntity> implemen
protected void initializeSpecifiedSecondaryTables(XmlEntity entity) {
for (XmlSecondaryTable secondaryTable : entity.getSecondaryTables()) {
- this.specifiedSecondaryTables.add(createSecondaryTable(secondaryTable));
+ this.specifiedSecondaryTables.add(buildSecondaryTable(secondaryTable));
}
}
@@ -1159,7 +1225,7 @@ public class GenericOrmEntity extends AbstractOrmTypeMapping<XmlEntity> implemen
}
while (resourceSecondaryTables.hasNext()) {
- addSpecifiedSecondaryTable(specifiedSecondaryTablesSize(), createSecondaryTable(resourceSecondaryTables.next()));
+ addSpecifiedSecondaryTable(specifiedSecondaryTablesSize(), buildSecondaryTable(resourceSecondaryTables.next()));
}
}
@@ -1188,17 +1254,12 @@ public class GenericOrmEntity extends AbstractOrmTypeMapping<XmlEntity> implemen
}
}
- protected OrmSecondaryTable createSecondaryTable(XmlSecondaryTable secondaryTable) {
- OrmSecondaryTable ormSecondaryTable = jpaFactory().buildOrmSecondaryTable(this);
- ormSecondaryTable.initialize(secondaryTable);
- return ormSecondaryTable;
+ protected OrmSecondaryTable buildSecondaryTable(XmlSecondaryTable xmlSecondaryTable) {
+ return jpaFactory().buildOrmSecondaryTable(this, xmlSecondaryTable);
}
protected OrmSecondaryTable buildVirtualSecondaryTable(JavaSecondaryTable javaSecondaryTable) {
- OrmSecondaryTable virtualSecondaryTable = jpaFactory().buildOrmSecondaryTable(this);
- VirtualXmlSecondaryTable virtualXmlSecondaryTable = new VirtualXmlSecondaryTable(javaSecondaryTable);
- virtualSecondaryTable.initialize(virtualXmlSecondaryTable);
- return virtualSecondaryTable;
+ return buildSecondaryTable(new VirtualXmlSecondaryTable(javaSecondaryTable));
}
protected void updateTableGenerator(XmlEntity entity) {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmPrimaryKeyJoinColumn.java
index c9d8830233..f953f3c628 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmPrimaryKeyJoinColumn.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmPrimaryKeyJoinColumn.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,6 +10,7 @@
package org.eclipse.jpt.core.internal.context.orm;
import org.eclipse.jpt.core.TextRange;
+import org.eclipse.jpt.core.context.PrimaryKeyJoinColumn;
import org.eclipse.jpt.core.context.orm.OrmAbstractJoinColumn;
import org.eclipse.jpt.core.context.orm.OrmJpaContextNode;
import org.eclipse.jpt.core.context.orm.OrmPrimaryKeyJoinColumn;
@@ -30,6 +31,11 @@ public class GenericOrmPrimaryKeyJoinColumn extends AbstractOrmNamedColumn<XmlPr
super(parent, owner);
}
+ public void initializeFrom(PrimaryKeyJoinColumn oldPkJoinColumn) {
+ super.initializeFrom(oldPkJoinColumn);
+ setSpecifiedReferencedColumnName(oldPkJoinColumn.getSpecifiedReferencedColumnName());
+ }
+
@Override
protected XmlPrimaryKeyJoinColumn columnResource() {
return this.primaryKeyJoinColumn;
@@ -61,6 +67,12 @@ public class GenericOrmPrimaryKeyJoinColumn extends AbstractOrmNamedColumn<XmlPr
columnResource().setReferencedColumnName(newSpecifiedReferencedColumnName);
firePropertyChanged(SPECIFIED_REFERENCED_COLUMN_NAME_PROPERTY, oldSpecifiedReferencedColumnName, newSpecifiedReferencedColumnName);
}
+
+ protected void setSpecifiedReferencedColumnName_(String newSpecifiedReferencedColumnName) {
+ String oldSpecifiedReferencedColumnName = this.specifiedReferencedColumnName;
+ this.specifiedReferencedColumnName = newSpecifiedReferencedColumnName;
+ firePropertyChanged(SPECIFIED_REFERENCED_COLUMN_NAME_PROPERTY, oldSpecifiedReferencedColumnName, newSpecifiedReferencedColumnName);
+ }
public String getDefaultReferencedColumnName() {
return this.defaultReferencedColumnName;
@@ -111,7 +123,7 @@ public class GenericOrmPrimaryKeyJoinColumn extends AbstractOrmNamedColumn<XmlPr
public void initialize(XmlPrimaryKeyJoinColumn column) {
this.primaryKeyJoinColumn = column;
super.initialize(column);
- this.specifiedReferencedColumnName = column.getReferencedColumnName();
+ this.specifiedReferencedColumnName = specifiedReferencedColumnName(column);
this.defaultReferencedColumnName = defaultReferencedColumnName();
}
@@ -119,12 +131,16 @@ public class GenericOrmPrimaryKeyJoinColumn extends AbstractOrmNamedColumn<XmlPr
public void update(XmlPrimaryKeyJoinColumn column) {
this.primaryKeyJoinColumn = column;
super.update(column);
- this.setSpecifiedReferencedColumnName(column.getReferencedColumnName());
+ this.setSpecifiedReferencedColumnName_(specifiedReferencedColumnName(column));
this.setDefaultReferencedColumnName(defaultReferencedColumnName());
}
+ protected String specifiedReferencedColumnName(XmlPrimaryKeyJoinColumn column) {
+ return column == null ? null : column.getReferencedColumnName();
+ }
+
+ //TODO not correct when we start supporting primaryKeyJoinColumns in 1-1 mappings
protected String defaultReferencedColumnName() {
- //TODO
- return null;
+ return defaultName();
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmSecondaryTable.java
index e69565f337..100200b5b8 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmSecondaryTable.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmSecondaryTable.java
@@ -1,8 +1,8 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0, which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/epl-v10.html.
+ * Copyright (c) 2007, 2008 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
*
* Contributors:
* Oracle - initial API and implementation
@@ -14,6 +14,7 @@ import java.util.List;
import java.util.ListIterator;
import org.eclipse.jpt.core.TextRange;
import org.eclipse.jpt.core.context.AbstractJoinColumn;
+import org.eclipse.jpt.core.context.Entity;
import org.eclipse.jpt.core.context.PrimaryKeyJoinColumn;
import org.eclipse.jpt.core.context.SecondaryTable;
import org.eclipse.jpt.core.context.TypeMapping;
@@ -29,6 +30,8 @@ import org.eclipse.jpt.core.resource.orm.XmlSecondaryTable;
import org.eclipse.jpt.db.internal.Table;
import org.eclipse.jpt.utility.internal.CollectionTools;
import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator;
+import org.eclipse.jpt.utility.internal.iterators.SingleElementListIterator;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
@@ -39,13 +42,20 @@ public class GenericOrmSecondaryTable extends AbstractOrmTable
protected final List<OrmPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns;
- protected final List<OrmPrimaryKeyJoinColumn> defaultPrimaryKeyJoinColumns;
+ protected OrmPrimaryKeyJoinColumn defaultPrimaryKeyJoinColumn;
- public GenericOrmSecondaryTable(OrmEntity parent) {
+ public GenericOrmSecondaryTable(OrmEntity parent, XmlSecondaryTable xmlSecondaryTable) {
super(parent);
this.specifiedPrimaryKeyJoinColumns = new ArrayList<OrmPrimaryKeyJoinColumn>();
- this.defaultPrimaryKeyJoinColumns = new ArrayList<OrmPrimaryKeyJoinColumn>();
-// this.getDefaultPrimaryKeyJoinColumns().add(this.createPrimaryKeyJoinColumn(0));
+ initialize(xmlSecondaryTable);
+ }
+
+ public void initializeFrom(SecondaryTable oldSecondaryTable) {
+ super.initializeFrom(oldSecondaryTable);
+ for (PrimaryKeyJoinColumn oldPkJoinColumn : CollectionTools.iterable(oldSecondaryTable.specifiedPrimaryKeyJoinColumns())) {
+ OrmPrimaryKeyJoinColumn newPkJoinColumn = addSpecifiedPrimaryKeyJoinColumn(specifiedPrimaryKeyJoinColumnsSize());
+ newPkJoinColumn.initializeFrom(oldPkJoinColumn);
+ }
}
@Override
@@ -56,20 +66,25 @@ public class GenericOrmSecondaryTable extends AbstractOrmTable
public OrmEntity ormEntity() {
return parent();
}
-
- public ListIterator<OrmPrimaryKeyJoinColumn> defaultPrimaryKeyJoinColumns() {
- return new CloneListIterator<OrmPrimaryKeyJoinColumn>(this.defaultPrimaryKeyJoinColumns);
- }
-
+
public OrmPrimaryKeyJoinColumn getDefaultPrimaryKeyJoinColumn() {
- // TODO Auto-generated method stub
- return null;
+ return this.defaultPrimaryKeyJoinColumn;
+ }
+
+ protected void setDefaultPrimaryKeyJoinColumn(OrmPrimaryKeyJoinColumn newPkJoinColumn) {
+ OrmPrimaryKeyJoinColumn oldPkJoinColumn = this.defaultPrimaryKeyJoinColumn;
+ this.defaultPrimaryKeyJoinColumn = newPkJoinColumn;
+ firePropertyChanged(SecondaryTable.DEFAULT_PRIMARY_KEY_JOIN_COLUMN, oldPkJoinColumn, newPkJoinColumn);
}
public ListIterator<OrmPrimaryKeyJoinColumn> primaryKeyJoinColumns() {
- return this.specifiedPrimaryKeyJoinColumns.isEmpty() ? this.defaultPrimaryKeyJoinColumns() : this.specifiedPrimaryKeyJoinColumns();
+ return this.containsSpecifiedPrimaryKeyJoinColumns() ? this.specifiedPrimaryKeyJoinColumns() : this.defaultPrimaryKeyJoinColumns();
}
+ public int primaryKeyJoinColumnsSize() {
+ return this.containsSpecifiedPrimaryKeyJoinColumns() ? this.specifiedPrimaryKeyJoinColumnsSize() : this.defaultPrimaryKeyJoinColumnsSize();
+ }
+
public ListIterator<OrmPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns() {
return new CloneListIterator<OrmPrimaryKeyJoinColumn>(this.specifiedPrimaryKeyJoinColumns);
}
@@ -78,12 +93,15 @@ public class GenericOrmSecondaryTable extends AbstractOrmTable
return this.specifiedPrimaryKeyJoinColumns.size();
}
- public int defaultPrimaryKeyJoinColumnsSize() {
- return this.defaultPrimaryKeyJoinColumns.size();
+ protected ListIterator<OrmPrimaryKeyJoinColumn> defaultPrimaryKeyJoinColumns() {
+ if (this.defaultPrimaryKeyJoinColumn != null) {
+ return new SingleElementListIterator<OrmPrimaryKeyJoinColumn>(this.defaultPrimaryKeyJoinColumn);
+ }
+ return EmptyListIterator.instance();
}
- public int primaryKeyJoinColumnsSize() {
- return this.containsSpecifiedPrimaryKeyJoinColumns() ? this.specifiedPrimaryKeyJoinColumnsSize() : this.defaultPrimaryKeyJoinColumnsSize();
+ protected int defaultPrimaryKeyJoinColumnsSize() {
+ return (this.defaultPrimaryKeyJoinColumn == null) ? 0 : 1;
}
public boolean containsSpecifiedPrimaryKeyJoinColumns() {
@@ -91,10 +109,24 @@ public class GenericOrmSecondaryTable extends AbstractOrmTable
}
public OrmPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index) {
+ OrmPrimaryKeyJoinColumn oldDefaultPkJoinColumn = this.getDefaultPrimaryKeyJoinColumn();
+ if (oldDefaultPkJoinColumn != null) {
+ //null the default join column now if one already exists.
+ //if one does not exist, there is already a specified join column.
+ //Remove it now so that it doesn't get removed during an update and
+ //cause change notifications to be sent to the UI in the wrong order
+ this.defaultPrimaryKeyJoinColumn = null;
+ }
+ XmlPrimaryKeyJoinColumn xmlPrimaryKeyJoinColumn = OrmFactory.eINSTANCE.createXmlPrimaryKeyJoinColumnImpl();
OrmPrimaryKeyJoinColumn primaryKeyJoinColumn = jpaFactory().buildOrmPrimaryKeyJoinColumn(this, createPrimaryKeyJoinColumnOwner());
+ primaryKeyJoinColumn.initialize(xmlPrimaryKeyJoinColumn);
this.specifiedPrimaryKeyJoinColumns.add(index, primaryKeyJoinColumn);
- this.secondaryTable.getPrimaryKeyJoinColumns().add(index, OrmFactory.eINSTANCE.createXmlPrimaryKeyJoinColumn());
+ this.secondaryTable.getPrimaryKeyJoinColumns().add(index, xmlPrimaryKeyJoinColumn);
+
this.fireItemAdded(SecondaryTable.SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST, index, primaryKeyJoinColumn);
+ if (oldDefaultPkJoinColumn != null) {
+ this.firePropertyChanged(SecondaryTable.DEFAULT_PRIMARY_KEY_JOIN_COLUMN, oldDefaultPkJoinColumn, null);
+ }
return primaryKeyJoinColumn;
}
@@ -112,8 +144,18 @@ public class GenericOrmSecondaryTable extends AbstractOrmTable
public void removeSpecifiedPrimaryKeyJoinColumn(int index) {
OrmPrimaryKeyJoinColumn removedPrimaryKeyJoinColumn = this.specifiedPrimaryKeyJoinColumns.remove(index);
+ if (!containsSpecifiedPrimaryKeyJoinColumns()) {
+ //create the defaultJoinColumn now or this will happen during project update
+ //after removing the join column from the resource model. That causes problems
+ //in the UI because the change notifications end up in the wrong order.
+ this.defaultPrimaryKeyJoinColumn = createPrimaryKeyJoinColumn(null);
+ }
this.secondaryTable.getPrimaryKeyJoinColumns().remove(index);
fireItemRemoved(SecondaryTable.SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST, index, removedPrimaryKeyJoinColumn);
+ if (this.defaultPrimaryKeyJoinColumn != null) {
+ //fire change notification if a defaultJoinColumn was created above
+ this.firePropertyChanged(Entity.DEFAULT_PRIMARY_KEY_JOIN_COLUMN, null, this.defaultPrimaryKeyJoinColumn);
+ }
}
protected void removeSpecifiedPrimaryKeyJoinColumn_(OrmPrimaryKeyJoinColumn primaryKeyJoinColumn) {
@@ -148,10 +190,11 @@ public class GenericOrmSecondaryTable extends AbstractOrmTable
return this.secondaryTable;
}
- public void initialize(XmlSecondaryTable secondaryTable) {
+ protected void initialize(XmlSecondaryTable secondaryTable) {
this.secondaryTable = secondaryTable;
super.initialize(secondaryTable);
this.initializeSpecifiedPrimaryKeyJoinColumns(secondaryTable);
+ this.initializeDefaultPrimaryKeyJoinColumn(secondaryTable);
}
protected void initializeSpecifiedPrimaryKeyJoinColumns(XmlSecondaryTable secondaryTable) {
@@ -160,10 +203,23 @@ public class GenericOrmSecondaryTable extends AbstractOrmTable
}
}
+ protected boolean shouldBuildDefaultPrimaryKeyJoinColumn() {
+ return !containsSpecifiedPrimaryKeyJoinColumns();
+ }
+
+ protected void initializeDefaultPrimaryKeyJoinColumn(XmlSecondaryTable secondaryTable) {
+ if (!shouldBuildDefaultPrimaryKeyJoinColumn()) {
+ return;
+ }
+ this.defaultPrimaryKeyJoinColumn = this.jpaFactory().buildOrmPrimaryKeyJoinColumn(this, createPrimaryKeyJoinColumnOwner());
+ this.defaultPrimaryKeyJoinColumn.initialize(null);
+ }
+
public void update(XmlSecondaryTable secondaryTable) {
this.secondaryTable = secondaryTable;
super.update(secondaryTable);
this.updateSpecifiedPrimaryKeyJoinColumns(secondaryTable);
+ this.updateDefaultPrimaryKeyJoinColumn(secondaryTable);
}
protected void updateSpecifiedPrimaryKeyJoinColumns(XmlSecondaryTable secondaryTable) {
@@ -185,6 +241,21 @@ public class GenericOrmSecondaryTable extends AbstractOrmTable
}
}
+ protected void updateDefaultPrimaryKeyJoinColumn(XmlSecondaryTable secondaryTable) {
+ if (!shouldBuildDefaultPrimaryKeyJoinColumn()) {
+ setDefaultPrimaryKeyJoinColumn(null);
+ return;
+ }
+ if (getDefaultPrimaryKeyJoinColumn() == null) {
+ OrmPrimaryKeyJoinColumn joinColumn = this.jpaFactory().buildOrmPrimaryKeyJoinColumn(this, createPrimaryKeyJoinColumnOwner());
+ joinColumn.initialize(null);
+ this.setDefaultPrimaryKeyJoinColumn(joinColumn);
+ }
+ else {
+ this.defaultPrimaryKeyJoinColumn.update(null);
+ }
+ }
+
protected OrmPrimaryKeyJoinColumn createPrimaryKeyJoinColumn(XmlPrimaryKeyJoinColumn primaryKeyJoinColumn) {
OrmPrimaryKeyJoinColumn ormPrimaryKeyJoinColumn = jpaFactory().buildOrmPrimaryKeyJoinColumn(this, createPrimaryKeyJoinColumnOwner());
ormPrimaryKeyJoinColumn.initialize(primaryKeyJoinColumn);
@@ -266,7 +337,7 @@ public class GenericOrmSecondaryTable extends AbstractOrmTable
}
public boolean isVirtual(AbstractJoinColumn joinColumn) {
- return GenericOrmSecondaryTable.this.defaultPrimaryKeyJoinColumns.contains(joinColumn);
+ return GenericOrmSecondaryTable.this.defaultPrimaryKeyJoinColumn == joinColumn;
}
public String defaultColumnName() {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlPrimaryKeyJoinColumn.java
new file mode 100644
index 0000000000..5d7c92f0ca
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlPrimaryKeyJoinColumn.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.core.internal.context.orm;
+
+import org.eclipse.jpt.core.TextRange;
+import org.eclipse.jpt.core.context.java.JavaPrimaryKeyJoinColumn;
+import org.eclipse.jpt.core.resource.common.AbstractJpaEObject;
+import org.eclipse.jpt.core.resource.orm.XmlPrimaryKeyJoinColumn;
+
+/**
+ * A virtual primary key join column is used to represent the XmlPrimaryKeyJoinColumn resource object
+ * within a virtual secondary table. A virtual secondary table is one which is not specified
+ * in the orm.xml file, but is implied from the underlying java. Virtual pk join column
+ * is not used when the secondary table is specified in the orm.xml.
+ *
+ * A virtual pk join column delegates to the underlying java pk join column for its state.
+ */
+public class VirtualXmlPrimaryKeyJoinColumn extends AbstractJpaEObject implements XmlPrimaryKeyJoinColumn
+{
+
+ protected JavaPrimaryKeyJoinColumn javaPrimaryKeyJoinColumn;
+
+
+ protected VirtualXmlPrimaryKeyJoinColumn(JavaPrimaryKeyJoinColumn javaPrimaryKeyJoinColumn) {
+ super();
+ this.javaPrimaryKeyJoinColumn = javaPrimaryKeyJoinColumn;
+ }
+
+ public String getName() {
+ return this.javaPrimaryKeyJoinColumn.getName();
+ }
+
+ public void setName(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public String getColumnDefinition() {
+ return this.javaPrimaryKeyJoinColumn.getColumnDefinition();
+ }
+
+ public void setColumnDefinition(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public String getReferencedColumnName() {
+ return this.javaPrimaryKeyJoinColumn.getReferencedColumnName();
+ }
+
+ public void setReferencedColumnName(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public TextRange nameTextRange() {
+ return null;
+ }
+
+ public TextRange referencedColumnNameTextRange() {
+ return null;
+ }
+
+ public void update(JavaPrimaryKeyJoinColumn javaPrimaryKeyJoinColumn) {
+ this.javaPrimaryKeyJoinColumn = javaPrimaryKeyJoinColumn;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlSecondaryTable.java
index 5783fa462b..4be8595812 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlSecondaryTable.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualXmlSecondaryTable.java
@@ -12,13 +12,23 @@ package org.eclipse.jpt.core.internal.context.orm;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.jpt.core.TextRange;
+import org.eclipse.jpt.core.context.java.JavaPrimaryKeyJoinColumn;
import org.eclipse.jpt.core.context.java.JavaSecondaryTable;
import org.eclipse.jpt.core.resource.common.AbstractJpaEObject;
import org.eclipse.jpt.core.resource.orm.OrmPackage;
import org.eclipse.jpt.core.resource.orm.UniqueConstraint;
import org.eclipse.jpt.core.resource.orm.XmlPrimaryKeyJoinColumn;
import org.eclipse.jpt.core.resource.orm.XmlSecondaryTable;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+/**
+ * A virtual secondary table is used to represent the XmlSecondaryTable resource object.
+ * A virtual secondary table is one which is not specified in the orm.xml file,
+ * but is implied from the underlying java. Virtual secondary table
+ * is not used when the secondary table is specified in the orm.xml.
+ *
+ * A virtual secondary table delegates to the underlying java secondary table for its state.
+ */
public class VirtualXmlSecondaryTable extends AbstractJpaEObject implements XmlSecondaryTable
{
@@ -62,6 +72,11 @@ public class VirtualXmlSecondaryTable extends AbstractJpaEObject implements XmlS
{
primaryKeyJoinColumns = new EObjectContainmentEList<XmlPrimaryKeyJoinColumn>(XmlPrimaryKeyJoinColumn.class, this, OrmPackage.XML_SECONDARY_TABLE_IMPL__PRIMARY_KEY_JOIN_COLUMNS);
}
+ for (JavaPrimaryKeyJoinColumn pkJoinColumn : CollectionTools.iterable(javaSecondaryTable.specifiedPrimaryKeyJoinColumns())) {
+ XmlPrimaryKeyJoinColumn xmlPkJoinColumn = new VirtualXmlPrimaryKeyJoinColumn(pkJoinColumn);
+ primaryKeyJoinColumns.add(xmlPkJoinColumn);
+ }
+
return primaryKeyJoinColumns;
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/GenericJpaFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/GenericJpaFactory.java
index 9daa4c4eca..87f561434b 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/GenericJpaFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/GenericJpaFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -194,6 +194,7 @@ import org.eclipse.jpt.core.resource.orm.OrmResourceModel;
import org.eclipse.jpt.core.resource.orm.XmlAssociationOverride;
import org.eclipse.jpt.core.resource.orm.XmlAttributeOverride;
import org.eclipse.jpt.core.resource.orm.XmlEntityMappings;
+import org.eclipse.jpt.core.resource.orm.XmlSecondaryTable;
import org.eclipse.jpt.core.resource.persistence.PersistenceResource;
import org.eclipse.jpt.core.resource.persistence.PersistenceResourceModel;
import org.eclipse.jpt.core.resource.persistence.XmlJavaClassRef;
@@ -504,8 +505,8 @@ public class GenericJpaFactory implements JpaFactory
return new GenericOrmTable(parent);
}
- public OrmSecondaryTable buildOrmSecondaryTable(OrmEntity parent) {
- return new GenericOrmSecondaryTable(parent);
+ public OrmSecondaryTable buildOrmSecondaryTable(OrmEntity parent, XmlSecondaryTable xmlSecondaryTable) {
+ return new GenericOrmSecondaryTable(parent, xmlSecondaryTable);
}
public OrmPrimaryKeyJoinColumn buildOrmPrimaryKeyJoinColumn(OrmJpaContextNode parent, OrmAbstractJoinColumn.Owner owner) {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/PrimaryKeyJoinColumnTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/PrimaryKeyJoinColumnTranslator.java
index 236324d307..3ab0f25fa7 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/PrimaryKeyJoinColumnTranslator.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/PrimaryKeyJoinColumnTranslator.java
@@ -9,7 +9,9 @@
******************************************************************************/
package org.eclipse.jpt.core.internal.resource.orm.translators;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jpt.core.resource.orm.OrmFactory;
import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
import org.eclipse.wst.common.internal.emf.resource.Translator;
@@ -24,6 +26,11 @@ public class PrimaryKeyJoinColumnTranslator extends Translator
}
@Override
+ public EObject createEMFObject(String nodeName, String readAheadName) {
+ return OrmFactory.eINSTANCE.createXmlPrimaryKeyJoinColumnImpl();
+ }
+
+ @Override
public Translator[] getChildren(Object target, int versionID) {
if (this.children == null) {
this.children = createChildren();
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/OrmFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/OrmFactory.java
index b95617e455..c99bdf5300 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/OrmFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/OrmFactory.java
@@ -129,7 +129,7 @@ public class OrmFactory extends EFactoryImpl
case OrmPackage.PRE_PERSIST: return (EObject)createPrePersist();
case OrmPackage.PRE_REMOVE: return (EObject)createPreRemove();
case OrmPackage.PRE_UPDATE: return (EObject)createPreUpdate();
- case OrmPackage.XML_PRIMARY_KEY_JOIN_COLUMN: return (EObject)createXmlPrimaryKeyJoinColumn();
+ case OrmPackage.XML_PRIMARY_KEY_JOIN_COLUMN_IMPL: return (EObject)createXmlPrimaryKeyJoinColumnImpl();
case OrmPackage.XML_QUERY_HINT: return (EObject)createXmlQueryHint();
case OrmPackage.XML_TABLE: return (EObject)createXmlTable();
case OrmPackage.XML_SECONDARY_TABLE_IMPL: return (EObject)createXmlSecondaryTableImpl();
@@ -705,10 +705,10 @@ public class OrmFactory extends EFactoryImpl
* <!-- end-user-doc -->
* @generated
*/
- public XmlPrimaryKeyJoinColumn createXmlPrimaryKeyJoinColumn()
+ public XmlPrimaryKeyJoinColumnImpl createXmlPrimaryKeyJoinColumnImpl()
{
- XmlPrimaryKeyJoinColumn xmlPrimaryKeyJoinColumn = new XmlPrimaryKeyJoinColumn();
- return xmlPrimaryKeyJoinColumn;
+ XmlPrimaryKeyJoinColumnImpl xmlPrimaryKeyJoinColumnImpl = new XmlPrimaryKeyJoinColumnImpl();
+ return xmlPrimaryKeyJoinColumnImpl;
}
/**
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/OrmPackage.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/OrmPackage.java
index 0217cc0121..9de6569f0d 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/OrmPackage.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/OrmPackage.java
@@ -4041,7 +4041,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlBaseTable()
* @generated
*/
- public static final int XML_BASE_TABLE = 76;
+ public static final int XML_BASE_TABLE = 77;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
@@ -4169,7 +4169,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getAbstractXmlBaseTable()
* @generated
*/
- public static final int ABSTRACT_XML_BASE_TABLE = 75;
+ public static final int ABSTRACT_XML_BASE_TABLE = 76;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
@@ -4713,7 +4713,7 @@ public class OrmPackage extends EPackageImpl
* @generated
* @ordered
*/
- public static final int XML_PRIMARY_KEY_JOIN_COLUMN__COLUMN_DEFINITION = ABSTRACT_XML_NAMED_COLUMN__COLUMN_DEFINITION;
+ public static final int XML_PRIMARY_KEY_JOIN_COLUMN__COLUMN_DEFINITION = XML_NAMED_COLUMN__COLUMN_DEFINITION;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
@@ -4722,7 +4722,7 @@ public class OrmPackage extends EPackageImpl
* @generated
* @ordered
*/
- public static final int XML_PRIMARY_KEY_JOIN_COLUMN__NAME = ABSTRACT_XML_NAMED_COLUMN__NAME;
+ public static final int XML_PRIMARY_KEY_JOIN_COLUMN__NAME = XML_NAMED_COLUMN__NAME;
/**
* The feature id for the '<em><b>Referenced Column Name</b></em>' attribute.
@@ -4731,7 +4731,7 @@ public class OrmPackage extends EPackageImpl
* @generated
* @ordered
*/
- public static final int XML_PRIMARY_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME = ABSTRACT_XML_NAMED_COLUMN_FEATURE_COUNT + 0;
+ public static final int XML_PRIMARY_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME = XML_NAMED_COLUMN_FEATURE_COUNT + 0;
/**
* The number of structural features of the '<em>Xml Primary Key Join Column</em>' class.
@@ -4740,7 +4740,53 @@ public class OrmPackage extends EPackageImpl
* @generated
* @ordered
*/
- public static final int XML_PRIMARY_KEY_JOIN_COLUMN_FEATURE_COUNT = ABSTRACT_XML_NAMED_COLUMN_FEATURE_COUNT + 1;
+ public static final int XML_PRIMARY_KEY_JOIN_COLUMN_FEATURE_COUNT = XML_NAMED_COLUMN_FEATURE_COUNT + 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.resource.orm.XmlPrimaryKeyJoinColumnImpl <em>Xml Primary Key Join Column Impl</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.resource.orm.XmlPrimaryKeyJoinColumnImpl
+ * @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlPrimaryKeyJoinColumnImpl()
+ * @generated
+ */
+ public static final int XML_PRIMARY_KEY_JOIN_COLUMN_IMPL = 74;
+
+ /**
+ * The feature id for the '<em><b>Column Definition</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_PRIMARY_KEY_JOIN_COLUMN_IMPL__COLUMN_DEFINITION = ABSTRACT_XML_NAMED_COLUMN__COLUMN_DEFINITION;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_PRIMARY_KEY_JOIN_COLUMN_IMPL__NAME = ABSTRACT_XML_NAMED_COLUMN__NAME;
+
+ /**
+ * The feature id for the '<em><b>Referenced Column Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_PRIMARY_KEY_JOIN_COLUMN_IMPL__REFERENCED_COLUMN_NAME = ABSTRACT_XML_NAMED_COLUMN_FEATURE_COUNT + 0;
+
+ /**
+ * The number of structural features of the '<em>Xml Primary Key Join Column Impl</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_PRIMARY_KEY_JOIN_COLUMN_IMPL_FEATURE_COUNT = ABSTRACT_XML_NAMED_COLUMN_FEATURE_COUNT + 1;
/**
* The meta object id for the '{@link org.eclipse.jpt.core.resource.orm.XmlQueryHint <em>Xml Query Hint</em>}' class.
@@ -4750,7 +4796,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlQueryHint()
* @generated
*/
- public static final int XML_QUERY_HINT = 74;
+ public static final int XML_QUERY_HINT = 75;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
@@ -4787,7 +4833,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlTable()
* @generated
*/
- public static final int XML_TABLE = 77;
+ public static final int XML_TABLE = 78;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
@@ -4842,7 +4888,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlSecondaryTable()
* @generated
*/
- public static final int XML_SECONDARY_TABLE = 78;
+ public static final int XML_SECONDARY_TABLE = 79;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
@@ -4906,7 +4952,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlSecondaryTableImpl()
* @generated
*/
- public static final int XML_SECONDARY_TABLE_IMPL = 79;
+ public static final int XML_SECONDARY_TABLE_IMPL = 80;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
@@ -4970,7 +5016,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlGenerator()
* @generated
*/
- public static final int XML_GENERATOR = 80;
+ public static final int XML_GENERATOR = 81;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
@@ -5016,7 +5062,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlSequenceGenerator()
* @generated
*/
- public static final int XML_SEQUENCE_GENERATOR = 81;
+ public static final int XML_SEQUENCE_GENERATOR = 82;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
@@ -5071,7 +5117,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlSequenceGeneratorImpl()
* @generated
*/
- public static final int XML_SEQUENCE_GENERATOR_IMPL = 82;
+ public static final int XML_SEQUENCE_GENERATOR_IMPL = 83;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
@@ -5126,7 +5172,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getSqlResultSetMapping()
* @generated
*/
- public static final int SQL_RESULT_SET_MAPPING = 83;
+ public static final int SQL_RESULT_SET_MAPPING = 84;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
@@ -5172,7 +5218,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlTableGenerator()
* @generated
*/
- public static final int XML_TABLE_GENERATOR = 84;
+ public static final int XML_TABLE_GENERATOR = 85;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
@@ -5281,7 +5327,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlTableGeneratorImpl()
* @generated
*/
- public static final int XML_TABLE_GENERATOR_IMPL = 85;
+ public static final int XML_TABLE_GENERATOR_IMPL = 86;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
@@ -5390,7 +5436,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getUniqueConstraint()
* @generated
*/
- public static final int UNIQUE_CONSTRAINT = 86;
+ public static final int UNIQUE_CONSTRAINT = 87;
/**
* The feature id for the '<em><b>Column Names</b></em>' attribute list.
@@ -5418,7 +5464,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getAccessType()
* @generated
*/
- public static final int ACCESS_TYPE = 87;
+ public static final int ACCESS_TYPE = 88;
/**
* The meta object id for the '{@link org.eclipse.jpt.core.resource.orm.DiscriminatorType <em>Discriminator Type</em>}' enum.
@@ -5428,7 +5474,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getDiscriminatorType()
* @generated
*/
- public static final int DISCRIMINATOR_TYPE = 88;
+ public static final int DISCRIMINATOR_TYPE = 89;
/**
* The meta object id for the '{@link org.eclipse.jpt.core.resource.orm.EnumType <em>Enum Type</em>}' enum.
@@ -5438,7 +5484,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getEnumType()
* @generated
*/
- public static final int ENUM_TYPE = 89;
+ public static final int ENUM_TYPE = 90;
/**
* The meta object id for the '{@link org.eclipse.jpt.core.resource.orm.FetchType <em>Fetch Type</em>}' enum.
@@ -5448,7 +5494,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getFetchType()
* @generated
*/
- public static final int FETCH_TYPE = 90;
+ public static final int FETCH_TYPE = 91;
/**
* The meta object id for the '{@link org.eclipse.jpt.core.resource.orm.GenerationType <em>Generation Type</em>}' enum.
@@ -5458,7 +5504,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getGenerationType()
* @generated
*/
- public static final int GENERATION_TYPE = 91;
+ public static final int GENERATION_TYPE = 92;
/**
* The meta object id for the '{@link org.eclipse.jpt.core.resource.orm.InheritanceType <em>Inheritance Type</em>}' enum.
@@ -5468,7 +5514,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getInheritanceType()
* @generated
*/
- public static final int INHERITANCE_TYPE = 92;
+ public static final int INHERITANCE_TYPE = 93;
/**
* The meta object id for the '{@link org.eclipse.jpt.core.resource.orm.TemporalType <em>Temporal Type</em>}' enum.
@@ -5478,7 +5524,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getTemporalType()
* @generated
*/
- public static final int TEMPORAL_TYPE = 93;
+ public static final int TEMPORAL_TYPE = 94;
/**
* The meta object id for the '<em>Discriminator Value</em>' data type.
@@ -5488,7 +5534,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getDiscriminatorValue()
* @generated
*/
- public static final int DISCRIMINATOR_VALUE = 94;
+ public static final int DISCRIMINATOR_VALUE = 95;
/**
* The meta object id for the '<em>Enumerated</em>' data type.
@@ -5498,7 +5544,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getEnumerated()
* @generated
*/
- public static final int ENUMERATED = 95;
+ public static final int ENUMERATED = 96;
/**
* The meta object id for the '<em>Order By</em>' data type.
@@ -5508,7 +5554,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getOrderBy()
* @generated
*/
- public static final int ORDER_BY = 96;
+ public static final int ORDER_BY = 97;
/**
* The meta object id for the '<em>Version Type</em>' data type.
@@ -5518,7 +5564,7 @@ public class OrmPackage extends EPackageImpl
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getVersionType()
* @generated
*/
- public static final int VERSION_TYPE = 97;
+ public static final int VERSION_TYPE = 98;
/**
* <!-- begin-user-doc -->
@@ -6043,6 +6089,13 @@ public class OrmPackage extends EPackageImpl
* <!-- end-user-doc -->
* @generated
*/
+ private EClass xmlPrimaryKeyJoinColumnImplEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
private EClass xmlQueryHintEClass = null;
/**
@@ -9525,6 +9578,20 @@ public class OrmPackage extends EPackageImpl
/**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.resource.orm.XmlPrimaryKeyJoinColumnImpl <em>Xml Primary Key Join Column Impl</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Primary Key Join Column Impl</em>'.
+ * @see org.eclipse.jpt.core.resource.orm.XmlPrimaryKeyJoinColumnImpl
+ * @generated
+ */
+ public EClass getXmlPrimaryKeyJoinColumnImpl()
+ {
+ return xmlPrimaryKeyJoinColumnImplEClass;
+ }
+
+
+ /**
* Returns the meta object for class '{@link org.eclipse.jpt.core.resource.orm.XmlQueryHint <em>Xml Query Hint</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -10507,6 +10574,8 @@ public class OrmPackage extends EPackageImpl
xmlPrimaryKeyJoinColumnEClass = createEClass(XML_PRIMARY_KEY_JOIN_COLUMN);
createEAttribute(xmlPrimaryKeyJoinColumnEClass, XML_PRIMARY_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME);
+ xmlPrimaryKeyJoinColumnImplEClass = createEClass(XML_PRIMARY_KEY_JOIN_COLUMN_IMPL);
+
xmlQueryHintEClass = createEClass(XML_QUERY_HINT);
createEAttribute(xmlQueryHintEClass, XML_QUERY_HINT__NAME);
createEAttribute(xmlQueryHintEClass, XML_QUERY_HINT__VALUE);
@@ -10670,7 +10739,9 @@ public class OrmPackage extends EPackageImpl
prePersistEClass.getESuperTypes().add(this.getEventMethod());
preRemoveEClass.getESuperTypes().add(this.getEventMethod());
preUpdateEClass.getESuperTypes().add(this.getEventMethod());
- xmlPrimaryKeyJoinColumnEClass.getESuperTypes().add(this.getAbstractXmlNamedColumn());
+ xmlPrimaryKeyJoinColumnEClass.getESuperTypes().add(this.getXmlNamedColumn());
+ xmlPrimaryKeyJoinColumnImplEClass.getESuperTypes().add(this.getAbstractXmlNamedColumn());
+ xmlPrimaryKeyJoinColumnImplEClass.getESuperTypes().add(this.getXmlPrimaryKeyJoinColumn());
abstractXmlBaseTableEClass.getESuperTypes().add(this.getXmlBaseTable());
xmlTableEClass.getESuperTypes().add(this.getAbstractXmlBaseTable());
xmlSecondaryTableEClass.getESuperTypes().add(this.getXmlBaseTable());
@@ -10977,9 +11048,11 @@ public class OrmPackage extends EPackageImpl
initEClass(preUpdateEClass, PreUpdate.class, "PreUpdate", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(xmlPrimaryKeyJoinColumnEClass, XmlPrimaryKeyJoinColumn.class, "XmlPrimaryKeyJoinColumn", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEClass(xmlPrimaryKeyJoinColumnEClass, XmlPrimaryKeyJoinColumn.class, "XmlPrimaryKeyJoinColumn", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getXmlPrimaryKeyJoinColumn_ReferencedColumnName(), theXMLTypePackage.getString(), "referencedColumnName", null, 0, 1, XmlPrimaryKeyJoinColumn.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEClass(xmlPrimaryKeyJoinColumnImplEClass, XmlPrimaryKeyJoinColumnImpl.class, "XmlPrimaryKeyJoinColumnImpl", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
initEClass(xmlQueryHintEClass, XmlQueryHint.class, "XmlQueryHint", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getXmlQueryHint_Name(), theXMLTypePackage.getString(), "name", null, 1, 1, XmlQueryHint.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getXmlQueryHint_Value(), theXMLTypePackage.getString(), "value", null, 1, 1, XmlQueryHint.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
@@ -13027,6 +13100,16 @@ public class OrmPackage extends EPackageImpl
public static final EAttribute XML_PRIMARY_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME = eINSTANCE.getXmlPrimaryKeyJoinColumn_ReferencedColumnName();
/**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.resource.orm.XmlPrimaryKeyJoinColumnImpl <em>Xml Primary Key Join Column Impl</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.resource.orm.XmlPrimaryKeyJoinColumnImpl
+ * @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlPrimaryKeyJoinColumnImpl()
+ * @generated
+ */
+ public static final EClass XML_PRIMARY_KEY_JOIN_COLUMN_IMPL = eINSTANCE.getXmlPrimaryKeyJoinColumnImpl();
+
+ /**
* The meta object literal for the '{@link org.eclipse.jpt.core.resource.orm.XmlQueryHint <em>Xml Query Hint</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlPrimaryKeyJoinColumn.java
index 440d4d1ea0..64db56d964 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlPrimaryKeyJoinColumn.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlPrimaryKeyJoinColumn.java
@@ -9,13 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.core.resource.orm;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.jpt.core.TextRange;
-import org.eclipse.jpt.core.internal.emfutility.DOMUtilities;
-import org.eclipse.jpt.core.internal.resource.orm.translators.OrmXmlMapper;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
/**
* <!-- begin-user-doc -->
@@ -36,51 +30,11 @@ import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
* </p>
*
* @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlPrimaryKeyJoinColumn()
- * @model kind="class"
+ * @model kind="class" interface="true" abstract="true"
* @generated
*/
-public class XmlPrimaryKeyJoinColumn extends AbstractXmlNamedColumn
+public interface XmlPrimaryKeyJoinColumn extends XmlNamedColumn
{
- /**
- * The default value of the '{@link #getReferencedColumnName() <em>Referenced Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getReferencedColumnName()
- * @generated
- * @ordered
- */
- protected static final String REFERENCED_COLUMN_NAME_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getReferencedColumnName() <em>Referenced Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getReferencedColumnName()
- * @generated
- * @ordered
- */
- protected String referencedColumnName = REFERENCED_COLUMN_NAME_EDEFAULT;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected XmlPrimaryKeyJoinColumn()
- {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass()
- {
- return OrmPackage.Literals.XML_PRIMARY_KEY_JOIN_COLUMN;
- }
/**
* Returns the value of the '<em><b>Referenced Column Name</b></em>' attribute.
@@ -96,10 +50,7 @@ public class XmlPrimaryKeyJoinColumn extends AbstractXmlNamedColumn
* @model dataType="org.eclipse.emf.ecore.xml.type.String"
* @generated
*/
- public String getReferencedColumnName()
- {
- return referencedColumnName;
- }
+ String getReferencedColumnName();
/**
* Sets the value of the '{@link org.eclipse.jpt.core.resource.orm.XmlPrimaryKeyJoinColumn#getReferencedColumnName <em>Referenced Column Name</em>}' attribute.
@@ -109,101 +60,13 @@ public class XmlPrimaryKeyJoinColumn extends AbstractXmlNamedColumn
* @see #getReferencedColumnName()
* @generated
*/
- public void setReferencedColumnName(String newReferencedColumnName)
- {
- String oldReferencedColumnName = referencedColumnName;
- referencedColumnName = newReferencedColumnName;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_PRIMARY_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME, oldReferencedColumnName, referencedColumnName));
- }
+ void setReferencedColumnName(String value);
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType)
- {
- switch (featureID)
- {
- case OrmPackage.XML_PRIMARY_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME:
- return getReferencedColumnName();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue)
- {
- switch (featureID)
- {
- case OrmPackage.XML_PRIMARY_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME:
- setReferencedColumnName((String)newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID)
- {
- switch (featureID)
- {
- case OrmPackage.XML_PRIMARY_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME:
- setReferencedColumnName(REFERENCED_COLUMN_NAME_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
/**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
+ * Return the {@link TextRange} for the referenced-column-name attibute. If the referenced-column-name attibute
+ * does not exist return the {@link TextRange} for the *table element.
*/
- @Override
- public boolean eIsSet(int featureID)
- {
- switch (featureID)
- {
- case OrmPackage.XML_PRIMARY_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME:
- return REFERENCED_COLUMN_NAME_EDEFAULT == null ? referencedColumnName != null : !REFERENCED_COLUMN_NAME_EDEFAULT.equals(referencedColumnName);
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString()
- {
- if (eIsProxy()) return super.toString();
-
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (referencedColumnName: ");
- result.append(referencedColumnName);
- result.append(')');
- return result.toString();
- }
-
- public TextRange referencedColumnNameTextRange() {
- IDOMNode referencedColumnNameNode = (IDOMNode) DOMUtilities.getChildAttributeNode(this.node, OrmXmlMapper.REFERENCED_COLUMN_NAME);
- return (referencedColumnNameNode == null) ? validationTextRange() : buildTextRange(referencedColumnNameNode);
- }
-
+ TextRange referencedColumnNameTextRange();
} // PrimaryKeyJoinColumn
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlPrimaryKeyJoinColumnImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlPrimaryKeyJoinColumnImpl.java
new file mode 100644
index 0000000000..ebfe2c2a4a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/orm/XmlPrimaryKeyJoinColumnImpl.java
@@ -0,0 +1,239 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.core.resource.orm;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.core.TextRange;
+import org.eclipse.jpt.core.internal.emfutility.DOMUtilities;
+import org.eclipse.jpt.core.internal.resource.orm.translators.OrmXmlMapper;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Xml Primary Key Join Column Impl</b></em>'.
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlPrimaryKeyJoinColumnImpl()
+ * @model kind="class"
+ * @generated
+ */
+public class XmlPrimaryKeyJoinColumnImpl extends AbstractXmlNamedColumn implements XmlPrimaryKeyJoinColumn
+{
+ /**
+ * The default value of the '{@link #getReferencedColumnName() <em>Referenced Column Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getReferencedColumnName()
+ * @generated
+ * @ordered
+ */
+ protected static final String REFERENCED_COLUMN_NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getReferencedColumnName() <em>Referenced Column Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getReferencedColumnName()
+ * @generated
+ * @ordered
+ */
+ protected String referencedColumnName = REFERENCED_COLUMN_NAME_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected XmlPrimaryKeyJoinColumnImpl()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.XML_PRIMARY_KEY_JOIN_COLUMN_IMPL;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Referenced Column Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Referenced Column Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Referenced Column Name</em>' attribute.
+ * @see #setReferencedColumnName(String)
+ * @see org.eclipse.jpt.core.resource.orm.OrmPackage#getXmlPrimaryKeyJoinColumn_ReferencedColumnName()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getReferencedColumnName()
+ {
+ return referencedColumnName;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.resource.orm.XmlPrimaryKeyJoinColumnImpl#getReferencedColumnName <em>Referenced Column Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Referenced Column Name</em>' attribute.
+ * @see #getReferencedColumnName()
+ * @generated
+ */
+ public void setReferencedColumnName(String newReferencedColumnName)
+ {
+ String oldReferencedColumnName = referencedColumnName;
+ referencedColumnName = newReferencedColumnName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_PRIMARY_KEY_JOIN_COLUMN_IMPL__REFERENCED_COLUMN_NAME, oldReferencedColumnName, referencedColumnName));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.XML_PRIMARY_KEY_JOIN_COLUMN_IMPL__REFERENCED_COLUMN_NAME:
+ return getReferencedColumnName();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.XML_PRIMARY_KEY_JOIN_COLUMN_IMPL__REFERENCED_COLUMN_NAME:
+ setReferencedColumnName((String)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.XML_PRIMARY_KEY_JOIN_COLUMN_IMPL__REFERENCED_COLUMN_NAME:
+ setReferencedColumnName(REFERENCED_COLUMN_NAME_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.XML_PRIMARY_KEY_JOIN_COLUMN_IMPL__REFERENCED_COLUMN_NAME:
+ return REFERENCED_COLUMN_NAME_EDEFAULT == null ? referencedColumnName != null : !REFERENCED_COLUMN_NAME_EDEFAULT.equals(referencedColumnName);
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass)
+ {
+ if (baseClass == XmlPrimaryKeyJoinColumn.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.XML_PRIMARY_KEY_JOIN_COLUMN_IMPL__REFERENCED_COLUMN_NAME: return OrmPackage.XML_PRIMARY_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME;
+ default: return -1;
+ }
+ }
+ return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass)
+ {
+ if (baseClass == XmlPrimaryKeyJoinColumn.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmPackage.XML_PRIMARY_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME: return OrmPackage.XML_PRIMARY_KEY_JOIN_COLUMN_IMPL__REFERENCED_COLUMN_NAME;
+ default: return -1;
+ }
+ }
+ return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (referencedColumnName: ");
+ result.append(referencedColumnName);
+ result.append(')');
+ return result.toString();
+ }
+
+ public TextRange referencedColumnNameTextRange() {
+ IDOMNode referencedColumnNameNode = (IDOMNode) DOMUtilities.getChildAttributeNode(this.node, OrmXmlMapper.REFERENCED_COLUMN_NAME);
+ return (referencedColumnNameNode == null) ? validationTextRange() : buildTextRange(referencedColumnNameNode);
+ }
+} // XmlPrimaryKeyJoinColumnImpl
diff --git a/jpa/plugins/org.eclipse.jpt.ui/META-INF/MANIFEST.MF b/jpa/plugins/org.eclipse.jpt.ui/META-INF/MANIFEST.MF
index 66d17318bc..23db43a936 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/META-INF/MANIFEST.MF
+++ b/jpa/plugins/org.eclipse.jpt.ui/META-INF/MANIFEST.MF
@@ -61,6 +61,5 @@ Export-Package: org.eclipse.jpt.ui,
org.eclipse.jpt.ui.internal.views;x-internal:=true,
org.eclipse.jpt.ui.internal.views.structure;x-internal:=true,
org.eclipse.jpt.ui.internal.widgets;x-internal:=true,
- org.eclipse.jpt.ui.internal.wizards;x-internal:=true,
- org.eclipse.jpt.ui.java.details
+ org.eclipse.jpt.ui.internal.wizards;x-internal:=true
Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui_mappings.properties b/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui_mappings.properties
index 228b6423fc..c2ab47192a 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui_mappings.properties
+++ b/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui_mappings.properties
@@ -268,3 +268,6 @@ NewNameStateObject_nameAlreadyExists=A query with this name already exists.
QueryHintsComposite_nameColumn=Name
QueryHintsComposite_valueColumn=Value
+
+OrmSecondaryTablesComposite_defineInXml=Define in XML
+
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/JpaUiFactory.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/JpaUiFactory.java
index e5604d577d..7bb15f7a54 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/JpaUiFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/JpaUiFactory.java
@@ -13,7 +13,6 @@ import org.eclipse.jpt.core.context.BasicMapping;
import org.eclipse.jpt.core.context.Embeddable;
import org.eclipse.jpt.core.context.EmbeddedIdMapping;
import org.eclipse.jpt.core.context.EmbeddedMapping;
-import org.eclipse.jpt.core.context.Entity;
import org.eclipse.jpt.core.context.IdMapping;
import org.eclipse.jpt.core.context.ManyToManyMapping;
import org.eclipse.jpt.core.context.ManyToOneMapping;
@@ -22,6 +21,8 @@ import org.eclipse.jpt.core.context.OneToManyMapping;
import org.eclipse.jpt.core.context.OneToOneMapping;
import org.eclipse.jpt.core.context.TransientMapping;
import org.eclipse.jpt.core.context.VersionMapping;
+import org.eclipse.jpt.core.context.java.JavaEntity;
+import org.eclipse.jpt.core.context.orm.OrmEntity;
import org.eclipse.jpt.ui.details.JpaComposite;
import org.eclipse.jpt.ui.internal.widgets.WidgetFactory;
import org.eclipse.jpt.utility.model.value.PropertyValueModel;
@@ -102,15 +103,28 @@ public interface JpaUiFactory
WidgetFactory widgetFactory);
/**
- * Creates a new <code>JpaComposite</code> used to edit an <code>Entity</code>.
+ * Creates a new <code>JpaComposite</code> used to edit an <code>JavaEntity</code>.
*
- * @param subjectHolder The holder of the entity
+ * @param subjectHolder The holder of the java entity
* @param parent The parent container
* @param widgetFactory The factory used to create the widgets
* @return A new <code>JpaComposite</code>
*/
- JpaComposite<Entity> createEntityComposite(
- PropertyValueModel<Entity> subjectHolder,
+ JpaComposite<JavaEntity> createJavaEntityComposite(
+ PropertyValueModel<JavaEntity> subjectHolder,
+ Composite parent,
+ WidgetFactory widgetFactory);
+
+ /**
+ * Creates a new <code>JpaComposite</code> used to edit a <code>OrmEntity</code>.
+ *
+ * @param subjectHolder The holder of the orm entity
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create the widgets
+ * @return A new <code>JpaComposite</code>
+ */
+ JpaComposite<OrmEntity> createOrmEntityComposite(
+ PropertyValueModel<OrmEntity> subjectHolder,
Composite parent,
WidgetFactory widgetFactory);
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/java/details/AttributeMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/details/AttributeMappingUiProvider.java
index 191dc9cf7a..a36ffadf45 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/java/details/AttributeMappingUiProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/details/AttributeMappingUiProvider.java
@@ -7,11 +7,10 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.ui.java.details;
+package org.eclipse.jpt.ui.details;
import org.eclipse.jpt.core.context.AttributeMapping;
import org.eclipse.jpt.ui.JpaUiFactory;
-import org.eclipse.jpt.ui.details.JpaComposite;
import org.eclipse.jpt.ui.internal.widgets.WidgetFactory;
import org.eclipse.jpt.utility.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
@@ -28,12 +27,6 @@ import org.eclipse.swt.widgets.Composite;
public interface AttributeMappingUiProvider<T extends AttributeMapping>
{
/**
- * A unique string that corresponds to the key of a MappingProvider in the core
- * (IJavaAttributeMappingProvider and/or IXmlAttributeMappingProvider)
- */
- String attributeMappingKey();
-
- /**
* The IJpaComposite that correponds to this mapping type. This will be displayed
* by the PersistentAttributeDetailsPage when the mapping key matches the key given
* by this provider. The composites will be stored in a Map with the mapping key as the key.
@@ -54,4 +47,10 @@ public interface AttributeMappingUiProvider<T extends AttributeMapping>
* @return
*/
String label();
+
+ /**
+ * A unique string that corresponds to the key of a MappingProvider in the core
+ * (JavaAttributeMappingProvider and/or OrmAttributeMappingProvider)
+ */
+ String mappingKey();
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/java/details/TypeMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/details/TypeMappingUiProvider.java
index 1205b6d396..def8bfaef2 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/java/details/TypeMappingUiProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/details/TypeMappingUiProvider.java
@@ -7,10 +7,10 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.ui.java.details;
+package org.eclipse.jpt.ui.details;
import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.ui.details.JpaComposite;
+import org.eclipse.jpt.ui.JpaUiFactory;
import org.eclipse.jpt.ui.internal.widgets.WidgetFactory;
import org.eclipse.jpt.utility.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
@@ -27,7 +27,7 @@ import org.eclipse.swt.widgets.Composite;
public interface TypeMappingUiProvider<T extends TypeMapping>
{
/**
- * The IJpaComposite that correponds to this mapping type. This will be displayed
+ * The JpaComposite that correponds to this mapping type. This will be displayed
* by the PersistentTypeDetailsPage when the mapping key matches the key given
* by this provider. The composites will be stored in a Map with the mapping key as the key.
*
@@ -36,6 +36,7 @@ public interface TypeMappingUiProvider<T extends TypeMapping>
* @return
*/
JpaComposite<T> buildPersistentTypeMappingComposite(
+ JpaUiFactory factory,
PropertyValueModel<T> subjectHolder,
Composite parent,
WidgetFactory widgetFactory);
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/BaseJpaUiFactory.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/BaseJpaUiFactory.java
index 315af0c005..13998b4952 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/BaseJpaUiFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/BaseJpaUiFactory.java
@@ -13,7 +13,6 @@ import org.eclipse.jpt.core.context.BasicMapping;
import org.eclipse.jpt.core.context.Embeddable;
import org.eclipse.jpt.core.context.EmbeddedIdMapping;
import org.eclipse.jpt.core.context.EmbeddedMapping;
-import org.eclipse.jpt.core.context.Entity;
import org.eclipse.jpt.core.context.IdMapping;
import org.eclipse.jpt.core.context.ManyToManyMapping;
import org.eclipse.jpt.core.context.ManyToOneMapping;
@@ -22,13 +21,15 @@ import org.eclipse.jpt.core.context.OneToManyMapping;
import org.eclipse.jpt.core.context.OneToOneMapping;
import org.eclipse.jpt.core.context.TransientMapping;
import org.eclipse.jpt.core.context.VersionMapping;
+import org.eclipse.jpt.core.context.java.JavaEntity;
+import org.eclipse.jpt.core.context.orm.OrmEntity;
import org.eclipse.jpt.ui.JpaUiFactory;
import org.eclipse.jpt.ui.details.JpaComposite;
+import org.eclipse.jpt.ui.internal.java.details.JavaEntityComposite;
import org.eclipse.jpt.ui.internal.mappings.details.BasicMappingComposite;
import org.eclipse.jpt.ui.internal.mappings.details.EmbeddableComposite;
import org.eclipse.jpt.ui.internal.mappings.details.EmbeddedIdMappingComposite;
import org.eclipse.jpt.ui.internal.mappings.details.EmbeddedMappingComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.EntityComposite;
import org.eclipse.jpt.ui.internal.mappings.details.IdMappingComposite;
import org.eclipse.jpt.ui.internal.mappings.details.ManyToManyMappingComposite;
import org.eclipse.jpt.ui.internal.mappings.details.ManyToOneMappingComposite;
@@ -37,6 +38,7 @@ import org.eclipse.jpt.ui.internal.mappings.details.OneToManyMappingComposite;
import org.eclipse.jpt.ui.internal.mappings.details.OneToOneMappingComposite;
import org.eclipse.jpt.ui.internal.mappings.details.TransientMappingComposite;
import org.eclipse.jpt.ui.internal.mappings.details.VersionMappingComposite;
+import org.eclipse.jpt.ui.internal.orm.details.OrmEntityComposite;
import org.eclipse.jpt.ui.internal.widgets.WidgetFactory;
import org.eclipse.jpt.utility.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
@@ -52,9 +54,6 @@ import org.eclipse.swt.widgets.Composite;
*/
public abstract class BaseJpaUiFactory implements JpaUiFactory
{
- /*
- * (non-Javadoc)
- */
public JpaComposite<BasicMapping> createBasicMappingComposite(
PropertyValueModel<BasicMapping> subjectHolder,
Composite parent,
@@ -63,9 +62,6 @@ public abstract class BaseJpaUiFactory implements JpaUiFactory
return new BasicMappingComposite(subjectHolder, parent, widgetFactory);
}
- /*
- * (non-Javadoc)
- */
public JpaComposite<Embeddable> createEmbeddableComposite(
PropertyValueModel<Embeddable> subjectHolder,
Composite parent,
@@ -74,9 +70,6 @@ public abstract class BaseJpaUiFactory implements JpaUiFactory
return new EmbeddableComposite(subjectHolder, parent, widgetFactory);
}
- /*
- * (non-Javadoc)
- */
public JpaComposite<EmbeddedIdMapping> createEmbeddedIdMappingComposite(
PropertyValueModel<EmbeddedIdMapping> subjectHolder,
Composite parent,
@@ -85,9 +78,6 @@ public abstract class BaseJpaUiFactory implements JpaUiFactory
return new EmbeddedIdMappingComposite(subjectHolder, parent, widgetFactory);
}
- /*
- * (non-Javadoc)
- */
public JpaComposite<EmbeddedMapping> createEmbeddedMappingComposite(
PropertyValueModel<EmbeddedMapping> subjectHolder,
Composite parent,
@@ -96,20 +86,22 @@ public abstract class BaseJpaUiFactory implements JpaUiFactory
return new EmbeddedMappingComposite(subjectHolder, parent, widgetFactory);
}
- /*
- * (non-Javadoc)
- */
- public JpaComposite<Entity> createEntityComposite(
- PropertyValueModel<Entity> subjectHolder,
+ public JpaComposite<JavaEntity> createJavaEntityComposite(
+ PropertyValueModel<JavaEntity> subjectHolder,
Composite parent,
WidgetFactory widgetFactory) {
- return new EntityComposite(subjectHolder, parent, widgetFactory);
+ return new JavaEntityComposite(subjectHolder, parent, widgetFactory);
+ }
+
+ public JpaComposite<OrmEntity> createOrmEntityComposite(
+ PropertyValueModel<OrmEntity> subjectHolder,
+ Composite parent,
+ WidgetFactory widgetFactory) {
+
+ return new OrmEntityComposite(subjectHolder, parent, widgetFactory);
}
- /*
- * (non-Javadoc)
- */
public JpaComposite<IdMapping> createIdMappingComposite(
PropertyValueModel<IdMapping> subjectHolder,
Composite parent,
@@ -118,9 +110,6 @@ public abstract class BaseJpaUiFactory implements JpaUiFactory
return new IdMappingComposite(subjectHolder, parent, widgetFactory);
}
- /*
- * (non-Javadoc)
- */
public JpaComposite<ManyToManyMapping> createManyToManyMappingComposite(
PropertyValueModel<ManyToManyMapping> subjectHolder,
Composite parent,
@@ -129,9 +118,6 @@ public abstract class BaseJpaUiFactory implements JpaUiFactory
return new ManyToManyMappingComposite(subjectHolder, parent, widgetFactory);
}
- /*
- * (non-Javadoc)
- */
public JpaComposite<ManyToOneMapping> createManyToOneMappingComposite(
PropertyValueModel<ManyToOneMapping> subjectHolder,
Composite parent,
@@ -140,9 +126,6 @@ public abstract class BaseJpaUiFactory implements JpaUiFactory
return new ManyToOneMappingComposite(subjectHolder, parent, widgetFactory);
}
- /*
- * (non-Javadoc)
- */
public JpaComposite<MappedSuperclass> createMappedSuperclassComposite(
PropertyValueModel<MappedSuperclass> subjectHolder,
Composite parent,
@@ -151,9 +134,6 @@ public abstract class BaseJpaUiFactory implements JpaUiFactory
return new MappedSuperclassComposite(subjectHolder, parent, widgetFactory);
}
- /*
- * (non-Javadoc)
- */
public JpaComposite<OneToManyMapping> createOneToManyMappingComposite(
PropertyValueModel<OneToManyMapping> subjectHolder,
Composite parent,
@@ -162,9 +142,6 @@ public abstract class BaseJpaUiFactory implements JpaUiFactory
return new OneToManyMappingComposite(subjectHolder, parent, widgetFactory);
}
- /*
- * (non-Javadoc)
- */
public JpaComposite<OneToOneMapping> createOneToOneMappingComposite(
PropertyValueModel<OneToOneMapping> subjectHolder,
Composite parent,
@@ -173,9 +150,6 @@ public abstract class BaseJpaUiFactory implements JpaUiFactory
return new OneToOneMappingComposite(subjectHolder, parent, widgetFactory);
}
- /*
- * (non-Javadoc)
- */
public JpaComposite<TransientMapping> createTransientMappingComposite(
PropertyValueModel<TransientMapping> subjectHolder,
Composite parent,
@@ -184,9 +158,6 @@ public abstract class BaseJpaUiFactory implements JpaUiFactory
return new TransientMappingComposite(subjectHolder, parent, widgetFactory);
}
- /*
- * (non-Javadoc)
- */
public JpaComposite<VersionMapping> createVersionMappingComposite(
PropertyValueModel<VersionMapping> subjectHolder,
Composite parent,
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/AbstractJpaDetailsPage.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/AbstractJpaDetailsPage.java
index d849da9d8c..de99462f9f 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/AbstractJpaDetailsPage.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/AbstractJpaDetailsPage.java
@@ -9,7 +9,11 @@
package org.eclipse.jpt.ui.internal.details;
import org.eclipse.jpt.core.JpaStructureNode;
+import org.eclipse.jpt.ui.JpaPlatformUi;
+import org.eclipse.jpt.ui.JpaUiFactory;
import org.eclipse.jpt.ui.details.JpaDetailsPage;
+import org.eclipse.jpt.ui.internal.platform.JpaPlatformUiRegistry;
+import org.eclipse.jpt.ui.internal.platform.base.BaseJpaPlatformUi;
import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
import org.eclipse.swt.widgets.Composite;
@@ -40,6 +44,18 @@ public abstract class AbstractJpaDetailsPage<T extends JpaStructureNode>
super(new SimplePropertyValueModel<T>(), parent, widgetFactory);
}
+
+ protected JpaPlatformUi jpaPlatformUi() {
+ String platformId = subject().jpaProject().jpaPlatform().getId();
+ return JpaPlatformUiRegistry.instance().jpaPlatform(platformId);
+ }
+
+ protected JpaUiFactory jpaUiFactory() {
+ // TODO: Remove the type cast, used for testing
+ return ((BaseJpaPlatformUi) jpaPlatformUi()).getJpaUiFactory();
+ }
+
+
/**
* There is an issue with <code>ScrolledForm</code>, it doesn't repaint the
* entire content, this will retrieve it by going up the hierarchy of the
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/BasicMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/BasicMappingUiProvider.java
index 3eda5d3814..bea7b5c7a6 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/BasicMappingUiProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/BasicMappingUiProvider.java
@@ -7,15 +7,15 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.ui.internal.java.details;
+package org.eclipse.jpt.ui.internal.details;
import org.eclipse.jpt.core.MappingKeys;
import org.eclipse.jpt.core.context.BasicMapping;
import org.eclipse.jpt.ui.JpaUiFactory;
+import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
import org.eclipse.jpt.ui.details.JpaComposite;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
import org.eclipse.jpt.ui.internal.widgets.WidgetFactory;
-import org.eclipse.jpt.ui.java.details.AttributeMappingUiProvider;
import org.eclipse.jpt.utility.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
@@ -40,7 +40,7 @@ public class BasicMappingUiProvider
super();
}
- public String attributeMappingKey() {
+ public String mappingKey() {
return MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY;
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/EmbeddableUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/EmbeddableUiProvider.java
index 63f9be4834..2f453bd87b 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/EmbeddableUiProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/EmbeddableUiProvider.java
@@ -7,15 +7,15 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.ui.internal.java.details;
+package org.eclipse.jpt.ui.internal.details;
import org.eclipse.jpt.core.MappingKeys;
import org.eclipse.jpt.core.context.Embeddable;
+import org.eclipse.jpt.ui.JpaUiFactory;
import org.eclipse.jpt.ui.details.JpaComposite;
+import org.eclipse.jpt.ui.details.TypeMappingUiProvider;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.mappings.details.EmbeddableComposite;
import org.eclipse.jpt.ui.internal.widgets.WidgetFactory;
-import org.eclipse.jpt.ui.java.details.TypeMappingUiProvider;
import org.eclipse.jpt.utility.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
@@ -47,10 +47,11 @@ public class EmbeddableUiProvider implements TypeMappingUiProvider<Embeddable>
}
public JpaComposite<Embeddable> buildPersistentTypeMappingComposite(
+ JpaUiFactory factory,
PropertyValueModel<Embeddable> subjectHolder,
Composite parent,
WidgetFactory widgetFactory) {
- return new EmbeddableComposite(subjectHolder, parent, widgetFactory);
+ return factory.createEmbeddableComposite(subjectHolder, parent, widgetFactory);
}
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/EmbeddedIdMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/EmbeddedIdMappingUiProvider.java
index bb4b920f41..b4deb348b0 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/EmbeddedIdMappingUiProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/EmbeddedIdMappingUiProvider.java
@@ -7,15 +7,15 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.ui.internal.java.details;
+package org.eclipse.jpt.ui.internal.details;
import org.eclipse.jpt.core.MappingKeys;
import org.eclipse.jpt.core.context.EmbeddedIdMapping;
import org.eclipse.jpt.ui.JpaUiFactory;
+import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
import org.eclipse.jpt.ui.details.JpaComposite;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
import org.eclipse.jpt.ui.internal.widgets.WidgetFactory;
-import org.eclipse.jpt.ui.java.details.AttributeMappingUiProvider;
import org.eclipse.jpt.utility.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
@@ -40,7 +40,7 @@ public class EmbeddedIdMappingUiProvider
super();
}
- public String attributeMappingKey() {
+ public String mappingKey() {
return MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY;
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/EmbeddedMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/EmbeddedMappingUiProvider.java
index 3df40099e4..6dedc89722 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/EmbeddedMappingUiProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/EmbeddedMappingUiProvider.java
@@ -7,15 +7,15 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.ui.internal.java.details;
+package org.eclipse.jpt.ui.internal.details;
import org.eclipse.jpt.core.MappingKeys;
import org.eclipse.jpt.core.context.EmbeddedMapping;
import org.eclipse.jpt.ui.JpaUiFactory;
+import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
import org.eclipse.jpt.ui.details.JpaComposite;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
import org.eclipse.jpt.ui.internal.widgets.WidgetFactory;
-import org.eclipse.jpt.ui.java.details.AttributeMappingUiProvider;
import org.eclipse.jpt.utility.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
@@ -40,7 +40,7 @@ public class EmbeddedMappingUiProvider
super();
}
- public String attributeMappingKey() {
+ public String mappingKey() {
return MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY;
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/IdMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/IdMappingUiProvider.java
index b81dfcf3e8..9a2529899e 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/IdMappingUiProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/IdMappingUiProvider.java
@@ -7,15 +7,15 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.ui.internal.java.details;
+package org.eclipse.jpt.ui.internal.details;
import org.eclipse.jpt.core.MappingKeys;
import org.eclipse.jpt.core.context.IdMapping;
import org.eclipse.jpt.ui.JpaUiFactory;
+import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
import org.eclipse.jpt.ui.details.JpaComposite;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
import org.eclipse.jpt.ui.internal.widgets.WidgetFactory;
-import org.eclipse.jpt.ui.java.details.AttributeMappingUiProvider;
import org.eclipse.jpt.utility.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
@@ -39,7 +39,7 @@ public class IdMappingUiProvider
super();
}
- public String attributeMappingKey() {
+ public String mappingKey() {
return MappingKeys.ID_ATTRIBUTE_MAPPING_KEY;
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/ManyToManyMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/ManyToManyMappingUiProvider.java
index 716cd8840e..d9efdd00e0 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/ManyToManyMappingUiProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/ManyToManyMappingUiProvider.java
@@ -7,15 +7,15 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.ui.internal.java.details;
+package org.eclipse.jpt.ui.internal.details;
import org.eclipse.jpt.core.MappingKeys;
import org.eclipse.jpt.core.context.ManyToManyMapping;
import org.eclipse.jpt.ui.JpaUiFactory;
+import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
import org.eclipse.jpt.ui.details.JpaComposite;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
import org.eclipse.jpt.ui.internal.widgets.WidgetFactory;
-import org.eclipse.jpt.ui.java.details.AttributeMappingUiProvider;
import org.eclipse.jpt.utility.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
@@ -39,7 +39,7 @@ public class ManyToManyMappingUiProvider
super();
}
- public String attributeMappingKey() {
+ public String mappingKey() {
return MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY;
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/ManyToOneMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/ManyToOneMappingUiProvider.java
index 6fb5c7241c..54d9488add 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/ManyToOneMappingUiProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/ManyToOneMappingUiProvider.java
@@ -7,15 +7,15 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.ui.internal.java.details;
+package org.eclipse.jpt.ui.internal.details;
import org.eclipse.jpt.core.MappingKeys;
import org.eclipse.jpt.core.context.ManyToOneMapping;
import org.eclipse.jpt.ui.JpaUiFactory;
+import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
import org.eclipse.jpt.ui.details.JpaComposite;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
import org.eclipse.jpt.ui.internal.widgets.WidgetFactory;
-import org.eclipse.jpt.ui.java.details.AttributeMappingUiProvider;
import org.eclipse.jpt.utility.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
@@ -39,7 +39,7 @@ public class ManyToOneMappingUiProvider
super();
}
- public String attributeMappingKey() {
+ public String mappingKey() {
return MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY;
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/MappedSuperclassUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/MappedSuperclassUiProvider.java
index 2bcbe3623a..e559f9653c 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/MappedSuperclassUiProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/MappedSuperclassUiProvider.java
@@ -7,15 +7,15 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.ui.internal.java.details;
+package org.eclipse.jpt.ui.internal.details;
import org.eclipse.jpt.core.MappingKeys;
import org.eclipse.jpt.core.context.MappedSuperclass;
+import org.eclipse.jpt.ui.JpaUiFactory;
import org.eclipse.jpt.ui.details.JpaComposite;
+import org.eclipse.jpt.ui.details.TypeMappingUiProvider;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.mappings.details.MappedSuperclassComposite;
import org.eclipse.jpt.ui.internal.widgets.WidgetFactory;
-import org.eclipse.jpt.ui.java.details.TypeMappingUiProvider;
import org.eclipse.jpt.utility.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
@@ -47,10 +47,11 @@ public class MappedSuperclassUiProvider implements TypeMappingUiProvider<MappedS
}
public JpaComposite<MappedSuperclass> buildPersistentTypeMappingComposite(
+ JpaUiFactory factory,
PropertyValueModel<MappedSuperclass> subjectHolder,
Composite parent,
WidgetFactory widgetFactory) {
- return new MappedSuperclassComposite(subjectHolder, parent, widgetFactory);
+ return factory.createMappedSuperclassComposite(subjectHolder, parent, widgetFactory);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/OneToManyMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/OneToManyMappingUiProvider.java
index 442f634f16..cbe8520277 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/OneToManyMappingUiProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/OneToManyMappingUiProvider.java
@@ -7,15 +7,15 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.ui.internal.java.details;
+package org.eclipse.jpt.ui.internal.details;
import org.eclipse.jpt.core.MappingKeys;
import org.eclipse.jpt.core.context.OneToManyMapping;
import org.eclipse.jpt.ui.JpaUiFactory;
+import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
import org.eclipse.jpt.ui.details.JpaComposite;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
import org.eclipse.jpt.ui.internal.widgets.WidgetFactory;
-import org.eclipse.jpt.ui.java.details.AttributeMappingUiProvider;
import org.eclipse.jpt.utility.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
@@ -39,7 +39,7 @@ public class OneToManyMappingUiProvider
super();
}
- public String attributeMappingKey() {
+ public String mappingKey() {
return MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY;
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/OneToOneMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/OneToOneMappingUiProvider.java
index 07350784d4..cb2bf9e144 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/OneToOneMappingUiProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/OneToOneMappingUiProvider.java
@@ -7,15 +7,15 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.ui.internal.java.details;
+package org.eclipse.jpt.ui.internal.details;
import org.eclipse.jpt.core.MappingKeys;
import org.eclipse.jpt.core.context.OneToOneMapping;
import org.eclipse.jpt.ui.JpaUiFactory;
+import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
import org.eclipse.jpt.ui.details.JpaComposite;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
import org.eclipse.jpt.ui.internal.widgets.WidgetFactory;
-import org.eclipse.jpt.ui.java.details.AttributeMappingUiProvider;
import org.eclipse.jpt.utility.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
@@ -40,7 +40,7 @@ public class OneToOneMappingUiProvider
super();
}
- public String attributeMappingKey() {
+ public String mappingKey() {
return MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY;
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/PersistentAttributeDetailsPage.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/PersistentAttributeDetailsPage.java
index ea6ca851f5..5883cc969a 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/PersistentAttributeDetailsPage.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/PersistentAttributeDetailsPage.java
@@ -24,15 +24,11 @@ import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jpt.core.context.AttributeMapping;
import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.ui.JpaPlatformUi;
-import org.eclipse.jpt.ui.JpaUiFactory;
import org.eclipse.jpt.ui.JptUiPlugin;
+import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
import org.eclipse.jpt.ui.details.JpaComposite;
import org.eclipse.jpt.ui.internal.JptUiMessages;
import org.eclipse.jpt.ui.internal.Tracing;
-import org.eclipse.jpt.ui.internal.platform.JpaPlatformUiRegistry;
-import org.eclipse.jpt.ui.internal.platform.base.BaseJpaPlatformUi;
-import org.eclipse.jpt.ui.java.details.AttributeMappingUiProvider;
import org.eclipse.jpt.utility.Filter;
import org.eclipse.jpt.utility.internal.CollectionTools;
import org.eclipse.jpt.utility.internal.model.value.FilteringPropertyValueModel;
@@ -87,7 +83,7 @@ public abstract class PersistentAttributeDetailsPage<T extends PersistentAttribu
protected AttributeMappingUiProvider<? extends AttributeMapping> attributeMappingUiProvider(String key) {
for (ListIterator<AttributeMappingUiProvider<? extends AttributeMapping>> i = attributeMappingUiProviders(); i.hasNext(); ) {
AttributeMappingUiProvider<? extends AttributeMapping> provider = i.next();
- if (provider.attributeMappingKey() == key) {
+ if (provider.mappingKey() == key) {
return provider;
}
}
@@ -245,16 +241,6 @@ public abstract class PersistentAttributeDetailsPage<T extends PersistentAttribu
this.mappingComposites = new HashMap<String, JpaComposite<AttributeMapping>>();
}
- protected JpaPlatformUi jpaPlatformUi() {
- String platformId = subject().jpaProject().jpaPlatform().getId();
- return JpaPlatformUiRegistry.instance().jpaPlatform(platformId);
- }
-
- protected JpaUiFactory jpaUiFactory() {
- // TODO: Remove the type cast, used for testing
- return ((BaseJpaPlatformUi) jpaPlatformUi()).getJpaUiFactory();
- }
-
/*
* (non-Javadoc)
*/
@@ -272,7 +258,7 @@ public abstract class PersistentAttributeDetailsPage<T extends PersistentAttribu
private void mappingChanged(SelectionChangedEvent event) {
if (event.getSelection() instanceof StructuredSelection) {
AttributeMappingUiProvider<?> provider = (AttributeMappingUiProvider<?>) ((StructuredSelection) event.getSelection()).getFirstElement();
- String key = (CollectionTools.contains(defaultAttributeMappingUiProviders(), provider) ? null : provider.attributeMappingKey());
+ String key = (CollectionTools.contains(defaultAttributeMappingUiProviders(), provider) ? null : provider.mappingKey());
this.subject().setSpecifiedMappingKey(key);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/PersistentTypeDetailsPage.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/PersistentTypeDetailsPage.java
index 559dfaa5e1..4b26054e1c 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/PersistentTypeDetailsPage.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/PersistentTypeDetailsPage.java
@@ -26,9 +26,9 @@ import org.eclipse.jpt.core.context.PersistentType;
import org.eclipse.jpt.core.context.TypeMapping;
import org.eclipse.jpt.ui.JptUiPlugin;
import org.eclipse.jpt.ui.details.JpaComposite;
+import org.eclipse.jpt.ui.details.TypeMappingUiProvider;
import org.eclipse.jpt.ui.internal.JptUiMessages;
import org.eclipse.jpt.ui.internal.Tracing;
-import org.eclipse.jpt.ui.java.details.TypeMappingUiProvider;
import org.eclipse.jpt.utility.Filter;
import org.eclipse.jpt.utility.internal.CollectionTools;
import org.eclipse.jpt.utility.internal.model.value.FilteringPropertyValueModel;
@@ -125,6 +125,7 @@ public abstract class PersistentTypeDetailsPage<T extends PersistentType> extend
(TypeMappingUiProvider<TypeMapping>) typeMappingUiProvider(key);
return uiProvider.buildPersistentTypeMappingComposite(
+ jpaUiFactory(),
buildMappingHolder(key),
pageBook,
getWidgetFactory()
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/TransientMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/TransientMappingUiProvider.java
index b82d626653..8b2f98921c 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/TransientMappingUiProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/TransientMappingUiProvider.java
@@ -7,15 +7,15 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.ui.internal.java.details;
+package org.eclipse.jpt.ui.internal.details;
import org.eclipse.jpt.core.MappingKeys;
import org.eclipse.jpt.core.context.TransientMapping;
import org.eclipse.jpt.ui.JpaUiFactory;
+import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
import org.eclipse.jpt.ui.details.JpaComposite;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
import org.eclipse.jpt.ui.internal.widgets.WidgetFactory;
-import org.eclipse.jpt.ui.java.details.AttributeMappingUiProvider;
import org.eclipse.jpt.utility.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
@@ -40,7 +40,7 @@ public class TransientMappingUiProvider
super();
}
- public String attributeMappingKey() {
+ public String mappingKey() {
return MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY;
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/VersionMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/VersionMappingUiProvider.java
index 7211f6af58..1a221d7f92 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/VersionMappingUiProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/VersionMappingUiProvider.java
@@ -7,15 +7,15 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.ui.internal.java.details;
+package org.eclipse.jpt.ui.internal.details;
import org.eclipse.jpt.core.MappingKeys;
import org.eclipse.jpt.core.context.VersionMapping;
import org.eclipse.jpt.ui.JpaUiFactory;
+import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
import org.eclipse.jpt.ui.details.JpaComposite;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
import org.eclipse.jpt.ui.internal.widgets.WidgetFactory;
-import org.eclipse.jpt.ui.java.details.AttributeMappingUiProvider;
import org.eclipse.jpt.utility.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
@@ -40,7 +40,7 @@ public class VersionMappingUiProvider
super();
}
- public String attributeMappingKey() {
+ public String mappingKey() {
return MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY;
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/dialogs/AddPersistentAttributeToXmlAndMapDialog.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/dialogs/AddPersistentAttributeToXmlAndMapDialog.java
index 8c44302bde..9be9b1139c 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/dialogs/AddPersistentAttributeToXmlAndMapDialog.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/dialogs/AddPersistentAttributeToXmlAndMapDialog.java
@@ -1,3 +1,12 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
package org.eclipse.jpt.ui.internal.dialogs;
import org.eclipse.core.runtime.IStatus;
@@ -12,18 +21,18 @@ import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
import org.eclipse.jpt.ui.JptUiPlugin;
+import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
import org.eclipse.jpt.ui.internal.JptUiMessages;
-import org.eclipse.jpt.ui.internal.java.details.BasicMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.details.EmbeddedIdMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.details.EmbeddedMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.details.IdMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.details.ManyToManyMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.details.ManyToOneMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.details.OneToManyMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.details.OneToOneMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.details.TransientMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.details.VersionMappingUiProvider;
-import org.eclipse.jpt.ui.java.details.AttributeMappingUiProvider;
+import org.eclipse.jpt.ui.internal.details.BasicMappingUiProvider;
+import org.eclipse.jpt.ui.internal.details.EmbeddedIdMappingUiProvider;
+import org.eclipse.jpt.ui.internal.details.EmbeddedMappingUiProvider;
+import org.eclipse.jpt.ui.internal.details.IdMappingUiProvider;
+import org.eclipse.jpt.ui.internal.details.ManyToManyMappingUiProvider;
+import org.eclipse.jpt.ui.internal.details.ManyToOneMappingUiProvider;
+import org.eclipse.jpt.ui.internal.details.OneToManyMappingUiProvider;
+import org.eclipse.jpt.ui.internal.details.OneToOneMappingUiProvider;
+import org.eclipse.jpt.ui.internal.details.TransientMappingUiProvider;
+import org.eclipse.jpt.ui.internal.details.VersionMappingUiProvider;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -149,7 +158,7 @@ public class AddPersistentAttributeToXmlAndMapDialog extends StatusDialog
public String getMappingKey() {
StructuredSelection selection = (StructuredSelection) mappingCombo.getSelection();
- return (selection.isEmpty()) ? null : ((AttributeMappingUiProvider) selection.getFirstElement()).attributeMappingKey();
+ return (selection.isEmpty()) ? null : ((AttributeMappingUiProvider) selection.getFirstElement()).mappingKey();
}
private void validate() {
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/dialogs/AddPersistentClassDialog.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/dialogs/AddPersistentClassDialog.java
index 188ff4952a..c2afa9abce 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/dialogs/AddPersistentClassDialog.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/dialogs/AddPersistentClassDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -30,11 +30,11 @@ import org.eclipse.jface.window.Window;
import org.eclipse.jpt.core.JpaProject;
import org.eclipse.jpt.core.context.orm.EntityMappings;
import org.eclipse.jpt.ui.JptUiPlugin;
+import org.eclipse.jpt.ui.details.TypeMappingUiProvider;
import org.eclipse.jpt.ui.internal.JptUiMessages;
-import org.eclipse.jpt.ui.internal.java.details.EmbeddableUiProvider;
-import org.eclipse.jpt.ui.internal.java.details.EntityUiProvider;
-import org.eclipse.jpt.ui.internal.java.details.MappedSuperclassUiProvider;
-import org.eclipse.jpt.ui.java.details.TypeMappingUiProvider;
+import org.eclipse.jpt.ui.internal.details.EmbeddableUiProvider;
+import org.eclipse.jpt.ui.internal.details.MappedSuperclassUiProvider;
+import org.eclipse.jpt.ui.internal.orm.details.OrmEntityUiProvider;
import org.eclipse.jpt.utility.internal.StringTools;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
@@ -113,7 +113,7 @@ public class AddPersistentClassDialog extends StatusDialog
public Object[] getElements(Object inputElement) {
return new Object[] {
MappedSuperclassUiProvider.instance(),
- EntityUiProvider.instance(),
+ OrmEntityUiProvider.instance(),
EmbeddableUiProvider.instance()
};
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/DefaultBasicMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/DefaultBasicMappingUiProvider.java
index b74383f938..73070d443f 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/DefaultBasicMappingUiProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/DefaultBasicMappingUiProvider.java
@@ -12,10 +12,10 @@ package org.eclipse.jpt.ui.internal.java.details;
import org.eclipse.jpt.core.MappingKeys;
import org.eclipse.jpt.core.context.BasicMapping;
import org.eclipse.jpt.ui.JpaUiFactory;
+import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
import org.eclipse.jpt.ui.details.JpaComposite;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
import org.eclipse.jpt.ui.internal.widgets.WidgetFactory;
-import org.eclipse.jpt.ui.java.details.AttributeMappingUiProvider;
import org.eclipse.jpt.utility.model.value.PropertyValueModel;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Composite;
@@ -40,7 +40,7 @@ public class DefaultBasicMappingUiProvider
super();
}
- public String attributeMappingKey() {
+ public String mappingKey() {
return MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY;
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/DefaultEmbeddedMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/DefaultEmbeddedMappingUiProvider.java
index 31974f32af..c361c04430 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/DefaultEmbeddedMappingUiProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/DefaultEmbeddedMappingUiProvider.java
@@ -12,10 +12,10 @@ package org.eclipse.jpt.ui.internal.java.details;
import org.eclipse.jpt.core.MappingKeys;
import org.eclipse.jpt.core.context.EmbeddedMapping;
import org.eclipse.jpt.ui.JpaUiFactory;
+import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
import org.eclipse.jpt.ui.details.JpaComposite;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
import org.eclipse.jpt.ui.internal.widgets.WidgetFactory;
-import org.eclipse.jpt.ui.java.details.AttributeMappingUiProvider;
import org.eclipse.jpt.utility.model.value.PropertyValueModel;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Composite;
@@ -40,7 +40,7 @@ public class DefaultEmbeddedMappingUiProvider
super();
}
- public String attributeMappingKey() {
+ public String mappingKey() {
return MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY;
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaEntityComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaEntityComposite.java
new file mode 100644
index 0000000000..291e09688f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaEntityComposite.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2008 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.ui.internal.java.details;
+
+import org.eclipse.jpt.core.context.java.JavaEntity;
+import org.eclipse.jpt.ui.internal.mappings.details.AbstractEntityComposite;
+import org.eclipse.jpt.ui.internal.widgets.WidgetFactory;
+import org.eclipse.jpt.utility.model.value.PropertyValueModel;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * Here the layout of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | EntityNameCombo | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | TableComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | |
+ * | - v Attribute Overrides ------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | OverridesComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | |
+ * | - v Secondary Tables ---------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | SecondaryTablesComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | |
+ * | - v Inheritance --------------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | InheritanceComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | |
+ * | - v Queries ------------------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | QueriesComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @see BasicMapping
+ * @see BaseJpaUiFactory - The factory creating this pane
+ * @see EntityNameCombo
+ * @see InheritanceComposite
+ * @see OverridesComposite
+ * @see SecondaryTablesComposite
+ * @see TableComposite
+ *
+ * TODO talk to JavaEditor people about what we can do to hook in TabbedProperties for the JavaEditor
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+public class JavaEntityComposite extends AbstractEntityComposite<JavaEntity>
+{
+ /**
+ * Creates a new <code>EntityComposite</code>.
+ *
+ * @param subjectHolder The holder of the subject <code>IEntity</code>
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public JavaEntityComposite(PropertyValueModel<? extends JavaEntity> subjectHolder,
+ Composite parent,
+ WidgetFactory widgetFactory) {
+
+ super(subjectHolder, parent, widgetFactory);
+ }
+
+ @Override
+ protected void buildSecondaryTablesComposite(Composite container) {
+ new JavaSecondaryTablesComposite(this, container);
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/EntityUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaEntityUiProvider.java
index 48edc701fd..da5829a730 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/EntityUiProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaEntityUiProvider.java
@@ -10,31 +10,31 @@
package org.eclipse.jpt.ui.internal.java.details;
import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.Entity;
+import org.eclipse.jpt.core.context.java.JavaEntity;
+import org.eclipse.jpt.ui.JpaUiFactory;
import org.eclipse.jpt.ui.details.JpaComposite;
+import org.eclipse.jpt.ui.details.TypeMappingUiProvider;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.mappings.details.EntityComposite;
import org.eclipse.jpt.ui.internal.widgets.WidgetFactory;
-import org.eclipse.jpt.ui.java.details.TypeMappingUiProvider;
import org.eclipse.jpt.utility.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
-public class EntityUiProvider implements TypeMappingUiProvider<Entity>
+public class JavaEntityUiProvider implements TypeMappingUiProvider<JavaEntity>
{
// singleton
- private static final EntityUiProvider INSTANCE = new EntityUiProvider();
+ private static final JavaEntityUiProvider INSTANCE = new JavaEntityUiProvider();
/**
* Return the singleton.
*/
- public static TypeMappingUiProvider<Entity> instance() {
+ public static TypeMappingUiProvider<JavaEntity> instance() {
return INSTANCE;
}
/**
* Ensure non-instantiability.
*/
- private EntityUiProvider() {
+ private JavaEntityUiProvider() {
super();
}
@@ -46,11 +46,12 @@ public class EntityUiProvider implements TypeMappingUiProvider<Entity>
return JptUiMappingsMessages.PersistentTypePage_EntityLabel;
}
- public JpaComposite<Entity> buildPersistentTypeMappingComposite(
- PropertyValueModel<Entity> subjectHolder,
+ public JpaComposite<JavaEntity> buildPersistentTypeMappingComposite(
+ JpaUiFactory factory,
+ PropertyValueModel<JavaEntity> subjectHolder,
Composite parent,
WidgetFactory widgetFactory) {
- return new EntityComposite(subjectHolder, parent, widgetFactory);
+ return factory.createJavaEntityComposite(subjectHolder, parent, widgetFactory);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaPersistentAttributeDetailsPage.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaPersistentAttributeDetailsPage.java
index 1167a7fcb5..fb98a504cb 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaPersistentAttributeDetailsPage.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaPersistentAttributeDetailsPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2008 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -13,9 +13,9 @@ import java.util.ListIterator;
import org.eclipse.jpt.core.context.AttributeMapping;
import org.eclipse.jpt.core.context.PersistentAttribute;
import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
import org.eclipse.jpt.ui.internal.details.PersistentAttributeDetailsPage;
import org.eclipse.jpt.ui.internal.platform.base.BaseJpaPlatformUi;
-import org.eclipse.jpt.ui.java.details.AttributeMappingUiProvider;
import org.eclipse.jpt.utility.internal.CollectionTools;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
@@ -80,7 +80,7 @@ public class JavaPersistentAttributeDetailsPage extends PersistentAttributeDetai
protected AttributeMappingUiProvider<? extends AttributeMapping> defaultAttributeMappingUiProvider(String key) {
for (ListIterator<AttributeMappingUiProvider<? extends AttributeMapping>> i = defaultAttributeMappingUiProviders(); i.hasNext(); ) {
AttributeMappingUiProvider<? extends AttributeMapping> provider = i.next();
- if (provider.attributeMappingKey() == key) {
+ if (provider.mappingKey() == key) {
return provider;
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaPersistentTypeDetailsPage.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaPersistentTypeDetailsPage.java
index a887137d6d..7597199e59 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaPersistentTypeDetailsPage.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaPersistentTypeDetailsPage.java
@@ -13,10 +13,10 @@ import java.util.ListIterator;
import org.eclipse.jpt.core.context.TypeMapping;
import org.eclipse.jpt.core.context.java.JavaPersistentType;
import org.eclipse.jpt.ui.JpaPlatformUi;
+import org.eclipse.jpt.ui.details.TypeMappingUiProvider;
import org.eclipse.jpt.ui.internal.details.PersistentTypeDetailsPage;
import org.eclipse.jpt.ui.internal.platform.JpaPlatformUiRegistry;
import org.eclipse.jpt.ui.internal.platform.base.BaseJpaPlatformUi;
-import org.eclipse.jpt.ui.java.details.TypeMappingUiProvider;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaSecondaryTablesComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaSecondaryTablesComposite.java
new file mode 100644
index 0000000000..aa051bf954
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaSecondaryTablesComposite.java
@@ -0,0 +1,130 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2008 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.ui.internal.java.details;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.core.context.Entity;
+import org.eclipse.jpt.core.context.SecondaryTable;
+import org.eclipse.jpt.core.context.Table;
+import org.eclipse.jpt.core.context.java.JavaEntity;
+import org.eclipse.jpt.ui.internal.JpaHelpContextIds;
+import org.eclipse.jpt.ui.internal.mappings.details.AbstractSecondaryTablesComposite;
+import org.eclipse.jpt.ui.internal.mappings.details.PrimaryKeyJoinColumnsInSecondaryTableComposite;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.ui.internal.widgets.AddRemoveListPane;
+import org.eclipse.jpt.utility.internal.model.value.ItemPropertyListValueModelAdapter;
+import org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter;
+import org.eclipse.jpt.utility.model.value.ListValueModel;
+import org.eclipse.jpt.utility.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
+
+/**
+ * Here the layout of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | AddRemoveListPane | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | PrimaryKeyJoinColumnsInSecondaryTableComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @see Entity
+ * @see EntityComposite - The container of this pane
+ * @see AddRemoveListPane
+ * @see PrimaryKeyJoinColumnsInSecondaryTableComposite
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+public class JavaSecondaryTablesComposite extends AbstractSecondaryTablesComposite<JavaEntity>
+{
+ /**
+ * Creates a new <code>SecondaryTablesComposite</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param parent The parent container
+ */
+ public JavaSecondaryTablesComposite(AbstractFormPane<? extends JavaEntity> parentPane,
+ Composite parent) {
+
+ super(parentPane, parent);
+ }
+
+ /**
+ * Creates a new <code>SecondaryTablesComposite</code>.
+ *
+ * @param subjectHolder The holder of the subject <code>IEntity</code>
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public JavaSecondaryTablesComposite(PropertyValueModel<? extends JavaEntity> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ super(subjectHolder, parent, widgetFactory);
+ }
+
+ private ListValueModel<SecondaryTable> buildSecondaryTablesListModel() {
+ return new ItemPropertyListValueModelAdapter<SecondaryTable>(buildSecondaryTablesListHolder(),
+ Table.SPECIFIED_NAME_PROPERTY);
+ }
+
+ private ListValueModel<SecondaryTable> buildSecondaryTablesListHolder() {
+ return new ListAspectAdapter<Entity, SecondaryTable>(getSubjectHolder(), Entity.SPECIFIED_SECONDARY_TABLES_LIST) {
+ @Override
+ protected ListIterator<SecondaryTable> listIterator_() {
+ return subject.specifiedSecondaryTables();
+ }
+
+ @Override
+ protected int size_() {
+ return subject.specifiedSecondaryTablesSize();
+ }
+ };
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initializeLayout(Composite container) {
+
+ int groupBoxMargin = groupBoxMargin();
+
+ WritablePropertyValueModel<SecondaryTable> secondaryTableHolder =
+ buildSecondaryTableHolder();
+
+ // Secondary Tables add/remove list pane
+ new AddRemoveListPane<Entity>(
+ this,
+ buildSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin),
+ buildSecondaryTablesAdapter(),
+ buildSecondaryTablesListModel(),
+ secondaryTableHolder,
+ buildSecondaryTableLabelProvider(),
+ JpaHelpContextIds.MAPPING_JOIN_TABLE_COLUMNS//TODO need a help context id for this
+ );
+
+ // Primary Key Join Columns pane
+ new PrimaryKeyJoinColumnsInSecondaryTableComposite(
+ this,
+ secondaryTableHolder,
+ container
+ );
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/NullAttributeMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/NullAttributeMappingUiProvider.java
index 2db0e14409..59703226c6 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/NullAttributeMappingUiProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/NullAttributeMappingUiProvider.java
@@ -11,10 +11,10 @@ package org.eclipse.jpt.ui.internal.java.details;
import org.eclipse.jpt.core.context.AttributeMapping;
import org.eclipse.jpt.ui.JpaUiFactory;
+import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
import org.eclipse.jpt.ui.details.JpaComposite;
import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
import org.eclipse.jpt.ui.internal.widgets.WidgetFactory;
-import org.eclipse.jpt.ui.java.details.AttributeMappingUiProvider;
import org.eclipse.jpt.utility.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
@@ -44,7 +44,7 @@ public class NullAttributeMappingUiProvider
/*
* (non-Javadoc)
*/
- public String attributeMappingKey() {
+ public String mappingKey() {
return null;
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/NullTypeMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/NullTypeMappingUiProvider.java
index f9fb65bb60..d672564107 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/NullTypeMappingUiProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/NullTypeMappingUiProvider.java
@@ -10,10 +10,11 @@
package org.eclipse.jpt.ui.internal.java.details;
import org.eclipse.jpt.core.context.TypeMapping;
+import org.eclipse.jpt.ui.JpaUiFactory;
import org.eclipse.jpt.ui.details.JpaComposite;
+import org.eclipse.jpt.ui.details.TypeMappingUiProvider;
import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
import org.eclipse.jpt.ui.internal.widgets.WidgetFactory;
-import org.eclipse.jpt.ui.java.details.TypeMappingUiProvider;
import org.eclipse.jpt.utility.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
@@ -46,6 +47,7 @@ public class NullTypeMappingUiProvider implements TypeMappingUiProvider<TypeMapp
}
public JpaComposite<TypeMapping> buildPersistentTypeMappingComposite(
+ JpaUiFactory jpaUiFactory,
PropertyValueModel<TypeMapping> subjectHolder,
Composite parent,
WidgetFactory widgetFactory) {
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/JptUiMappingsMessages.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/JptUiMappingsMessages.java
index a87fded3df..60a1f69193 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/JptUiMappingsMessages.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/JptUiMappingsMessages.java
@@ -277,6 +277,8 @@ public class JptUiMappingsMessages extends NLS
public static String QueryHintsComposite_nameColumn;
public static String QueryHintsComposite_valueColumn;
+ public static String OrmSecondaryTablesComposite_defineInXml;
+
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, JptUiMappingsMessages.class);
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EntityComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/AbstractEntityComposite.java
index 281685c8b3..05c6f25916 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EntityComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/AbstractEntityComposite.java
@@ -14,6 +14,11 @@ import org.eclipse.jpt.core.context.Table;
import org.eclipse.jpt.ui.details.JpaComposite;
import org.eclipse.jpt.ui.internal.JpaHelpContextIds;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
+import org.eclipse.jpt.ui.internal.mappings.details.EntityNameCombo;
+import org.eclipse.jpt.ui.internal.mappings.details.InheritanceComposite;
+import org.eclipse.jpt.ui.internal.mappings.details.OverridesComposite;
+import org.eclipse.jpt.ui.internal.mappings.details.QueriesComposite;
+import org.eclipse.jpt.ui.internal.mappings.details.TableComposite;
import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
import org.eclipse.jpt.ui.internal.widgets.WidgetFactory;
import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
@@ -64,7 +69,7 @@ import org.eclipse.swt.widgets.Composite;
* | ------------------------------------------------------------------------- |
* -----------------------------------------------------------------------------</pre>
*
- * @see BasicMapping
+ * @see Entity
* @see BaseJpaUiFactory - The factory creating this pane
* @see EntityNameCombo
* @see InheritanceComposite
@@ -77,8 +82,8 @@ import org.eclipse.swt.widgets.Composite;
* @version 2.0
* @since 1.0
*/
-public class EntityComposite extends AbstractFormPane<Entity>
- implements JpaComposite<Entity>
+public abstract class AbstractEntityComposite<T extends Entity> extends AbstractFormPane<T>
+ implements JpaComposite<T>
{
/**
* Creates a new <code>EntityComposite</code>.
@@ -87,7 +92,7 @@ public class EntityComposite extends AbstractFormPane<Entity>
* @param parent The parent container
* @param widgetFactory The factory used to create various common widgets
*/
- public EntityComposite(PropertyValueModel<? extends Entity> subjectHolder,
+ public AbstractEntityComposite(PropertyValueModel<? extends T> subjectHolder,
Composite parent,
WidgetFactory widgetFactory) {
@@ -179,7 +184,8 @@ public class EntityComposite extends AbstractFormPane<Entity>
container,
JptUiMappingsMessages.SecondaryTablesComposite_secondaryTables
);
-
- new SecondaryTablesComposite(this, container);
+ buildSecondaryTablesComposite(container);
}
+
+ protected abstract void buildSecondaryTablesComposite(Composite container);
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/SecondaryTablesComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/AbstractSecondaryTablesComposite.java
index 5df355006c..4f9337e4b5 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/SecondaryTablesComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/AbstractSecondaryTablesComposite.java
@@ -9,22 +9,16 @@
******************************************************************************/
package org.eclipse.jpt.ui.internal.mappings.details;
-import java.util.ListIterator;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.window.Window;
import org.eclipse.jpt.core.context.Entity;
import org.eclipse.jpt.core.context.SecondaryTable;
-import org.eclipse.jpt.core.context.Table;
-import org.eclipse.jpt.ui.internal.JpaHelpContextIds;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
import org.eclipse.jpt.ui.internal.widgets.AddRemoveListPane;
-import org.eclipse.jpt.utility.internal.model.value.ItemPropertyListValueModelAdapter;
-import org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter;
import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.swing.ObjectListSelectionModel;
-import org.eclipse.jpt.utility.model.value.ListValueModel;
import org.eclipse.jpt.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
import org.eclipse.swt.widgets.Composite;
@@ -46,16 +40,15 @@ import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
* | ------------------------------------------------------------------------- |
* -----------------------------------------------------------------------------</pre>
*
- * @see Entity
- * @see EntityComposite - The container of this pane
+ * @see OrmEntity
+ * @see OrmEntityComposite - The container of this pane
* @see AddRemoveListPane
* @see PrimaryKeyJoinColumnsInSecondaryTableComposite
*
- * @TODO handle xml, how to handle virtual secondaryTables, adding them to xml, are they overriden, etc??
* @version 2.0
* @since 1.0
*/
-public class SecondaryTablesComposite extends AbstractFormPane<Entity>
+public abstract class AbstractSecondaryTablesComposite<T extends Entity> extends AbstractFormPane<T>
{
/**
* Creates a new <code>SecondaryTablesComposite</code>.
@@ -63,7 +56,7 @@ public class SecondaryTablesComposite extends AbstractFormPane<Entity>
* @param parentPane The parent container of this one
* @param parent The parent container
*/
- public SecondaryTablesComposite(AbstractFormPane<? extends Entity> parentPane,
+ public AbstractSecondaryTablesComposite(AbstractFormPane<? extends T> parentPane,
Composite parent) {
super(parentPane, parent, false);
@@ -76,7 +69,7 @@ public class SecondaryTablesComposite extends AbstractFormPane<Entity>
* @param parent The parent container
* @param widgetFactory The factory used to create various common widgets
*/
- public SecondaryTablesComposite(PropertyValueModel<? extends Entity> subjectHolder,
+ public AbstractSecondaryTablesComposite(PropertyValueModel<? extends T> subjectHolder,
Composite parent,
TabbedPropertySheetWidgetFactory widgetFactory) {
@@ -99,11 +92,11 @@ public class SecondaryTablesComposite extends AbstractFormPane<Entity>
}
}
- private WritablePropertyValueModel<SecondaryTable> buildSecondaryTableHolder() {
+ protected WritablePropertyValueModel<SecondaryTable> buildSecondaryTableHolder() {
return new SimplePropertyValueModel<SecondaryTable>();
}
- private ILabelProvider buildSecondaryTableLabelProvider() {
+ protected ILabelProvider buildSecondaryTableLabelProvider() {
return new LabelProvider() {
@Override
public String getText(Object element) {
@@ -117,7 +110,7 @@ public class SecondaryTablesComposite extends AbstractFormPane<Entity>
};
}
- private AddRemoveListPane.Adapter buildSecondaryTablesAdapter() {
+ protected AddRemoveListPane.Adapter buildSecondaryTablesAdapter() {
return new AddRemoveListPane.AbstractAdapter() {
public void addNewItem(ObjectListSelectionModel listSelectionModel) {
@@ -150,24 +143,23 @@ public class SecondaryTablesComposite extends AbstractFormPane<Entity>
entity.removeSpecifiedSecondaryTable(selectedIndices[index]);
}
}
- };
- }
-
- private ListValueModel<SecondaryTable> buildSecondaryTablesListModel() {
- return new ItemPropertyListValueModelAdapter<SecondaryTable>(buildSecondaryTablesListHolder(),
- Table.SPECIFIED_NAME_PROPERTY);
- }
-
- private ListValueModel<SecondaryTable> buildSecondaryTablesListHolder() {
- return new ListAspectAdapter<Entity, SecondaryTable>(getSubjectHolder(), Entity.SPECIFIED_SECONDARY_TABLES_LIST) {
+
@Override
- protected ListIterator<SecondaryTable> listIterator_() {
- return subject.secondaryTables();
+ public boolean enableOptionOnSelectionChange(ObjectListSelectionModel listSelectionModel) {
+ if (listSelectionModel.selectedValuesSize() != 1) {
+ return false;
+ }
+ SecondaryTable secondaryTable = (SecondaryTable) listSelectionModel.selectedValue();
+ return !secondaryTable.isVirtual();
}
-
+
@Override
- protected int size_() {
- return subject.secondaryTablesSize();
+ public boolean enableRemoveOnSelectionChange(ObjectListSelectionModel listSelectionModel) {
+ if (listSelectionModel.selectedValue() == null) {
+ return false;
+ }
+ SecondaryTable secondaryTable = (SecondaryTable) listSelectionModel.selectedValue();
+ return !secondaryTable.isVirtual();
}
};
}
@@ -206,33 +198,4 @@ public class SecondaryTablesComposite extends AbstractFormPane<Entity>
}
}
- /*
- * (non-Javadoc)
- */
- @Override
- protected void initializeLayout(Composite container) {
-
- int groupBoxMargin = groupBoxMargin();
-
- WritablePropertyValueModel<SecondaryTable> secondaryTableHolder =
- buildSecondaryTableHolder();
-
- // Secondary Tables add/remove list pane
- new AddRemoveListPane<Entity>(
- this,
- buildSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin),
- buildSecondaryTablesAdapter(),
- buildSecondaryTablesListModel(),
- secondaryTableHolder,
- buildSecondaryTableLabelProvider(),
- JpaHelpContextIds.MAPPING_JOIN_TABLE_COLUMNS//TODO need a help context id for this
- );
-
- // Primary Key Join Columns pane
- new PrimaryKeyJoinColumnsInSecondaryTableComposite(
- this,
- secondaryTableHolder,
- container
- );
- }
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnsInSecondaryTableComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnsInSecondaryTableComposite.java
index f9c8d832e1..d121bc8ff2 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnsInSecondaryTableComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnsInSecondaryTableComposite.java
@@ -130,7 +130,10 @@ public class PrimaryKeyJoinColumnsInSecondaryTableComposite extends AbstractForm
return new TransformationPropertyValueModel<SecondaryTable, Boolean>(getSubjectHolder()) {
@Override
protected Boolean transform(SecondaryTable value) {
- return (value != null);
+ if (value == null) {
+ return Boolean.FALSE;
+ }
+ return Boolean.valueOf(!value.isVirtual());
}
};
}
@@ -211,10 +214,6 @@ public class PrimaryKeyJoinColumnsInSecondaryTableComposite extends AbstractForm
};
}
- private WritablePropertyValueModel<Boolean> buildOverrideDefaultHolder() {
- return new OverrideDefaultJoinColumnHolder();
- }
-
private WritablePropertyValueModel<Boolean> buildOverrideDefaultJoinColumnHolder() {
return new OverrideDefaultJoinColumnHolder();
}
@@ -324,7 +323,7 @@ public class PrimaryKeyJoinColumnsInSecondaryTableComposite extends AbstractForm
Button button = buildCheckBox(
buildSubPane(groupPane, 8),
JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_overrideDefaultPrimaryKeyJoinColumns,
- buildOverrideDefaultHolder()
+ buildOverrideDefaultJoinColumnHolder()
);
installOverrideDefaultButtonEnabler(button);
@@ -415,7 +414,10 @@ public class PrimaryKeyJoinColumnsInSecondaryTableComposite extends AbstractForm
@Override
protected Boolean buildValue() {
- return listHolder.size() > 0;
+ if (subject() == null) {
+ return Boolean.FALSE;
+ }
+ return !subject().isVirtual() && listHolder.size() > 0;
}
public void setValue(Boolean value) {
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/QueriesComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/QueriesComposite.java
index 230a1a617a..d43ab58a9d 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/QueriesComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/QueriesComposite.java
@@ -45,7 +45,7 @@ public class QueriesComposite extends AbstractFormPane<Entity>
* @param parentPane The parent controller of this one
* @param parent The parent container
*/
- public QueriesComposite(AbstractFormPane<Entity> parentPane,
+ public QueriesComposite(AbstractFormPane<? extends Entity> parentPane,
Composite parent) {
super(parentPane, parent);
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/SecondaryTableDialog.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/SecondaryTableDialog.java
index 23cc58c191..a831045faf 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/SecondaryTableDialog.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/SecondaryTableDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
+ * Copyright (c) 2006, 2008 Oracle. All rights reserved. This
* program and the accompanying materials are made available under the terms of
* the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@@ -46,12 +46,12 @@ public class SecondaryTableDialog extends Dialog {
private boolean defaultSchemaSelected;
private boolean defaultCatalogSelected;
- SecondaryTableDialog(Shell parent, Entity entity) {
+ public SecondaryTableDialog(Shell parent, Entity entity) {
super(parent);
this.entity = entity;
}
- SecondaryTableDialog(Shell parent, SecondaryTable secondaryTable, Entity entity) {
+ public SecondaryTableDialog(Shell parent, SecondaryTable secondaryTable, Entity entity) {
super(parent);
this.secondaryTable = secondaryTable;
this.entity = entity;
@@ -212,23 +212,23 @@ public class SecondaryTableDialog extends Dialog {
}
- protected String getSelectedName() {
+ public String getSelectedName() {
return this.selectedName;
}
- protected String getSelectedCatalog() {
+ public String getSelectedCatalog() {
return this.selectedCatalog;
}
- protected String getSelectedSchema() {
+ public String getSelectedSchema() {
return this.selectedSchema;
}
- protected boolean isDefaultSchemaSelected() {
+ public boolean isDefaultSchemaSelected() {
return this.defaultSchemaSelected;
}
- protected boolean isDefaultCatalogSelected() {
+ public boolean isDefaultCatalogSelected() {
return this.defaultCatalogSelected;
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/orm/details/OrmEntityComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/orm/details/OrmEntityComposite.java
new file mode 100644
index 0000000000..a488a2d6de
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/orm/details/OrmEntityComposite.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Oracle. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: Oracle. - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.ui.internal.orm.details;
+
+import org.eclipse.jpt.core.context.orm.OrmEntity;
+import org.eclipse.jpt.ui.internal.mappings.details.AbstractEntityComposite;
+import org.eclipse.jpt.ui.internal.widgets.WidgetFactory;
+import org.eclipse.jpt.utility.model.value.PropertyValueModel;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * Here the layout of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | EntityNameCombo | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | TableComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | |
+ * | - v Attribute Overrides ------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | OverridesComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | |
+ * | - v Secondary Tables ---------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | SecondaryTablesComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | |
+ * | - v Inheritance --------------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | InheritanceComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @see BasicMapping
+ * @see BaseJpaUiFactory - The factory creating this pane
+ * @see EntityNameCombo
+ * @see InheritanceComposite
+ * @see OverridesComposite
+ * @see SecondaryTablesComposite
+ * @see TableComposite
+ *
+ * TODO talk to JavaEditor people about what we can do to hook in TabbedProperties for the JavaEditor
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+public class OrmEntityComposite extends AbstractEntityComposite<OrmEntity>
+{
+ /**
+ * Creates a new <code>EntityComposite</code>.
+ *
+ * @param subjectHolder The holder of the subject <code>IEntity</code>
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public OrmEntityComposite(PropertyValueModel<? extends OrmEntity> subjectHolder,
+ Composite parent,
+ WidgetFactory widgetFactory) {
+
+ super(subjectHolder, parent, widgetFactory);
+ }
+
+ @Override
+ protected void buildSecondaryTablesComposite(Composite container) {
+ new OrmSecondaryTablesComposite(this, container);
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/orm/details/OrmEntityUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/orm/details/OrmEntityUiProvider.java
new file mode 100644
index 0000000000..4003031a90
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/orm/details/OrmEntityUiProvider.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.ui.internal.orm.details;
+
+import org.eclipse.jpt.core.MappingKeys;
+import org.eclipse.jpt.core.context.orm.OrmEntity;
+import org.eclipse.jpt.ui.JpaUiFactory;
+import org.eclipse.jpt.ui.details.JpaComposite;
+import org.eclipse.jpt.ui.details.TypeMappingUiProvider;
+import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
+import org.eclipse.jpt.ui.internal.widgets.WidgetFactory;
+import org.eclipse.jpt.utility.model.value.PropertyValueModel;
+import org.eclipse.swt.widgets.Composite;
+
+public class OrmEntityUiProvider implements TypeMappingUiProvider<OrmEntity>
+{
+ // singleton
+ private static final OrmEntityUiProvider INSTANCE = new OrmEntityUiProvider();
+
+ /**
+ * Return the singleton.
+ */
+ public static TypeMappingUiProvider<OrmEntity> instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private OrmEntityUiProvider() {
+ super();
+ }
+
+ public String mappingKey() {
+ return MappingKeys.ENTITY_TYPE_MAPPING_KEY;
+ }
+
+ public String label() {
+ return JptUiMappingsMessages.PersistentTypePage_EntityLabel;
+ }
+
+ public JpaComposite<OrmEntity> buildPersistentTypeMappingComposite(
+ JpaUiFactory factory,
+ PropertyValueModel<OrmEntity> subjectHolder,
+ Composite parent,
+ WidgetFactory widgetFactory) {
+
+ return factory.createOrmEntityComposite(subjectHolder, parent, widgetFactory);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/orm/details/OrmPersistentAttributeDetailsPage.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/orm/details/OrmPersistentAttributeDetailsPage.java
index 9b612c2d72..a940e02799 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/orm/details/OrmPersistentAttributeDetailsPage.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/orm/details/OrmPersistentAttributeDetailsPage.java
@@ -17,18 +17,18 @@ import org.eclipse.jpt.core.context.AttributeMapping;
import org.eclipse.jpt.core.context.PersistentAttribute;
import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
+import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
+import org.eclipse.jpt.ui.internal.details.BasicMappingUiProvider;
+import org.eclipse.jpt.ui.internal.details.EmbeddedIdMappingUiProvider;
+import org.eclipse.jpt.ui.internal.details.EmbeddedMappingUiProvider;
+import org.eclipse.jpt.ui.internal.details.IdMappingUiProvider;
+import org.eclipse.jpt.ui.internal.details.ManyToManyMappingUiProvider;
+import org.eclipse.jpt.ui.internal.details.ManyToOneMappingUiProvider;
+import org.eclipse.jpt.ui.internal.details.OneToManyMappingUiProvider;
+import org.eclipse.jpt.ui.internal.details.OneToOneMappingUiProvider;
import org.eclipse.jpt.ui.internal.details.PersistentAttributeDetailsPage;
-import org.eclipse.jpt.ui.internal.java.details.BasicMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.details.EmbeddedIdMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.details.EmbeddedMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.details.IdMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.details.ManyToManyMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.details.ManyToOneMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.details.OneToManyMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.details.OneToOneMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.details.TransientMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.details.VersionMappingUiProvider;
-import org.eclipse.jpt.ui.java.details.AttributeMappingUiProvider;
+import org.eclipse.jpt.ui.internal.details.TransientMappingUiProvider;
+import org.eclipse.jpt.ui.internal.details.VersionMappingUiProvider;
import org.eclipse.jpt.utility.internal.CollectionTools;
import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/orm/details/OrmPersistentTypeDetailsPage.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/orm/details/OrmPersistentTypeDetailsPage.java
index ef739b2826..8bd5e4aeff 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/orm/details/OrmPersistentTypeDetailsPage.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/orm/details/OrmPersistentTypeDetailsPage.java
@@ -18,13 +18,12 @@ import org.eclipse.jpt.core.context.PersistentType;
import org.eclipse.jpt.core.context.TypeMapping;
import org.eclipse.jpt.core.context.orm.OrmPersistentType;
import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
+import org.eclipse.jpt.ui.details.TypeMappingUiProvider;
import org.eclipse.jpt.ui.internal.JptUiMessages;
+import org.eclipse.jpt.ui.internal.details.EmbeddableUiProvider;
+import org.eclipse.jpt.ui.internal.details.MappedSuperclassUiProvider;
import org.eclipse.jpt.ui.internal.details.PersistentTypeDetailsPage;
-import org.eclipse.jpt.ui.internal.java.details.EmbeddableUiProvider;
-import org.eclipse.jpt.ui.internal.java.details.EntityUiProvider;
-import org.eclipse.jpt.ui.internal.java.details.MappedSuperclassUiProvider;
import org.eclipse.jpt.ui.internal.orm.JptUiOrmMessages;
-import org.eclipse.jpt.ui.java.details.TypeMappingUiProvider;
import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
import org.eclipse.jpt.utility.model.value.PropertyValueModel;
@@ -64,7 +63,7 @@ public class OrmPersistentTypeDetailsPage extends PersistentTypeDetailsPage<OrmP
}
protected void addOrmTypeMappingUiProvidersTo(Collection<TypeMappingUiProvider<? extends TypeMapping>> providers) {
- providers.add(EntityUiProvider.instance());
+ providers.add(OrmEntityUiProvider.instance());
providers.add(MappedSuperclassUiProvider.instance());
providers.add(EmbeddableUiProvider.instance());
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/orm/details/OrmSecondaryTablesComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/orm/details/OrmSecondaryTablesComposite.java
new file mode 100644
index 0000000000..706898db22
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/orm/details/OrmSecondaryTablesComposite.java
@@ -0,0 +1,190 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2008 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.ui.internal.orm.details;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ListIterator;
+import org.eclipse.jpt.core.context.Entity;
+import org.eclipse.jpt.core.context.SecondaryTable;
+import org.eclipse.jpt.core.context.Table;
+import org.eclipse.jpt.core.context.orm.OrmEntity;
+import org.eclipse.jpt.core.context.orm.OrmSecondaryTable;
+import org.eclipse.jpt.ui.internal.JpaHelpContextIds;
+import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
+import org.eclipse.jpt.ui.internal.mappings.details.AbstractSecondaryTablesComposite;
+import org.eclipse.jpt.ui.internal.mappings.details.PrimaryKeyJoinColumnsInSecondaryTableComposite;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.ui.internal.widgets.AddRemoveListPane;
+import org.eclipse.jpt.utility.internal.model.value.CompositeListValueModel;
+import org.eclipse.jpt.utility.internal.model.value.ItemPropertyListValueModelAdapter;
+import org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter;
+import org.eclipse.jpt.utility.internal.model.value.ListPropertyValueModelAdapter;
+import org.eclipse.jpt.utility.model.value.ListValueModel;
+import org.eclipse.jpt.utility.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
+
+/**
+ * Here the layout of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | AddRemoveListPane | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | PrimaryKeyJoinColumnsInSecondaryTableComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @see OrmEntity
+ * @see OrmEntityComposite - The container of this pane
+ * @see AddRemoveListPane
+ * @see PrimaryKeyJoinColumnsInSecondaryTableComposite
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+public class OrmSecondaryTablesComposite extends AbstractSecondaryTablesComposite<OrmEntity>
+{
+ /**
+ * Creates a new <code>SecondaryTablesComposite</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param parent The parent container
+ */
+ public OrmSecondaryTablesComposite(AbstractFormPane<? extends OrmEntity> parentPane,
+ Composite parent) {
+
+ super(parentPane, parent);
+ }
+
+ /**
+ * Creates a new <code>SecondaryTablesComposite</code>.
+ *
+ * @param subjectHolder The holder of the subject <code>IEntity</code>
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public OrmSecondaryTablesComposite(PropertyValueModel<? extends OrmEntity> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ super(subjectHolder, parent, widgetFactory);
+ }
+
+ private ListValueModel<OrmSecondaryTable> buildSecondaryTablesListModel() {
+ return new ItemPropertyListValueModelAdapter<OrmSecondaryTable>(buildSecondaryTablesListHolder(),
+ Table.SPECIFIED_NAME_PROPERTY);
+ }
+
+ private ListValueModel<OrmSecondaryTable> buildSecondaryTablesListHolder() {
+ List<ListValueModel<OrmSecondaryTable>> list = new ArrayList<ListValueModel<OrmSecondaryTable>>();
+ list.add(buildSpecifiedSecondaryTablesListHolder());
+ list.add(buildVirtualSecondaryTablesListHolder());
+ return new CompositeListValueModel<ListValueModel<OrmSecondaryTable>, OrmSecondaryTable>(list);
+ }
+
+
+ private ListValueModel<OrmSecondaryTable> buildSpecifiedSecondaryTablesListHolder() {
+ return new ListAspectAdapter<OrmEntity, OrmSecondaryTable>(getSubjectHolder(), Entity.SPECIFIED_SECONDARY_TABLES_LIST) {
+ @Override
+ protected ListIterator<OrmSecondaryTable> listIterator_() {
+ return subject.specifiedSecondaryTables();
+ }
+
+ @Override
+ protected int size_() {
+ return subject.specifiedSecondaryTablesSize();
+ }
+ };
+ }
+
+ private ListValueModel<OrmSecondaryTable> buildVirtualSecondaryTablesListHolder() {
+ return new ListAspectAdapter<OrmEntity, OrmSecondaryTable>(getSubjectHolder(), OrmEntity.VIRTUAL_SECONDARY_TABLES_LIST) {
+ @Override
+ protected ListIterator<OrmSecondaryTable> listIterator_() {
+ return subject.virtualSecondaryTables();
+ }
+
+ @Override
+ protected int size_() {
+ return subject.virtualSecondaryTablesSize();
+ }
+ };
+ }
+
+ @Override
+ protected void initializeLayout(Composite container) {
+
+ int groupBoxMargin = groupBoxMargin();
+
+ WritablePropertyValueModel<SecondaryTable> secondaryTableHolder =
+ buildSecondaryTableHolder();
+
+ // Override Define In XML check box
+ buildCheckBox(
+ buildSubPane(container, 8),
+ JptUiMappingsMessages.OrmSecondaryTablesComposite_defineInXml,
+ buildDefineInXmlHolder()
+ );
+
+
+ // Secondary Tables add/remove list pane
+ new AddRemoveListPane<Entity>(
+ this,
+ buildSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin),
+ buildSecondaryTablesAdapter(),
+ buildSecondaryTablesListModel(),
+ secondaryTableHolder,
+ buildSecondaryTableLabelProvider(),
+ JpaHelpContextIds.MAPPING_JOIN_TABLE_COLUMNS//TODO need a help context id for this
+ );
+
+ // Primary Key Join Columns pane
+ new PrimaryKeyJoinColumnsInSecondaryTableComposite(
+ this,
+ secondaryTableHolder,
+ container
+ );
+ }
+
+
+ private WritablePropertyValueModel<Boolean> buildDefineInXmlHolder() {
+ return new DefineInXmlHolder();
+ }
+
+ private class DefineInXmlHolder extends ListPropertyValueModelAdapter<Boolean>
+ implements WritablePropertyValueModel<Boolean> {
+
+ public DefineInXmlHolder() {
+ super(buildVirtualSecondaryTablesListHolder());
+ }
+
+ @Override
+ protected Boolean buildValue() {
+ if (subject() == null) {
+ return Boolean.FALSE;
+ }
+ return Boolean.valueOf(subject().secondaryTablesDefinedInXml());
+ }
+
+ public void setValue(Boolean value) {
+ subject().setSecondaryTablesDefinedInXml(value.booleanValue());
+ }
+ }
+
+
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/platform/base/BaseJpaPlatformUi.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/platform/base/BaseJpaPlatformUi.java
index d71107e0d0..09a39a94a0 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/platform/base/BaseJpaPlatformUi.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/platform/base/BaseJpaPlatformUi.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -27,31 +27,31 @@ import org.eclipse.jpt.core.resource.orm.OrmResourceModel;
import org.eclipse.jpt.core.resource.persistence.PersistenceResourceModel;
import org.eclipse.jpt.ui.JpaPlatformUi;
import org.eclipse.jpt.ui.JpaUiFactory;
+import org.eclipse.jpt.ui.details.AttributeMappingUiProvider;
import org.eclipse.jpt.ui.details.JpaDetailsProvider;
-import org.eclipse.jpt.ui.internal.java.details.BasicMappingUiProvider;
+import org.eclipse.jpt.ui.details.TypeMappingUiProvider;
+import org.eclipse.jpt.ui.internal.details.BasicMappingUiProvider;
+import org.eclipse.jpt.ui.internal.details.EmbeddableUiProvider;
+import org.eclipse.jpt.ui.internal.details.EmbeddedIdMappingUiProvider;
+import org.eclipse.jpt.ui.internal.details.EmbeddedMappingUiProvider;
+import org.eclipse.jpt.ui.internal.details.IdMappingUiProvider;
+import org.eclipse.jpt.ui.internal.details.ManyToManyMappingUiProvider;
+import org.eclipse.jpt.ui.internal.details.ManyToOneMappingUiProvider;
+import org.eclipse.jpt.ui.internal.details.MappedSuperclassUiProvider;
+import org.eclipse.jpt.ui.internal.details.OneToManyMappingUiProvider;
+import org.eclipse.jpt.ui.internal.details.OneToOneMappingUiProvider;
+import org.eclipse.jpt.ui.internal.details.TransientMappingUiProvider;
+import org.eclipse.jpt.ui.internal.details.VersionMappingUiProvider;
import org.eclipse.jpt.ui.internal.java.details.DefaultBasicMappingUiProvider;
import org.eclipse.jpt.ui.internal.java.details.DefaultEmbeddedMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.details.EmbeddableUiProvider;
-import org.eclipse.jpt.ui.internal.java.details.EmbeddedIdMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.details.EmbeddedMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.details.EntityUiProvider;
-import org.eclipse.jpt.ui.internal.java.details.IdMappingUiProvider;
+import org.eclipse.jpt.ui.internal.java.details.JavaEntityUiProvider;
import org.eclipse.jpt.ui.internal.java.details.JavaDetailsProvider;
-import org.eclipse.jpt.ui.internal.java.details.ManyToManyMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.details.ManyToOneMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.details.MappedSuperclassUiProvider;
import org.eclipse.jpt.ui.internal.java.details.NullTypeMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.details.OneToManyMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.details.OneToOneMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.details.TransientMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.details.VersionMappingUiProvider;
import org.eclipse.jpt.ui.internal.orm.details.OrmDetailsProvider;
import org.eclipse.jpt.ui.internal.structure.JavaResourceModelStructureProvider;
import org.eclipse.jpt.ui.internal.structure.JpaStructureProvider;
import org.eclipse.jpt.ui.internal.structure.OrmResourceModelStructureProvider;
import org.eclipse.jpt.ui.internal.structure.PersistenceResourceModelStructureProvider;
-import org.eclipse.jpt.ui.java.details.AttributeMappingUiProvider;
-import org.eclipse.jpt.ui.java.details.TypeMappingUiProvider;
import org.eclipse.jpt.utility.internal.iterators.CloneIterator;
import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
import org.eclipse.ui.navigator.ICommonContentProvider;
@@ -166,7 +166,7 @@ public abstract class BaseJpaPlatformUi implements JpaPlatformUi
*/
protected void addJavaTypeMappingUiProvidersTo(List<TypeMappingUiProvider<? extends TypeMapping>> providers) {
providers.add(NullTypeMappingUiProvider.instance());
- providers.add(EntityUiProvider.instance());
+ providers.add(JavaEntityUiProvider.instance());
providers.add(MappedSuperclassUiProvider.instance());
providers.add(EmbeddableUiProvider.instance());
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/AddRemovePane.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/AddRemovePane.java
index 7604f0e363..80ea31cad7 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/AddRemovePane.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/AddRemovePane.java
@@ -509,7 +509,7 @@ public abstract class AddRemovePane<T extends Model> extends AbstractPane<T>
protected void updateAddButton(Button addButton) {
addButton.setEnabled(
getControl().isEnabled() &&
- (subject() != null)
+ subject() != null
);
}
@@ -542,7 +542,7 @@ public abstract class AddRemovePane<T extends Model> extends AbstractPane<T>
protected void updateRemoveButton(Button removeButton) {
removeButton.setEnabled(
getControl().isEnabled() &&
- selectionModel.selectedValue() != null
+ adapter.enableRemoveOnSelectionChange(selectionModel)
);
}
@@ -642,7 +642,11 @@ public abstract class AddRemovePane<T extends Model> extends AbstractPane<T>
public String addButtonText() {
return addButtonText;
}
-
+
+ public boolean enableRemoveOnSelectionChange(ObjectListSelectionModel listSelectionModel) {
+ return listSelectionModel.selectedValue() != null;
+ }
+
/*
* (non-Javadoc)
*/
@@ -740,6 +744,12 @@ public abstract class AddRemovePane<T extends Model> extends AbstractPane<T>
void addNewItem(ObjectListSelectionModel listSelectionModel);
/**
+ * Invoked when selection changes. Implementation dictates whether remove button
+ * should be enabled.
+ */
+ boolean enableRemoveOnSelectionChange(ObjectListSelectionModel listSelectionModel);
+
+ /**
* Invoked when selection changes. Implementation dictates whether button
* should be enabled.
*/

Back to the top