Author: DartPeng
Date: 2009-03-06 01:42:12 -0500 (Fri, 06 Mar 2009)
New Revision: 14068
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/util/SmooksModelConstants.java
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/util/SmooksModelUtils.java
Log:
JBIDE-3945
Fix it
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/util/SmooksModelConstants.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/util/SmooksModelConstants.java 2009-03-06
06:18:02 UTC (rev 14067)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/util/SmooksModelConstants.java 2009-03-06
06:42:12 UTC (rev 14068)
@@ -19,7 +19,6 @@
public static final String STREAM_FILTER_TYPE = "stream.filter.type";
public static final String SAX = "SAX";
public static final String DOM = "DOM";
- public static final String SAX_DOM = "SAX/DOM";
public static final String BEAN_POPULATOR =
"org.milyn.javabean.BeanPopulator";
public static final String[] DECODER_CLASSES = new String[] {
@@ -34,11 +33,11 @@
public static final String BEAN_ID = "beanId";
- public static final String FORMATE = "formate";
+ public static final String FORMATE = "format";
public static final String LOCALE_LANGUAGE = "Locale-Language";
- public static final String LOCALE_CONTRY = "Locale-Contry";
+ public static final String LOCALE_CONTRY = "Locale-Country";
public static final String BEAN_CLASS = "beanClass";
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/util/SmooksModelUtils.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/util/SmooksModelUtils.java 2009-03-06
06:18:02 UTC (rev 14067)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/util/SmooksModelUtils.java 2009-03-06
06:42:12 UTC (rev 14068)
@@ -31,11 +31,11 @@
*/
public class SmooksModelUtils {
-
+
public static final String TYPE_XSL = "xsl";
-
- public static final String[] TEMPLATE_TYPES = new String[] {
"xsl","ftl" };
-
+
+ public static final String[] TEMPLATE_TYPES = new String[] { "xsl",
"ftl" };
+
public static final String BEAN_CLASS = "beanClass";
public static final String BEAN_ID = "beanId";
@@ -78,44 +78,52 @@
}
return Collections.EMPTY_LIST;
}
-
+
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 (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){
+
+ public static void setPropertyValueToAnyType(Object value,
+ EStructuralFeature attribute, AnyType anyType) {
anyType.getAnyAttribute().set(attribute, value);
}
-
- public static AnyType getBindingViaProperty(ResourceConfigType resourceConfig , String
property){
+
+ 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)){
+ 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){
+
+ public static boolean isInnerFileContents(ResourceConfigType resourceConfig) {
ResourceType resource = resourceConfig.getResource();
- if(resource == null) return false;
+ if (resource == null)
+ return false;
String type = resource.getType();
- if(type != null) type = type.trim();
+ 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;
+ if (type1.equalsIgnoreCase(type))
+ return true;
}
return false;
}
@@ -125,10 +133,11 @@
if (resource == null)
return false;
String value = resource.getStringValue();
- if(value != null) value = value.trim();
+ 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)){
+ if (decoderClass.equals(value)) {
return true;
}
}
@@ -224,16 +233,20 @@
ParamType param = null;
for (Iterator<ParamType> iterator = list.iterator(); iterator.hasNext();) {
ParamType paramType = (ParamType) iterator.next();
- if (paramType.getName().equalsIgnoreCase(paramName)) {
+ 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);
}
- param.setName(paramName);
setTextToAnyType(param, value);
}
@@ -242,7 +255,11 @@
List plist = resourceConfigType.getParam();
for (Iterator iterator = plist.iterator(); iterator.hasNext();) {
ParamType p = (ParamType) iterator.next();
- if (paramName.equalsIgnoreCase(p.getName())) {
+ String n = p.getName();
+ if (n == null)
+ continue;
+ n = n.trim();
+ if (paramName.equalsIgnoreCase(n)) {
return getAnyTypeText(p);
}
}
Show replies by date