Author: tfennelly
Date: 2009-12-02 17:22:40 -0500 (Wed, 02 Dec 2009)
New Revision: 19009
Modified:
branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/commands/CreateJavaBeanModelCommand.java
branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/wizards/JavaBeanCreationWizardPage.java
Log:
More changes for
https://jira.jboss.org/jira/browse/JBIDE-5311 - Need help from Dart!!!
Modified:
branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/commands/CreateJavaBeanModelCommand.java
===================================================================
---
branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/commands/CreateJavaBeanModelCommand.java 2009-12-02
20:47:35 UTC (rev 19008)
+++
branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/commands/CreateJavaBeanModelCommand.java 2009-12-02
22:22:40 UTC (rev 19009)
@@ -80,28 +80,23 @@
if (editorPart instanceof SmooksGraphicalEditorPart) {
resourceListType = ((SmooksGraphicalEditorPart)
editorPart).getSmooksResourceListType();
}
-
- JavaBeanModel javaBeanModel = wizard.getJavaBeanModel();
- if(javaBeanModel != null) {
- List<Object> models = createJavaBeanModel(type, javaBeanModel,
wizard.getBindings(),
- resourceListType, new ArrayList<String>());
- String figureID = null;
- int index = 0;
- List<Object> creationModels = new ArrayList<Object>();
-
- if (collections instanceof FeatureMap.Entry) {
- for (Iterator<?> iterator = models.iterator(); iterator.hasNext();) {
- Object object = (Object) iterator.next();
- creationModels.add(FeatureMapUtil.createEntry(((FeatureMap.Entry) collections)
- .getEStructuralFeature(), object));
- }
+ List<Object> models = createJavaBeanModel(type, wizard.getJavaBeanModel(),
wizard.getBindings(),
+ resourceListType, new ArrayList<String>());
+ String figureID = null;
+ int index = 0;
+
+ List<Object> creationModels = new ArrayList<Object>();
+
+ if (collections instanceof FeatureMap.Entry) {
+ for (Iterator<?> iterator = models.iterator(); iterator.hasNext();) {
+ Object object = (Object) iterator.next();
+ creationModels.add(FeatureMapUtil.createEntry(((FeatureMap.Entry) collections)
+ .getEStructuralFeature(), object));
}
- collections = creationModels;
-
- emfCommand = AddCommand.create(domain, owner, feature, creationModels);
- } else {
- // TODO: There is no "model" e.g. for a Collection type... what do we
do??
}
+ collections = creationModels;
+
+ emfCommand = AddCommand.create(domain, owner, feature, creationModels);
} else {
throw new IgnoreException();
}
@@ -127,7 +122,7 @@
if (parent instanceof BeanType) {
((BeanType) parent).setBeanId(beanID);
((BeanType) parent).setClass(parentBeanModel.getBeanClassString());
- if (properties != null) {
+ if (properties != null && properties.length > 0) {
for (int i = 0; i < properties.length; i++) {
Object pro = properties[i];
if (pro instanceof JavaBeanModel && belongsToMe(parentBeanModel,
(JavaBeanModel) pro)) {
@@ -151,6 +146,9 @@
}
}
}
+ } else if(parentBeanModel.isList()) {
+ WiringType value = Javabean12Factory.eINSTANCE.createWiringType();
+ ((BeanType) parent).getWiring().add(value);
}
}
if (parent instanceof BindingsType) {
Modified:
branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/wizards/JavaBeanCreationWizardPage.java
===================================================================
---
branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/wizards/JavaBeanCreationWizardPage.java 2009-12-02
20:47:35 UTC (rev 19008)
+++
branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/wizards/JavaBeanCreationWizardPage.java 2009-12-02
22:22:40 UTC (rev 19009)
@@ -408,32 +408,17 @@
ProjectClassLoader loader = new ProjectClassLoader(project);
javaBeanModel = null;
isCollection = isCollectionClass(beanClass);
- if (isCollection) {
- if (collectionClass != null) {
- Class<?> clazz = loader.loadClass(beanClass);
- Class<?> cclazz = loader.loadClass(collectionClass);
- javaBeanModel = JavaBeanModelFactory
- .getJavaBeanModelWithLazyLoad(clazz);
- javaBeanModel.setComponentClass(cclazz);
- } else {
- viewer.setInput(""); //$NON-NLS-1$
- }
- } else {
- Class<?> clazz = loader.loadClass(beanClass);
- if (isArray) {
- Object arrayInstance = Array.newInstance(clazz, 0);
- clazz = arrayInstance.getClass();
- }
- javaBeanModel = JavaBeanModelFactory
- .getJavaBeanModelWithLazyLoad(clazz);
- }
+ Class<?> clazz = loader.loadClass(beanClass);
+
+ javaBeanModel = JavaBeanModelFactory.getJavaBeanModelWithLazyLoad(clazz);
if (javaBeanModel != null) {
if (beanID != null) {
javaBeanModel.setName(beanID);
}
- viewer.setInput(javaBeanModel.getChildren());
- viewer.setCheckedElements(javaBeanModel.getChildren()
- .toArray());
+ if(!isCollection) {
+ viewer.setInput(javaBeanModel.getChildren());
+ }
+ viewer.setCheckedElements(javaBeanModel.getChildren().toArray());
} else {
viewer.setInput(""); //$NON-NLS-1$
}