Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Taal2015-08-03 10:24:21 -0400
committerMartin Taal2015-08-03 10:24:21 -0400
commit43dc2bac2647fd9af9441e981de584ae606515d3 (patch)
tree8dbc68282b8cdbd40103677fff140a7121bc2845
parent5c8d5fef8ff5e89e18fa88692241cdc27cbc84fe (diff)
downloadorg.eclipse.emf.texo-43dc2bac2647fd9af9441e981de584ae606515d3.tar.gz
org.eclipse.emf.texo-43dc2bac2647fd9af9441e981de584ae606515d3.tar.xz
org.eclipse.emf.texo-43dc2bac2647fd9af9441e981de584ae606515d3.zip
Solve issue with cascade type empty showing instead of detach
-rwxr-xr-xgenerator/org.eclipse.emf.texo.orm.edit/src/org/eclipse/emf/texo/orm/annotations/model/orm/provider/CascadeTypeItemProvider.java217
-rwxr-xr-xgenerator/org.eclipse.emf.texo.orm.edit/src/org/eclipse/emf/texo/orm/annotations/model/orm/provider/EmptyTypeItemProvider.java5
-rwxr-xr-xgenerator/org.eclipse.emf.texo.orm/src/org/eclipse/emf/texo/orm/annotations/model/orm/impl/CascadeTypeImpl.java4
-rw-r--r--generator/org.eclipse.emf.texo.orm/src/org/eclipse/emf/texo/orm/annotator/ORMJavaAnnotationGenerator.java4
4 files changed, 113 insertions, 117 deletions
diff --git a/generator/org.eclipse.emf.texo.orm.edit/src/org/eclipse/emf/texo/orm/annotations/model/orm/provider/CascadeTypeItemProvider.java b/generator/org.eclipse.emf.texo.orm.edit/src/org/eclipse/emf/texo/orm/annotations/model/orm/provider/CascadeTypeItemProvider.java
index ac03d268..6140ad35 100755
--- a/generator/org.eclipse.emf.texo.orm.edit/src/org/eclipse/emf/texo/orm/annotations/model/orm/provider/CascadeTypeItemProvider.java
+++ b/generator/org.eclipse.emf.texo.orm.edit/src/org/eclipse/emf/texo/orm/annotations/model/orm/provider/CascadeTypeItemProvider.java
@@ -28,150 +28,140 @@ import org.eclipse.emf.texo.orm.annotations.model.orm.OrmPackage;
/**
* This is the item provider adapter for a {@link org.eclipse.emf.texo.orm.annotations.model.orm.CascadeType} object.
* <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
* @generated
*/
public class CascadeTypeItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider,
IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource {
/**
- * This constructs an instance from a factory and a notifier.
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
+ * This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
public CascadeTypeItemProvider(AdapterFactory adapterFactory) {
- super(adapterFactory);
- }
+ super(adapterFactory);
+ }
/**
- * This returns the property descriptors for the adapted class.
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
+ * This returns the property descriptors for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
@Override
public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
- if (itemPropertyDescriptors == null) {
- super.getPropertyDescriptors(object);
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
- }
- return itemPropertyDescriptors;
- }
+ }
+ return itemPropertyDescriptors;
+ }
/**
- * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
- * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
- * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
- * <!-- begin-user-doc --> <!--
+ * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
+ * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
+ * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. <!-- begin-user-doc --> <!--
* end-user-doc -->
- * @generated
- */
+ *
+ * @generated
+ */
@Override
public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
- if (childrenFeatures == null) {
- super.getChildrenFeatures(object);
- childrenFeatures.add(OrmPackage.eINSTANCE.getCascadeType_CascadeAll());
- childrenFeatures.add(OrmPackage.eINSTANCE.getCascadeType_CascadePersist());
- childrenFeatures.add(OrmPackage.eINSTANCE.getCascadeType_CascadeMerge());
- childrenFeatures.add(OrmPackage.eINSTANCE.getCascadeType_CascadeRemove());
- childrenFeatures.add(OrmPackage.eINSTANCE.getCascadeType_CascadeRefresh());
- childrenFeatures.add(OrmPackage.eINSTANCE.getCascadeType_CascadeDetach());
- }
- return childrenFeatures;
- }
+ if (childrenFeatures == null) {
+ super.getChildrenFeatures(object);
+ childrenFeatures.add(OrmPackage.eINSTANCE.getCascadeType_CascadeAll());
+ childrenFeatures.add(OrmPackage.eINSTANCE.getCascadeType_CascadePersist());
+ childrenFeatures.add(OrmPackage.eINSTANCE.getCascadeType_CascadeMerge());
+ childrenFeatures.add(OrmPackage.eINSTANCE.getCascadeType_CascadeRemove());
+ childrenFeatures.add(OrmPackage.eINSTANCE.getCascadeType_CascadeRefresh());
+ childrenFeatures.add(OrmPackage.eINSTANCE.getCascadeType_CascadeDetach());
+ }
+ return childrenFeatures;
+ }
/**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
@Override
protected EStructuralFeature getChildFeature(Object object, Object child) {
- // Check the type of the specified child object and return the proper feature to use for
- // adding (see {@link AddCommand}) it as a child.
+ // Check the type of the specified child object and return the proper feature to use for
+ // adding (see {@link AddCommand}) it as a child.
- return super.getChildFeature(object, child);
- }
+ return super.getChildFeature(object, child);
+ }
/**
- * This returns CascadeType.gif.
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
+ * This returns CascadeType.gif. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
@Override
public Object getImage(Object object) {
- return overlayImage(object, getResourceLocator().getImage("full/obj16/CascadeType"));
- }
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/CascadeType"));
+ }
/**
- * This returns the label text for the adapted class.
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
+ * This returns the label text for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
@Override
public String getText(Object object) {
- return getString("_UI_CascadeType_type");
- }
+ return getString("_UI_CascadeType_type");
+ }
/**
- * This handles model notifications by calling {@link #updateChildren} to update any cached
- * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
+ * This handles model notifications by calling {@link #updateChildren} to update any cached children and by creating a
+ * viewer notification, which it passes to {@link #fireNotifyChanged}. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
@Override
public void notifyChanged(Notification notification) {
- updateChildren(notification);
-
- switch (notification.getFeatureID(CascadeType.class)) {
- case OrmPackage.CASCADE_TYPE__CASCADE_ALL:
- case OrmPackage.CASCADE_TYPE__CASCADE_PERSIST:
- case OrmPackage.CASCADE_TYPE__CASCADE_MERGE:
- case OrmPackage.CASCADE_TYPE__CASCADE_REMOVE:
- case OrmPackage.CASCADE_TYPE__CASCADE_REFRESH:
- case OrmPackage.CASCADE_TYPE__CASCADE_DETACH:
- fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
- return;
- }
- super.notifyChanged(notification);
- }
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(CascadeType.class)) {
+ case OrmPackage.CASCADE_TYPE__CASCADE_ALL:
+ case OrmPackage.CASCADE_TYPE__CASCADE_PERSIST:
+ case OrmPackage.CASCADE_TYPE__CASCADE_MERGE:
+ case OrmPackage.CASCADE_TYPE__CASCADE_REMOVE:
+ case OrmPackage.CASCADE_TYPE__CASCADE_REFRESH:
+ case OrmPackage.CASCADE_TYPE__CASCADE_DETACH:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
/**
- * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
- * that can be created under this object.
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children that can be created under
+ * this object. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
@Override
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
- super.collectNewChildDescriptors(newChildDescriptors, object);
-
- newChildDescriptors.add
- (createChildParameter
- (OrmPackage.eINSTANCE.getCascadeType_CascadeAll(),
- OrmFactory.eINSTANCE.createEmptyType()));
-
- newChildDescriptors.add
- (createChildParameter
- (OrmPackage.eINSTANCE.getCascadeType_CascadePersist(),
- OrmFactory.eINSTANCE.createEmptyType()));
-
- newChildDescriptors.add
- (createChildParameter
- (OrmPackage.eINSTANCE.getCascadeType_CascadeMerge(),
- OrmFactory.eINSTANCE.createEmptyType()));
-
- newChildDescriptors.add
- (createChildParameter
- (OrmPackage.eINSTANCE.getCascadeType_CascadeRemove(),
- OrmFactory.eINSTANCE.createEmptyType()));
-
- newChildDescriptors.add
- (createChildParameter
- (OrmPackage.eINSTANCE.getCascadeType_CascadeRefresh(),
- OrmFactory.eINSTANCE.createEmptyType()));
-
- newChildDescriptors.add
- (createChildParameter
- (OrmPackage.eINSTANCE.getCascadeType_CascadeDetach(),
- OrmFactory.eINSTANCE.createEmptyType()));
- }
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+
+ newChildDescriptors.add(createChildParameter(OrmPackage.eINSTANCE.getCascadeType_CascadeAll(),
+ OrmFactory.eINSTANCE.createEmptyType()));
+
+ newChildDescriptors.add(createChildParameter(OrmPackage.eINSTANCE.getCascadeType_CascadePersist(),
+ OrmFactory.eINSTANCE.createEmptyType()));
+
+ newChildDescriptors.add(createChildParameter(OrmPackage.eINSTANCE.getCascadeType_CascadeMerge(),
+ OrmFactory.eINSTANCE.createEmptyType()));
+
+ newChildDescriptors.add(createChildParameter(OrmPackage.eINSTANCE.getCascadeType_CascadeRemove(),
+ OrmFactory.eINSTANCE.createEmptyType()));
+
+ newChildDescriptors.add(createChildParameter(OrmPackage.eINSTANCE.getCascadeType_CascadeRefresh(),
+ OrmFactory.eINSTANCE.createEmptyType()));
+
+ newChildDescriptors.add(createChildParameter(OrmPackage.eINSTANCE.getCascadeType_CascadeDetach(),
+ OrmFactory.eINSTANCE.createEmptyType()));
+ }
/**
* This returns the label text for {@link org.eclipse.emf.edit.command.CreateChildCommand}. <!-- begin-user-doc -->
@@ -187,6 +177,7 @@ public class CascadeTypeItemProvider extends ItemProviderAdapter implements IEdi
boolean qualify = childFeature == OrmPackage.eINSTANCE.getCascadeType_CascadeAll()
|| childFeature == OrmPackage.eINSTANCE.getCascadeType_CascadePersist()
|| childFeature == OrmPackage.eINSTANCE.getCascadeType_CascadeMerge()
+ || childFeature == OrmPackage.eINSTANCE.getCascadeType_CascadeDetach()
|| childFeature == OrmPackage.eINSTANCE.getCascadeType_CascadeRemove()
|| childFeature == OrmPackage.eINSTANCE.getCascadeType_CascadeRefresh();
@@ -200,13 +191,13 @@ public class CascadeTypeItemProvider extends ItemProviderAdapter implements IEdi
}
/**
- * Return the resource locator for this item provider's resources.
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
+ * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
@Override
public ResourceLocator getResourceLocator() {
- return Eclipselink_ormEditPlugin.INSTANCE;
- }
+ return Eclipselink_ormEditPlugin.INSTANCE;
+ }
}
diff --git a/generator/org.eclipse.emf.texo.orm.edit/src/org/eclipse/emf/texo/orm/annotations/model/orm/provider/EmptyTypeItemProvider.java b/generator/org.eclipse.emf.texo.orm.edit/src/org/eclipse/emf/texo/orm/annotations/model/orm/provider/EmptyTypeItemProvider.java
index 0e07f999..3db16a06 100755
--- a/generator/org.eclipse.emf.texo.orm.edit/src/org/eclipse/emf/texo/orm/annotations/model/orm/provider/EmptyTypeItemProvider.java
+++ b/generator/org.eclipse.emf.texo.orm.edit/src/org/eclipse/emf/texo/orm/annotations/model/orm/provider/EmptyTypeItemProvider.java
@@ -28,7 +28,7 @@ import org.eclipse.emf.edit.provider.ItemProviderAdapter;
* @generated
*/
public class EmptyTypeItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider,
-IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource {
+ IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource {
/**
* This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!-- end-user-doc -->
*
@@ -70,8 +70,7 @@ IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, II
@Override
public String getText(Object object) {
final EObject eObject = (EObject) object;
- // return getString("_UI_" + eObject.eContainingFeature().getName());
- return getString("_UI_EmptyType_type");
+ return getString("_UI_" + eObject.eContainingFeature().getName());
}
/**
diff --git a/generator/org.eclipse.emf.texo.orm/src/org/eclipse/emf/texo/orm/annotations/model/orm/impl/CascadeTypeImpl.java b/generator/org.eclipse.emf.texo.orm/src/org/eclipse/emf/texo/orm/annotations/model/orm/impl/CascadeTypeImpl.java
index 5577f29d..14754635 100755
--- a/generator/org.eclipse.emf.texo.orm/src/org/eclipse/emf/texo/orm/annotations/model/orm/impl/CascadeTypeImpl.java
+++ b/generator/org.eclipse.emf.texo.orm/src/org/eclipse/emf/texo/orm/annotations/model/orm/impl/CascadeTypeImpl.java
@@ -586,6 +586,10 @@ public class CascadeTypeImpl extends BaseOrmAnnotationImpl implements CascadeTyp
sb.append("javax.persistence.CascadeType.ALL"); //$NON-NLS-1$
} else {
boolean addComma = false;
+ if (getCascadeDetach() != null) {
+ sb.append("javax.persistence.CascadeType.DETACH"); //$NON-NLS-1$
+ addComma = true;
+ }
if (getCascadeMerge() != null) {
sb.append("javax.persistence.CascadeType.MERGE"); //$NON-NLS-1$
addComma = true;
diff --git a/generator/org.eclipse.emf.texo.orm/src/org/eclipse/emf/texo/orm/annotator/ORMJavaAnnotationGenerator.java b/generator/org.eclipse.emf.texo.orm/src/org/eclipse/emf/texo/orm/annotator/ORMJavaAnnotationGenerator.java
index 16deb5cc..cf79b5e8 100644
--- a/generator/org.eclipse.emf.texo.orm/src/org/eclipse/emf/texo/orm/annotator/ORMJavaAnnotationGenerator.java
+++ b/generator/org.eclipse.emf.texo.orm/src/org/eclipse/emf/texo/orm/annotator/ORMJavaAnnotationGenerator.java
@@ -210,7 +210,7 @@ public class ORMJavaAnnotationGenerator {
continue;
}
separateAnnotation
- .append("@" + getJavaPackage(eFeature.getEType()) + "." + pluralize(upperCaseFirst(getName(eFeature))) + "({"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ .append("@" + getJavaPackage(eFeature.getEType()) + "." + pluralize(upperCaseFirst(getName(eFeature))) + "({"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
boolean addArrayComma = false;
for (Object val : values) {
if (val instanceof BaseOrmAnnotation) {
@@ -263,6 +263,8 @@ public class ORMJavaAnnotationGenerator {
final String javaAnnotation = generateJavaAnnotation(eFeature, value, identifier);
if (javaAnnotation != null) {
sb.append(featureAnnotation.toString() + javaAnnotation);
+ } else {
+ addComma = false;
}
}
}

Back to the top