Author: tfennelly
Date: 2010-10-28 12:25:29 -0400 (Thu, 28 Oct 2010)
New Revision: 26111
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/AbstractSmooksFormEditor.java
Log:
https://jira.jboss.org/browse/JBIDE-7428
Java source Input not being recognized by editor
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java 2010-10-28
16:04:27 UTC (rev 26110)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java 2010-10-28
16:25:29 UTC (rev 26111)
@@ -25,9 +25,11 @@
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Properties;
+import java.util.Set;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
@@ -173,6 +175,7 @@
import org.jboss.tools.smooks.model.smooks.SmooksFactory;
import org.jboss.tools.smooks.model.smooks.SmooksPackage;
import org.jboss.tools.smooks.model.smooks.SmooksResourceListType;
+import org.jboss.tools.smooks.model.smooks.impl.ParamTypeImpl;
/**
*
@@ -207,7 +210,18 @@
'F', 'g', 'G', 'h', 'H', 'i',
'I', 'j', 'J', 'k', 'K', 'l', 'L',
'm', 'M', 'n', 'N', 'o', 'O', 'p',
'P',
'q', 'Q', 'r', 'R', 's', 'S',
't', 'T', 'u', 'U', 'v', 'V', 'w',
'W', 'x', 'X', 'y', 'Y' };
+ public static final Set<String> validInputSourceTypes = new
LinkedHashSet<String>();
+
public static final String[] SELECTOR_SPERATORS = new String[] { " ",
"/" }; //$NON-NLS-1$ //$NON-NLS-2$
+
+ static {
+ validInputSourceTypes.add(SmooksModelUtils.INPUT_TYPE_CSV);
+ validInputSourceTypes.add(SmooksModelUtils.INPUT_TYPE_JAVA);
+ validInputSourceTypes.add(SmooksModelUtils.INPUT_TYPE_XML);
+ validInputSourceTypes.add(SmooksModelUtils.INPUT_TYPE_EDI_1_2);
+ validInputSourceTypes.add(SmooksModelUtils.INPUT_TYPE_XSD);
+ validInputSourceTypes.add(SmooksModelUtils.INPUT_TYPE_JSON_1_2);
+ }
private static void fillBeanIdStringList(EObject model, final Collection<String>
beanIdList) {
EStructuralFeature beanIDFeature = getBeanIDFeature(model);
@@ -3248,4 +3262,8 @@
}
return null;
}
+
+ public static boolean isValidInputSourceType(String inputType) {
+ return validInputSourceTypes.contains(inputType);
+ }
}
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/AbstractSmooksFormEditor.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/AbstractSmooksFormEditor.java 2010-10-28
16:04:27 UTC (rev 26110)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/AbstractSmooksFormEditor.java 2010-10-28
16:25:29 UTC (rev 26111)
@@ -784,28 +784,15 @@
String inputType = null;
if (param != null) {
inputType = param.getStringValue();
- String realInputType = SmooksUIUtils.judgeInputType(smooksModel);
- if (realInputType == null) {
- if (inputType != null) {
- if (inputType.equals(SmooksModelUtils.INPUT_TYPE_XML)
- || inputType.equals(SmooksModelUtils.INPUT_TYPE_JAVA)
- || inputType.equals(SmooksModelUtils.INPUT_TYPE_XSD)) {
-
- }
- }
+ if (inputType == null || !SmooksUIUtils.isValidInputSourceType(inputType)) {
+ this.setInputType(SmooksModelUtils.INPUT_TYPE_XML);
} else {
- if (!realInputType.equals(inputType)) {
- param.setStringValue(realInputType);
- inputType = realInputType;
- }
+ this.setInputType(inputType);
}
} else {
- inputType = SmooksUIUtils.judgeInputType(smooksModel);
- if (inputType != null) {
- SmooksUIUtils.addInputTypeParam(inputType, resourceList);
- }
+ this.setInputType(SmooksModelUtils.INPUT_TYPE_XML);
+ SmooksUIUtils.addInputTypeParam(SmooksModelUtils.INPUT_TYPE_XML, resourceList);
}
- this.setInputType(inputType);
}
public EObject getSmooksResourceList() {