Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortle2009-12-02 21:51:43 -0500
committertle2009-12-02 21:51:43 -0500
commitcfbba89eb7073c1b6107e15c1ce358b28c0a5a69 (patch)
treeee3a7e1d86de653c38f0ba7fbbd546dea0230666
parent78da773e836f4d373dd3264046b449c8d66b6da4 (diff)
downloadwebtools.dali-cfbba89eb7073c1b6107e15c1ce358b28c0a5a69.tar.gz
webtools.dali-cfbba89eb7073c1b6107e15c1ce358b28c0a5a69.tar.xz
webtools.dali-cfbba89eb7073c1b6107e15c1ce358b28c0a5a69.zip
295613 - Persistence.xml > Customization Tab - Add Descriptor Customizer receive Error
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/context/persistence/caching/Caching.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/context/persistence/customization/Customization.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/EclipseLinkCaching.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/EclipseLinkCustomization.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/EntityListComposite.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/EntityListComposite.java3
6 files changed, 44 insertions, 9 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/context/persistence/caching/Caching.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/context/persistence/caching/Caching.java
index e84b16cebc..2cf28d3af7 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/context/persistence/caching/Caching.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/context/persistence/caching/Caching.java
@@ -9,6 +9,7 @@
*******************************************************************************/
package org.eclipse.jpt.eclipselink.core.context.persistence.caching;
+import java.util.Iterator;
import java.util.ListIterator;
import org.eclipse.jpt.core.context.persistence.PersistenceUnitProperties;
@@ -78,6 +79,7 @@ public interface Caching extends PersistenceUnitProperties
ListIterator<Entity> entities();
+ Iterator<String> entityNames();
int entitiesSize();
boolean entityExists(String entity);
Entity addEntity(String entity);
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/context/persistence/customization/Customization.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/context/persistence/customization/Customization.java
index 6b9b00c3a6..41ff94d7bd 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/context/persistence/customization/Customization.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/context/persistence/customization/Customization.java
@@ -9,6 +9,7 @@
*******************************************************************************/
package org.eclipse.jpt.eclipselink.core.context.persistence.customization;
+import java.util.Iterator;
import java.util.ListIterator;
import org.eclipse.jpt.core.context.persistence.PersistenceUnitProperties;
@@ -95,6 +96,7 @@ public interface Customization extends PersistenceUnitProperties
static final String ECLIPSELINK_SESSION_CUSTOMIZER = "eclipselink.session.customizer"; //$NON-NLS-1$
ListIterator<Entity> entities();
+ Iterator<String> entityNames();
int entitiesSize();
boolean entityExists(String entity);
Entity addEntity(String entity);
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/EclipseLinkCaching.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/EclipseLinkCaching.java
index 4294ff4ffb..8a34c6de29 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/EclipseLinkCaching.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/caching/EclipseLinkCaching.java
@@ -10,6 +10,7 @@
package org.eclipse.jpt.eclipselink.core.internal.context.persistence.caching;
import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
@@ -21,6 +22,7 @@ import org.eclipse.jpt.eclipselink.core.context.persistence.caching.Caching;
import org.eclipse.jpt.eclipselink.core.context.persistence.caching.FlushClearCache;
import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnitProperties;
import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
/**
* EclipseLinkCaching encapsulates EclipseLink Caching properties.
@@ -47,7 +49,6 @@ public class EclipseLinkCaching extends EclipseLinkPersistenceUnitProperties
*/
@Override
protected void initializeProperties() {
- // TOREVIEW - handle incorrect String in persistence.xml
this.entities = new ArrayList<Entity>();
this.cacheTypeDefault =
this.getEnumValue(ECLIPSELINK_CACHE_TYPE_DEFAULT, CacheType.values());
@@ -546,6 +547,15 @@ public class EclipseLinkCaching extends EclipseLinkPersistenceUnitProperties
return new CloneListIterator<Entity>(this.entities);
}
+ public Iterator<String> entityNames() {
+ return new TransformationIterator<Entity, String>(this.entities()) {
+ @Override
+ protected String transform(Entity entity) {
+ return entity.getName();
+ }
+ };
+ }
+
public int entitiesSize() {
return this.entities.size();
}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/EclipseLinkCustomization.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/EclipseLinkCustomization.java
index 162cd9a481..b936c3f0c1 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/EclipseLinkCustomization.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/customization/EclipseLinkCustomization.java
@@ -10,6 +10,7 @@
package org.eclipse.jpt.eclipselink.core.internal.context.persistence.customization;
import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
@@ -21,6 +22,7 @@ import org.eclipse.jpt.eclipselink.core.context.persistence.customization.Profil
import org.eclipse.jpt.eclipselink.core.context.persistence.customization.Weaving;
import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnitProperties;
import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
/**
* EclipseLinkCustomization
@@ -54,7 +56,6 @@ public class EclipseLinkCustomization extends EclipseLinkPersistenceUnitProperti
*/
@Override
protected void initializeProperties() {
- // TOREVIEW - handle incorrect String in persistence.xml
this.entities = new ArrayList<Entity>();
this.throwExceptions =
@@ -736,6 +737,15 @@ public class EclipseLinkCustomization extends EclipseLinkPersistenceUnitProperti
return new CloneListIterator<Entity>(this.entities);
}
+ public Iterator<String> entityNames() {
+ return new TransformationIterator<Entity, String>(this.entities()) {
+ @Override
+ protected String transform(Entity entity) {
+ return entity.getName();
+ }
+ };
+ }
+
public int entitiesSize() {
return this.entities.size();
}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/EntityListComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/EntityListComposite.java
index 785bf557b4..dfbca9ad71 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/EntityListComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/caching/EntityListComposite.java
@@ -32,6 +32,7 @@ import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
import org.eclipse.jpt.ui.internal.util.PaneEnabler;
import org.eclipse.jpt.ui.internal.widgets.AddRemoveListPane;
import org.eclipse.jpt.ui.internal.widgets.Pane;
+import org.eclipse.jpt.utility.internal.CollectionTools;
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.TransformationPropertyValueModel;
@@ -49,19 +50,26 @@ import org.eclipse.ui.progress.IProgressService;
*/
public class EntityListComposite<T extends Caching> extends Pane<T>
{
+ WritablePropertyValueModel<Entity> entityHolder;
+
public EntityListComposite(Pane<T> parentComposite, Composite parent) {
super(parentComposite, parent);
}
@Override
+ protected void initialize() {
+ super.initialize();
+ this.entityHolder = this.buildEntityHolder();
+ }
+
+ @Override
protected void initializeLayout(Composite container) {
container = this.addTitledGroup(
container,
EclipseLinkUiMessages.CachingEntityListComposite_groupTitle
);
- WritablePropertyValueModel<Entity> entityHolder = this.buildEntityHolder();
// Entities add/remove list pane
new AddRemoveListPane<Caching>(
@@ -69,7 +77,7 @@ public class EntityListComposite<T extends Caching> extends Pane<T>
container,
this.buildEntitiesAdapter(),
this.buildEntitiesListHolder(),
- entityHolder,
+ this.entityHolder,
this.buildEntityLabelProvider(),
EclipseLinkHelpContextIds.PERSISTENCE_CACHING
);
@@ -77,10 +85,10 @@ public class EntityListComposite<T extends Caching> extends Pane<T>
// Entity Caching property pane
EntityCachingPropertyComposite pane = new EntityCachingPropertyComposite(
this,
- entityHolder,
+ this.entityHolder,
container
);
- this.installPaneEnabler(entityHolder, pane);
+ this.installPaneEnabler(this.entityHolder, pane);
}
private AddRemoveListPane.Adapter buildEntitiesAdapter() {
@@ -111,8 +119,10 @@ public class EntityListComposite<T extends Caching> extends Pane<T>
if( ! this.getSubject().entityExists(entityName)) {
this.getSubject().addEntity(entityName);
-
- listSelectionModel.setSelectedValue(entityName);
+ int index = CollectionTools.indexOf(this.getSubject().entityNames(), entityName);
+ Entity entity = (Entity) listSelectionModel.getListModel().getElementAt(index);
+ listSelectionModel.setSelectedValue(entity);
+ this.entityHolder.setValue(entity);
}
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/EntityListComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/EntityListComposite.java
index b939ced06b..c08bc35d49 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/EntityListComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/EntityListComposite.java
@@ -119,8 +119,9 @@ public class EntityListComposite extends Pane<Customization>
if( ! this.getSubject().entityExists(entityName)) {
this.getSubject().addEntity(entityName);
- int index = CollectionTools.indexOf(this.getSubject().entities(), entityName);
+ int index = CollectionTools.indexOf(this.getSubject().entityNames(), entityName);
Entity entity = (Entity) listSelectionModel.getListModel().getElementAt(index);
+ listSelectionModel.setSelectedValue(entity);
this.entityHolder.setValue(entity);
}
}

Back to the top