in plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/GBeanWizard.java [183:266]
public boolean performFinish() {
Gbean gbean;
switch (element.getSelectionIndex()) {
case GBEAN:
if (isEmpty(textList.get(0).getText()) || isEmpty(textList.get(1).getText())) {
return false;
}
gbean = (Gbean)eObject;
if (gbean == null) {
gbean = (Gbean)getEFactory().create(Gbean.class);
JAXBElement plan = section.getPlan();
// add the JAXBElement of a GBean, not the GBean
ObjectFactory objectFactory = new ObjectFactory();
JAXBModelUtils.getGbeans(plan).add(objectFactory.createGbean((Gbean)gbean));
}
gbean.setName(textList.get(0).getText());
gbean.setClazz(textList.get(1).getText());
break;
case ATTRIBUTE:
if (isEmpty(textList.get(0).getText()) || isEmpty(textList.get(1).getText())) {
return false;
}
Attribute attribute = (Attribute)eObject;
if (attribute == null) {
attribute = (Attribute)getEFactory().create(Attribute.class);
gbean = (Gbean)section.getSelectedObject();
// add the JAXBElement of an Attribute, not the Attribute
ObjectFactory objectFactory = new ObjectFactory();
gbean.getAttributeOrXmlAttributeOrReference().add(objectFactory.createGbeanAttribute(attribute));
}
attribute.setName(textList.get(0).getText());
attribute.setType(textList.get(1).getText());
attribute.setValue(textList.get(2).getText());
break;
case DEPENDENCY:
if (isEmpty(textList.get(0).getText()) || isEmpty(textList.get(1).getText())) {
return false;
}
Pattern dependency = (Pattern)eObject;
if (dependency == null) {
dependency = (Pattern)getEFactory().create(Pattern.class);
gbean = (Gbean)section.getSelectedObject();
// add the JAXBElement of a Dependency, not the Dependency
ObjectFactory objectFactory = new ObjectFactory();
gbean.getAttributeOrXmlAttributeOrReference().add(objectFactory.createGbeanDependency(dependency));
}
dependency.setGroupId(textList.get(0).getText());
dependency.setArtifactId(textList.get(1).getText());
dependency.setVersion(textList.get(2).getText());
dependency.setModule(textList.get(3).getText());
dependency.setType(textList.get(4).getText());
dependency.setCustomFoo(textList.get(5).getText());
break;
case REFERENCE:
if (isEmpty(textList.get(0).getText()) || isEmpty(textList.get(1).getText()) ||
isEmpty(textList.get(2).getText())) {
return false;
}
Reference reference = (Reference)eObject;
if (reference == null) {
reference = (Reference)getEFactory().create(Reference.class);
gbean = (Gbean)section.getSelectedObject();
// add the JAXBElement of a Dependency, not the Dependency
ObjectFactory objectFactory = new ObjectFactory();
gbean.getAttributeOrXmlAttributeOrReference().add(objectFactory.createGbeanReference(reference));
}
reference.setName(textList.get(0).getText());
reference.setGroupId(textList.get(1).getText());
reference.setArtifactId(textList.get(2).getText());
reference.setVersion(textList.get(3).getText());
reference.setModule(textList.get(4).getText());
reference.setType(textList.get(5).getText());
reference.setCustomFoo(textList.get(6).getText());
break;
}
return true;
}