Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization')
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/EntityCustomizerProperties.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/EntityListComposite.java26
2 files changed, 33 insertions, 22 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/EntityCustomizerProperties.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/EntityCustomizerProperties.java
index f8ffd09300..d2d29ac1ef 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/EntityCustomizerProperties.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/customization/EntityCustomizerProperties.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2009 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.
@@ -25,14 +25,12 @@ import org.eclipse.jpt.utility.model.value.PropertyValueModel;
public class EntityCustomizerProperties extends AbstractModel {
private Customization customization;
-
private String entityName;
- public static final String DESCRIPTOR_CUSTOMIZER_PROPERTY = Customization.DESCRIPTOR_CUSTOMIZER_PROPERTY;
-
- SimplePropertyValueModel<Customization> customizationHolder;
PropertyValueModel<String> descriptorCustomizerHolder;
PropertyChangeListener descriptorCustomizerListener;
+
+ public static final String DESCRIPTOR_CUSTOMIZER_PROPERTY = Customization.DESCRIPTOR_CUSTOMIZER_PROPERTY;
private static final long serialVersionUID = 1L;
@@ -41,11 +39,16 @@ public class EntityCustomizerProperties extends AbstractModel {
super();
this.customization = customization;
this.entityName = entityName;
- this.customizationHolder = new SimplePropertyValueModel<Customization>(this.customization);
-
- this.descriptorCustomizerHolder = this.buildDescriptorCustomizerAA(this.customizationHolder);
+
+ PropertyValueModel<Customization> customizationHolder = new SimplePropertyValueModel<Customization>(this.customization);
+ this.initialize(customizationHolder);
+
+ this.engageListeners();
+ }
+
+ protected void initialize(PropertyValueModel<Customization> customizationHolder) {
+ this.descriptorCustomizerHolder = this.buildDescriptorCustomizerAA(customizationHolder);
this.descriptorCustomizerListener = this.buildDescriptorCustomizerChangeListener();
- this.descriptorCustomizerHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.descriptorCustomizerListener);
}
// ********** behavior **********
@@ -104,6 +107,14 @@ public class EntityCustomizerProperties extends AbstractModel {
return;
}
+ public void engageListeners() {
+ this.descriptorCustomizerHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.descriptorCustomizerListener);
+ }
+
+ public void disengageListeners() {
+ this.descriptorCustomizerHolder.removePropertyChangeListener(PropertyValueModel.VALUE, this.descriptorCustomizerListener);
+ }
+
@Override
public void toString(StringBuilder sb) {
sb.append("name: ");
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 5d8c7077f1..169e26fcf9 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
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2007, 2008 Oracle. All rights reserved.
+* Copyright (c) 2007, 2009 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.
@@ -60,7 +60,7 @@ public class EntityListComposite extends Pane<Customization>
@Override
protected void initialize() {
super.initialize();
- entityHolder = this.buildEntityHolder();
+ this.entityHolder = this.buildEntityHolder();
}
@Override
@@ -77,7 +77,7 @@ public class EntityListComposite extends Pane<Customization>
container,
this.buildEntitiesAdapter(),
this.buildEntityCustomizationListHolder(),
- entityHolder,
+ this.entityHolder,
this.buildEntityLabelProvider(),
null // EclipseLinkHelpContextIds.CUSTOMIZATION_ENTITIES
);
@@ -85,22 +85,23 @@ public class EntityListComposite extends Pane<Customization>
// Entity Customization property pane
EntityCustomizationPropertyComposite pane = new EntityCustomizationPropertyComposite(
this,
- entityHolder,
+ this.entityHolder,
container
);
- this.installPaneEnabler(entityHolder, pane);
+ this.installPaneEnabler(this.entityHolder, pane);
}
private AddRemoveListPane.Adapter buildEntitiesAdapter() {
return new AddRemoveListPane.AbstractAdapter() {
public void addNewItem(ObjectListSelectionModel listSelectionModel) {
- addEntities(listSelectionModel);
+ EntityListComposite.this.addEntities(listSelectionModel);
}
public void removeSelectedItems(ObjectListSelectionModel listSelectionModel) {
Customization customization = getSubject();
for (Object item : listSelectionModel.selectedValues()) {
EntityCustomizerProperties entityCustomization = (EntityCustomizerProperties) item;
+ entityCustomization.disengageListeners();
customization.removeEntity(entityCustomization.getEntityName());
}
}
@@ -118,11 +119,10 @@ public class EntityListComposite extends Pane<Customization>
}
if( ! this.getSubject().entityExists(entityName)) {
- String entity = this.getSubject().addEntity(entityName);
-
+ this.getSubject().addEntity(entityName);
int index = CollectionTools.indexOf(this.getSubject().entities(), entityName);
- EntityCustomizerProperties item = (EntityCustomizerProperties) listSelectionModel.getListModel().getElementAt(index);
- entityHolder.setValue(item);
+ EntityCustomizerProperties entity = (EntityCustomizerProperties) listSelectionModel.getListModel().getElementAt(index);
+ this.entityHolder.setValue(entity);
}
}
}
@@ -195,10 +195,10 @@ public class EntityListComposite extends Pane<Customization>
}
private ListValueModel<EntityCustomizerProperties> buildEntityCustomizationListHolder() {
- return new TransformationListValueModelAdapter<String, EntityCustomizerProperties>(buildEntitiesListHolder()) {
+ return new TransformationListValueModelAdapter<String, EntityCustomizerProperties>(this.buildEntitiesListHolder()) {
@Override
- protected EntityCustomizerProperties transformItem(String item) {
- return new EntityCustomizerProperties(getSubject(), item);
+ protected EntityCustomizerProperties transformItem(String entityName) {
+ return new EntityCustomizerProperties(getSubject(), entityName);
}
};
}

Back to the top