Author: DartPeng
Date: 2009-12-02 10:41:47 -0500 (Wed, 02 Dec 2009)
New Revision: 19000
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks10/model/smooks/util/SmooksModelUtils.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksFreemarkerTemplateGraphicalEditor.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/model/freemarker/FreemarkerCSVNodeGraphicalModel.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/model/javamapping/JavaBeanChildGraphModel.java
Log:
JBIDE-5354
DONE
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks10/model/smooks/util/SmooksModelUtils.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks10/model/smooks/util/SmooksModelUtils.java 2009-12-02
15:40:22 UTC (rev 18999)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks10/model/smooks/util/SmooksModelUtils.java 2009-12-02
15:41:47 UTC (rev 19000)
@@ -109,204 +109,217 @@
public static EStructuralFeature ELEMENT_BINDING =
ExtendedMetaData.INSTANCE.demandFeature(
"http://www.milyn.org/xsd/smooks-1.0.xsd", "binding", true);
-// public static AnyType addBindingTypeToParamType(ParamType param, String property,
String selector, String type,
-// String uri) {
-// AnyType binding = createBindingType(property, selector, type, uri);
-// param.getMixed().add(ELEMENT_BINDING, binding);
-// return binding;
-// }
-//
-// public static List<Object>
getBindingListFromResourceConfigType(ResourceConfigType resourceConfig) {
-// List<ParamType> paramList = resourceConfig.getParam();
-// for (Iterator<ParamType> iterator = paramList.iterator(); iterator.hasNext();)
{
-// ParamType param = iterator.next();
-// if ("bindings".equals(param.getName())) {
-// if (param.eContents().isEmpty())
-// continue;
-// List<Object> bindingList = (List<Object>)
param.getMixed().list(SmooksModelUtils.ELEMENT_BINDING);
-// return bindingList;
-// }
-// }
-// return Collections.emptyList();
-// }
-//
-// public static boolean isBeanPopulatorResource(ResourceConfigType type) {
-// ResourceType resource = type.getResource();
-// if (resource == null)
-// return false;
-// String value = resource.getStringValue();
-// if (value != null)
-// value = value.trim();
-// if (SmooksModelConstants.BEAN_POPULATOR.equals(value)) {
-// return true;
-// }
-// return false;
-// }
+ // public static AnyType addBindingTypeToParamType(ParamType param, String
+ // property, String selector, String type,
+ // String uri) {
+ // AnyType binding = createBindingType(property, selector, type, uri);
+ // param.getMixed().add(ELEMENT_BINDING, binding);
+ // return binding;
+ // }
+ //
+ // public static List<Object>
+ // getBindingListFromResourceConfigType(ResourceConfigType resourceConfig) {
+ // List<ParamType> paramList = resourceConfig.getParam();
+ // for (Iterator<ParamType> iterator = paramList.iterator();
+ // iterator.hasNext();) {
+ // ParamType param = iterator.next();
+ // if ("bindings".equals(param.getName())) {
+ // if (param.eContents().isEmpty())
+ // continue;
+ // List<Object> bindingList = (List<Object>)
+ // param.getMixed().list(SmooksModelUtils.ELEMENT_BINDING);
+ // return bindingList;
+ // }
+ // }
+ // return Collections.emptyList();
+ // }
+ //
+ // public static boolean isBeanPopulatorResource(ResourceConfigType type) {
+ // ResourceType resource = type.getResource();
+ // if (resource == null)
+ // return false;
+ // String value = resource.getStringValue();
+ // if (value != null)
+ // value = value.trim();
+ // if (SmooksModelConstants.BEAN_POPULATOR.equals(value)) {
+ // return true;
+ // }
+ // return false;
+ // }
public static void setPropertyValueToAnyType(Object value, EStructuralFeature attribute,
AnyType anyType) {
anyType.getAnyAttribute().set(attribute, value);
}
-// public static AnyType getBindingViaProperty(ResourceConfigType resourceConfig, String
property) {
-// List bindingList = getBindingListFromResourceConfigType(resourceConfig);
-// for (Iterator iterator = bindingList.iterator(); iterator.hasNext();) {
-// AnyType binding = (AnyType) iterator.next();
-// String pro = getAttributeValueFromAnyType(binding, ATTRIBUTE_PROPERTY);
-// if (pro != null)
-// pro = pro.trim();
-// if (property.equals(pro)) {
-// return binding;
-// }
-// }
-// return null;
-// }
-//
-// public static boolean isInnerFileContents(ResourceConfigType resourceConfig) {
-// ResourceType resource = resourceConfig.getResource();
-// if (resource == null)
-// return false;
-// String type = resource.getType();
-// if (type != null)
-// type = type.trim();
-// for (int i = 0; i < TEMPLATE_TYPES.length; i++) {
-// String type1 = TEMPLATE_TYPES[i];
-// if (type1.equalsIgnoreCase(type))
-// return true;
-// }
-// return false;
-// }
-//
-// public static boolean isDateTypeSelector(ResourceConfigType type) {
-// ResourceType resource = type.getResource();
-// if (resource == null)
-// return false;
-// String value = resource.getStringValue();
-// if (value != null)
-// value = value.trim();
-// for (int i = 0; i < SmooksModelConstants.DECODER_CLASSES.length; i++) {
-// String decoderClass = SmooksModelConstants.DECODER_CLASSES[i];
-// if (decoderClass.equals(value)) {
-// return true;
-// }
-// }
-// return false;
-// }
-//
-// public static String getTransformType(ResourceConfigType resourceConfig) {
-// ParamType typeParam = null;
-// if (resourceConfig == null)
-// return "";
-// if (isTransformTypeResourceConfig(resourceConfig)) {
-// List paramList = resourceConfig.getParam();
-// for (Iterator iterator = paramList.iterator(); iterator.hasNext();) {
-// ParamType param = (ParamType) iterator.next();
-// String name = param.getName();
-// if (name != null)
-// name = name.trim();
-// if (SmooksModelConstants.STREAM_FILTER_TYPE.equals(name)) {
-// typeParam = param;
-// break;
-// }
-// }
-// if (typeParam != null) {
-// return SmooksModelUtils.getAnyTypeText(typeParam);
-// }
-// }
-// return "";
-// }
-//
-// public static void setTransformType(ResourceConfigType resourceConfig, String type) {
-// if (type == null)
-// type = "";
-// if (isTransformTypeResourceConfig(resourceConfig)) {
-// List paramList = resourceConfig.getParam();
-// for (Iterator iterator = paramList.iterator(); iterator.hasNext();) {
-// ParamType param = (ParamType) iterator.next();
-// if (SmooksModelConstants.STREAM_FILTER_TYPE.equals(param.getName())) {
-// cleanTextToSmooksType(param);
-// setTextToAnyType(param, type);
-// }
-// }
-// }
-// }
-//
-// public static boolean isFilePathResourceConfig(ResourceConfigType resourceConfig) {
-// ResourceType resource = resourceConfig.getResource();
-// if (resource != null) {
-// String value = resource.getStringValue();
-// if (value != null) {
-// if (value.startsWith("\\")) {
-// return true;
-// }
-// if (value.startsWith("/")) {
-// return true;
-// }
-// }
-// }
-// return false;
-// }
-//
-// public static boolean isTransformTypeResourceConfig(ResourceConfigType resourceConfig)
{
-// String selector = resourceConfig.getSelector();
-// if (selector != null)
-// selector = selector.trim();
-// if (!SmooksModelConstants.GLOBAL_PARAMETERS.equals(selector)) {
-// return false;
-// }
-//
-// if (resourceConfig.getParam().isEmpty()) {
-// return false;
-// } else {
-// List paramList = resourceConfig.getParam();
-// for (Iterator iterator = paramList.iterator(); iterator.hasNext();) {
-// ParamType p = (ParamType) iterator.next();
-// String paramName = p.getName();
-// if (paramName != null)
-// paramName = paramName.trim();
-// if (SmooksModelConstants.STREAM_FILTER_TYPE.equals(paramName)) {
-// return true;
-// }
-// }
-// return false;
-// }
-// }
-//
-// public static void setParamText(String paramName, String value, ResourceConfigType
resourceConfigType) {
-// List<ParamType> list = resourceConfigType.getParam();
-// ParamType param = null;
-// for (Iterator<ParamType> iterator = list.iterator(); iterator.hasNext();) {
-// ParamType paramType = (ParamType) iterator.next();
-// String n = paramType.getName();
-// if (n == null)
-// continue;
-// n = n.trim();
-// if (n.equalsIgnoreCase(paramName)) {
-// param = paramType;
-// break;
-// }
-// }
-// if (param == null) {
-// param = SmooksFactory.eINSTANCE.createParamType();
-// param.setName(paramName);
-// resourceConfigType.getParam().add(param);
-// }
-// setTextToAnyType(param, value);
-// }
-//
-// public static String getParmaText(String paramName, ResourceConfigType
resourceConfigType) {
-// List plist = resourceConfigType.getParam();
-// for (Iterator iterator = plist.iterator(); iterator.hasNext();) {
-// ParamType p = (ParamType) iterator.next();
-// String n = p.getName();
-// if (n == null)
-// continue;
-// n = n.trim();
-// if (paramName.equalsIgnoreCase(n)) {
-// return getAnyTypeText(p);
-// }
-// }
-// return null;
-// }
+ // public static AnyType getBindingViaProperty(ResourceConfigType
+ // resourceConfig, String property) {
+ // List bindingList = getBindingListFromResourceConfigType(resourceConfig);
+ // for (Iterator iterator = bindingList.iterator(); iterator.hasNext();) {
+ // AnyType binding = (AnyType) iterator.next();
+ // String pro = getAttributeValueFromAnyType(binding, ATTRIBUTE_PROPERTY);
+ // if (pro != null)
+ // pro = pro.trim();
+ // if (property.equals(pro)) {
+ // return binding;
+ // }
+ // }
+ // return null;
+ // }
+ //
+ // public static boolean isInnerFileContents(ResourceConfigType
+ // resourceConfig) {
+ // ResourceType resource = resourceConfig.getResource();
+ // if (resource == null)
+ // return false;
+ // String type = resource.getType();
+ // if (type != null)
+ // type = type.trim();
+ // for (int i = 0; i < TEMPLATE_TYPES.length; i++) {
+ // String type1 = TEMPLATE_TYPES[i];
+ // if (type1.equalsIgnoreCase(type))
+ // return true;
+ // }
+ // return false;
+ // }
+ //
+ // public static boolean isDateTypeSelector(ResourceConfigType type) {
+ // ResourceType resource = type.getResource();
+ // if (resource == null)
+ // return false;
+ // String value = resource.getStringValue();
+ // if (value != null)
+ // value = value.trim();
+ // for (int i = 0; i < SmooksModelConstants.DECODER_CLASSES.length; i++) {
+ // String decoderClass = SmooksModelConstants.DECODER_CLASSES[i];
+ // if (decoderClass.equals(value)) {
+ // return true;
+ // }
+ // }
+ // return false;
+ // }
+ //
+ // public static String getTransformType(ResourceConfigType resourceConfig)
+ // {
+ // ParamType typeParam = null;
+ // if (resourceConfig == null)
+ // return "";
+ // if (isTransformTypeResourceConfig(resourceConfig)) {
+ // List paramList = resourceConfig.getParam();
+ // for (Iterator iterator = paramList.iterator(); iterator.hasNext();) {
+ // ParamType param = (ParamType) iterator.next();
+ // String name = param.getName();
+ // if (name != null)
+ // name = name.trim();
+ // if (SmooksModelConstants.STREAM_FILTER_TYPE.equals(name)) {
+ // typeParam = param;
+ // break;
+ // }
+ // }
+ // if (typeParam != null) {
+ // return SmooksModelUtils.getAnyTypeText(typeParam);
+ // }
+ // }
+ // return "";
+ // }
+ //
+ // public static void setTransformType(ResourceConfigType resourceConfig,
+ // String type) {
+ // if (type == null)
+ // type = "";
+ // if (isTransformTypeResourceConfig(resourceConfig)) {
+ // List paramList = resourceConfig.getParam();
+ // for (Iterator iterator = paramList.iterator(); iterator.hasNext();) {
+ // ParamType param = (ParamType) iterator.next();
+ // if (SmooksModelConstants.STREAM_FILTER_TYPE.equals(param.getName())) {
+ // cleanTextToSmooksType(param);
+ // setTextToAnyType(param, type);
+ // }
+ // }
+ // }
+ // }
+ //
+ // public static boolean isFilePathResourceConfig(ResourceConfigType
+ // resourceConfig) {
+ // ResourceType resource = resourceConfig.getResource();
+ // if (resource != null) {
+ // String value = resource.getStringValue();
+ // if (value != null) {
+ // if (value.startsWith("\\")) {
+ // return true;
+ // }
+ // if (value.startsWith("/")) {
+ // return true;
+ // }
+ // }
+ // }
+ // return false;
+ // }
+ //
+ // public static boolean isTransformTypeResourceConfig(ResourceConfigType
+ // resourceConfig) {
+ // String selector = resourceConfig.getSelector();
+ // if (selector != null)
+ // selector = selector.trim();
+ // if (!SmooksModelConstants.GLOBAL_PARAMETERS.equals(selector)) {
+ // return false;
+ // }
+ //
+ // if (resourceConfig.getParam().isEmpty()) {
+ // return false;
+ // } else {
+ // List paramList = resourceConfig.getParam();
+ // for (Iterator iterator = paramList.iterator(); iterator.hasNext();) {
+ // ParamType p = (ParamType) iterator.next();
+ // String paramName = p.getName();
+ // if (paramName != null)
+ // paramName = paramName.trim();
+ // if (SmooksModelConstants.STREAM_FILTER_TYPE.equals(paramName)) {
+ // return true;
+ // }
+ // }
+ // return false;
+ // }
+ // }
+ //
+ // public static void setParamText(String paramName, String value,
+ // ResourceConfigType resourceConfigType) {
+ // List<ParamType> list = resourceConfigType.getParam();
+ // ParamType param = null;
+ // for (Iterator<ParamType> iterator = list.iterator(); iterator.hasNext();)
+ // {
+ // ParamType paramType = (ParamType) iterator.next();
+ // String n = paramType.getName();
+ // if (n == null)
+ // continue;
+ // n = n.trim();
+ // if (n.equalsIgnoreCase(paramName)) {
+ // param = paramType;
+ // break;
+ // }
+ // }
+ // if (param == null) {
+ // param = SmooksFactory.eINSTANCE.createParamType();
+ // param.setName(paramName);
+ // resourceConfigType.getParam().add(param);
+ // }
+ // setTextToAnyType(param, value);
+ // }
+ //
+ // public static String getParmaText(String paramName, ResourceConfigType
+ // resourceConfigType) {
+ // List plist = resourceConfigType.getParam();
+ // for (Iterator iterator = plist.iterator(); iterator.hasNext();) {
+ // ParamType p = (ParamType) iterator.next();
+ // String n = p.getName();
+ // if (n == null)
+ // continue;
+ // n = n.trim();
+ // if (paramName.equalsIgnoreCase(n)) {
+ // return getAnyTypeText(p);
+ // }
+ // }
+ // return null;
+ // }
public static String getAttributeValueFromAnyType(AnyType anyType, EStructuralFeature
attribute) {
String value = (String) anyType.getAnyAttribute().get(attribute, false);
@@ -353,24 +366,26 @@
return null;
}
-// public static AnyType createBindingType(String property, String selector, String type,
String uri) {
-// if (uri == null) {
-// uri = SmooksPackage.eNS_URI;
-// }
-//
-// AnyType binding = (AnyType) EcoreUtil.create(XMLTypePackage.Literals.ANY_TYPE);
-// if (property != null) {
-// binding.getAnyAttribute().add(ATTRIBUTE_PROPERTY, property);
-// }
-//
-// if (selector != null) {
-// binding.getAnyAttribute().add(ATTRIBUTE_SELECTOR, selector);
-// }
-// if (type != null) {
-// binding.getAnyAttribute().add(ATTRIBUTE_TYPE, false);
-// }
-// return binding;
-// }
+ // public static AnyType createBindingType(String property, String selector,
+ // String type, String uri) {
+ // if (uri == null) {
+ // uri = SmooksPackage.eNS_URI;
+ // }
+ //
+ // AnyType binding = (AnyType)
+ // EcoreUtil.create(XMLTypePackage.Literals.ANY_TYPE);
+ // if (property != null) {
+ // binding.getAnyAttribute().add(ATTRIBUTE_PROPERTY, property);
+ // }
+ //
+ // if (selector != null) {
+ // binding.getAnyAttribute().add(ATTRIBUTE_SELECTOR, selector);
+ // }
+ // if (type != null) {
+ // binding.getAnyAttribute().add(ATTRIBUTE_TYPE, false);
+ // }
+ // return binding;
+ // }
public static void appendTextToSmooksType(AnyType smooksModel, String text) {
smooksModel.getMixed().add(XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__TEXT,
text);
@@ -600,7 +615,9 @@
String value = typeParam.getStringValue();
if (value != null) {
value = value.trim();
- return value.split(",");
+ if (!"".equals(value)) {
+ return value.split(",");
+ }
}
}
return null;
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksFreemarkerTemplateGraphicalEditor.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksFreemarkerTemplateGraphicalEditor.java 2009-12-02
15:40:22 UTC (rev 18999)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksFreemarkerTemplateGraphicalEditor.java 2009-12-02
15:41:47 UTC (rev 19000)
@@ -16,6 +16,7 @@
import java.util.Iterator;
import java.util.List;
+import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
@@ -31,7 +32,6 @@
import org.jboss.template.TemplateBuilder;
import org.jboss.template.csv.CSVFreeMarkerTemplateBuilder;
import org.jboss.template.csv.CSVModelBuilder;
-import org.jboss.tools.smooks.configuration.SmooksConstants;
import org.jboss.tools.smooks.configuration.editors.actions.AbstractSmooksActionGrouper;
import org.jboss.tools.smooks.configuration.editors.actions.ISmooksActionGrouper;
import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
@@ -91,6 +91,77 @@
return factory;
}
+ @Override
+ public void validateEnd(List<Diagnostic> diagnosticResult) {
+ cleanValidationMarker();
+ // validate freemarker model.Because the freemarker csv node
+ // model isn't EMF model so they need to validate separately
+ if(root == null) return;
+ List<AbstractSmooksGraphicalModel> children = root.getChildren();
+ for (Iterator<?> iterator = children.iterator(); iterator.hasNext();) {
+ AbstractSmooksGraphicalModel abstractSmooksGraphicalModel =
(AbstractSmooksGraphicalModel) iterator.next();
+ if (abstractSmooksGraphicalModel instanceof FreemarkerTemplateGraphicalModel) {
+ Object data = abstractSmooksGraphicalModel.getData();
+ data = AdapterFactoryEditingDomain.unwrap(data);
+ if (data instanceof Freemarker) {
+ String type = SmooksModelUtils.getTemplateType((Freemarker) data);
+ if (SmooksModelUtils.FREEMARKER_TEMPLATE_TYPE_CSV.equals(type)) {
+ validateCSVTemplate(abstractSmooksGraphicalModel);
+ }
+ }
+ }
+ }
+ }
+
+ protected void validateCSVTemplate(AbstractSmooksGraphicalModel templateGraphModel) {
+ int s = AbstractSmooksGraphicalModel.NONE;
+ Object data = templateGraphModel.getData();
+ data = AdapterFactoryEditingDomain.unwrap(data);
+
+ char seperator = SmooksModelUtils.getFreemarkerCSVSeperator((Freemarker) data);
+
+ if (seperator == 0) {
+ templateGraphModel.getMessage().add("Seperator character can't be
empty");
+ s = AbstractSmooksGraphicalModel.WARNING;
+ }
+
+ char quote = SmooksModelUtils.getFreemarkerCSVQuote((Freemarker) data);
+ if (quote == 0) {
+ templateGraphModel.getMessage().add("Quote character can't be empty");
+ s = AbstractSmooksGraphicalModel.WARNING;
+ }
+
+ String[] fields = SmooksModelUtils.getFreemarkerCSVFileds((Freemarker) data);
+ boolean missFields = false;
+ if (fields == null) {
+ missFields = true;
+ }
+
+ if (s != AbstractSmooksGraphicalModel.NONE) {
+ templateGraphModel.setSeverity(s);
+ }
+
+ List<AbstractSmooksGraphicalModel> csvRecordNode =
templateGraphModel.getChildren();
+ for (Iterator<?> iterator = csvRecordNode.iterator(); iterator.hasNext();) {
+ AbstractSmooksGraphicalModel csvRecordGraphModel = (AbstractSmooksGraphicalModel)
iterator.next();
+ if (missFields) {
+ csvRecordGraphModel.getMessage().add("CSV fields can't be empty");
+ csvRecordGraphModel.setSeverity(AbstractSmooksGraphicalModel.WARNING);
+ }
+ List<TreeNodeConnection> collectionConnections =
csvRecordGraphModel.getTargetConnections();
+ if (collectionConnections.isEmpty()) {
+ csvRecordGraphModel.addMessage("Must be linked with source node");
+ csvRecordGraphModel.setSeverity(AbstractSmooksGraphicalModel.WARNING);
+ List<AbstractSmooksGraphicalModel> csvFields =
csvRecordGraphModel.getChildren();
+ for (Iterator<?> iterator2 = csvFields.iterator(); iterator2.hasNext();) {
+ AbstractSmooksGraphicalModel csvFieldsGModel = (AbstractSmooksGraphicalModel)
iterator2.next();
+ csvFieldsGModel.addMessage("Case CSV-Record isn't linked with source node ,
this node can't be linked.");
+ csvFieldsGModel.setSeverity(AbstractSmooksGraphicalModel.ERROR);
+ }
+ }
+ }
+ }
+
/*
* (non-Javadoc)
*
@@ -377,7 +448,7 @@
char quote = SmooksModelUtils.getFreemarkerCSVQuote(freemarker);
String[] fields = SmooksModelUtils.getFreemarkerCSVFileds(freemarker);
try {
- if(contents != null) {
+ if (contents != null) {
CSVModelBuilder modelBuilder = new CSVModelBuilder(fields);
Document model = modelBuilder.buildModel();
TemplateBuilder builder = new CSVFreeMarkerTemplateBuilder(model, seprator, quote,
contents);
@@ -386,7 +457,7 @@
}
} catch (Exception e) {
// ignore exception
-// e.printStackTrace();
+ // e.printStackTrace();
}
}
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/model/freemarker/FreemarkerCSVNodeGraphicalModel.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/model/freemarker/FreemarkerCSVNodeGraphicalModel.java 2009-12-02
15:40:22 UTC (rev 18999)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/model/freemarker/FreemarkerCSVNodeGraphicalModel.java 2009-12-02
15:41:47 UTC (rev 19000)
@@ -99,7 +99,7 @@
Freemarker freemarker = (Freemarker) parent.getData();
if (freemarker != null) {
ParamType param = SmooksModelUtils.getParam(freemarker.getParam(),
SmooksModelUtils.KEY_CSV_FIELDS);
- if (param == null){
+ if (param == null) {
param = SmooksFactory.eINSTANCE.createParamType();
param.setName(SmooksModelUtils.KEY_CSV_FIELDS);
freemarker.getParam().add(param);
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/model/javamapping/JavaBeanChildGraphModel.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/model/javamapping/JavaBeanChildGraphModel.java 2009-12-02
15:40:22 UTC (rev 18999)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/model/javamapping/JavaBeanChildGraphModel.java 2009-12-02
15:41:47 UTC (rev 19000)
@@ -11,6 +11,7 @@
package org.jboss.tools.smooks.graphical.editors.model.javamapping;
import java.util.Collections;
+import java.util.Iterator;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
@@ -29,6 +30,7 @@
import
org.jboss.tools.smooks.graphical.editors.model.AbstractResourceConfigChildNodeGraphModel;
import org.jboss.tools.smooks.graphical.editors.model.freemarker.CSVLinkConnection;
import org.jboss.tools.smooks.graphical.editors.model.freemarker.CSVNodeModel;
+import
org.jboss.tools.smooks.graphical.editors.model.freemarker.FreemarkerCSVNodeGraphicalModel;
import org.jboss.tools.smooks.model.javabean.ValueType;
/**
@@ -115,7 +117,24 @@
obj = AdapterFactoryEditingDomain.unwrap(obj);
if (obj instanceof ValueType || obj instanceof
org.jboss.tools.smooks.model.javabean12.ValueType) {
if (m instanceof CSVNodeModel) {
- return !((CSVNodeModel) m).isRecord();
+ if (!((CSVNodeModel) m).isRecord()) {
+ List<TreeNodeConnection> exsitingConnection = gm.getTargetConnections();
+ if (!exsitingConnection.isEmpty())
+ return false;
+ for (Iterator<?> iterator = exsitingConnection.iterator();
iterator.hasNext();) {
+ TreeNodeConnection treeNodeConnection = (TreeNodeConnection) iterator.next();
+ if (treeNodeConnection.getSourceNode() == this) {
+ return false;
+ }
+ }
+ AbstractSmooksGraphicalModel parent = gm.getParent();
+ if (parent instanceof FreemarkerCSVNodeGraphicalModel) {
+ List<TreeNodeConnection> connections = parent.getTargetConnections();
+ if (!connections.isEmpty()) {
+ return true;
+ }
+ }
+ }
}
}
if (!inJavaMapping())