}
}
@Override
public boolean performFinish() {
PersistenceContextRef contextRef;
if (element.getText().equals(elementTypes[CONTEXT])) {
if (isEmpty(textList.get(0).getText()) ||
isEmpty(textList.get(2).getText()) && isEmpty(textList.get(3).getText())) {
return false;
}
contextRef = (PersistenceContextRef)eObject;
ObjectFactory objectFactory = new ObjectFactory();
if (contextRef == null) {
contextRef = (PersistenceContextRef)getEFactory().create(PersistenceContextRef.class);
JAXBElement plan = section.getPlan();
// add the JAXBElement of the PersistenceContextRef
JAXBModelUtils.getGbeanRefs(plan).add(objectFactory.createPersistenceContextRef(contextRef));
section.getObjectContainer().add(objectFactory.createPersistenceContextRef(contextRef));
}
contextRef.setPersistenceContextRefName(textList.get(0).getText());
contextRef.setPersistenceContextType(PersistenceContextType.fromValue(contextType.getText()));
if (specifyUnit.getSelection() == true) {
contextRef.setPersistenceUnitName(textList.get(2).getText());
contextRef.setPattern(null);
}
else {
contextRef.setPersistenceUnitName(null);
Pattern pattern = contextRef.getPattern();
if (pattern == null) {
pattern = objectFactory.createPattern();
}
pattern.setName(textList.get(3).getText());
pattern.setGroupId(textList.get(4).getText());
pattern.setArtifactId(textList.get(5).getText());
pattern.setVersion(textList.get(6).getText());
pattern.setModule(textList.get(7).getText());
contextRef.setPattern(pattern);
}
}
else if (element.getText().equals(elementTypes[PROPERTY])) {
if (isEmpty(textList.get(0).getText())) {
return false;
}
Property property = (Property)eObject;
if (property == null) {
property = (Property)getEFactory().create(Property.class);
contextRef = (PersistenceContextRef)section.getSelectedObject();
contextRef.getProperty().add(property);
}
property.setKey(textList.get(0).getText());
property.setValue(textList.get(2).getText());
}
return true;