Author: DartPeng
Date: 2010-01-06 02:59:28 -0500 (Wed, 06 Jan 2010)
New Revision: 19659
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/TaskTypeRules.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/Messages.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksProcessGraphicalEditor.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/messages.properties
Log:
JBIDE-5602
Fixed it
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/TaskTypeRules.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/TaskTypeRules.java 2010-01-06
07:18:47 UTC (rev 19658)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/TaskTypeRules.java 2010-01-06
07:59:28 UTC (rev 19659)
@@ -52,8 +52,15 @@
if (parentID.equals(TaskTypeManager.TASK_ID_FREEMARKER_CSV_TEMPLATE)) {
if (!TaskTypeManager.TASK_ID_JAVA_MAPPING.equals(currentTask.getId())) {
return false;
+ }else{
+ for (Iterator<?> iterator = taskList.iterator(); iterator.hasNext();) {
+ TaskType taskType = (TaskType) iterator.next();
+ if (TaskTypeManager.TASK_ID_FREEMARKER_CSV_TEMPLATE.equals(taskType.getId())) {
+ return false;
+ }
+ }
+ return true;
}
- return true;
}
if (parentID.equals(TaskTypeManager.TASK_ID_JAVA_MAPPING)) {
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/Messages.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/Messages.java 2010-01-06
07:18:47 UTC (rev 19658)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/Messages.java 2010-01-06
07:59:28 UTC (rev 19659)
@@ -34,6 +34,7 @@
public static String SmooksProcessGraphicalEditor_No_Input_File_Active;
public static String SmooksProcessGraphicalEditor_No_Input_Specified;
public static String SmooksProcessGraphicalEditor_No_Input_Task_Found;
+ public static String SmooksProcessGraphicalEditor_ValidationError_MultipleTemplate;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksProcessGraphicalEditor.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksProcessGraphicalEditor.java 2010-01-06
07:18:47 UTC (rev 19658)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksProcessGraphicalEditor.java 2010-01-06
07:59:28 UTC (rev 19659)
@@ -94,6 +94,7 @@
import org.jboss.tools.smooks.graphical.editors.process.TemplateAppyTaskNode;
import
org.jboss.tools.smooks.graphical.editors.template.SmooksFreemarkerCSVTemplateGraphicalEditor;
import
org.jboss.tools.smooks.graphical.editors.template.SmooksFreemarkerTemplateGraphicalEditor;
+import org.jboss.tools.smooks.model.freemarker.Freemarker;
import org.jboss.tools.smooks.model.javabean12.BeanType;
import org.jboss.tools.smooks.model.smooks.AbstractResourceConfig;
import org.jboss.tools.smooks.model.smooks.DocumentRoot;
@@ -1142,6 +1143,7 @@
SmooksResourceListType sr = getSmooksResourceListType();
List<AbstractResourceConfig> rcs = sr.getAbstractResourceConfig();
boolean correct = false;
+
for (Iterator<?> iterator = rcs.iterator(); iterator.hasNext();) {
AbstractResourceConfig abstractResourceConfig = (AbstractResourceConfig)
iterator.next();
if (abstractResourceConfig instanceof BeanType) {
@@ -1159,10 +1161,22 @@
SmooksResourceListType sr = getSmooksResourceListType();
List<AbstractResourceConfig> rcs = sr.getAbstractResourceConfig();
boolean correct = false;
+ boolean multipleTemplate = false;
+ int freemarkerCount = 0;
for (Iterator<?> iterator = rcs.iterator(); iterator.hasNext();) {
AbstractResourceConfig abstractResourceConfig = (AbstractResourceConfig)
iterator.next();
if (abstractResourceConfig instanceof BeanType) {
correct = true;
+ // break;
+ }
+ if (abstractResourceConfig instanceof Freemarker) {
+ freemarkerCount++;
+ }
+ if (freemarkerCount > 1) {
+ multipleTemplate = true;
+ // break;
+ }
+ if (!correct && multipleTemplate) {
break;
}
}
@@ -1170,6 +1184,10 @@
task.setProblemType(IFieldMarker.TYPE_WARINING);
task.addProblemMessage(Messages.SmooksProcessGraphicalEditor_4);
}
+ if (multipleTemplate) {
+ task.setProblemType(IFieldMarker.TYPE_ERROR);
+ task.addProblemMessage(Messages.SmooksProcessGraphicalEditor_ValidationError_MultipleTemplate);
+ }
}
}
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/messages.properties
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/messages.properties 2010-01-06
07:18:47 UTC (rev 19658)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/messages.properties 2010-01-06
07:59:28 UTC (rev 19659)
@@ -12,6 +12,7 @@
SmooksJavaMappingGraphicalEditor_NodeMustLinkWithSource=The node must be linked with
input source
SmooksJavaMappingGraphicalEditor_NullLabel=<NULL>
SmooksProcessGraphicalEditor_4=No java mapping has been specified in the Java Mapping
task.
+SmooksProcessGraphicalEditor_ValidationError_MultipleTemplate=Doesn't support
multiple template task.
SmooksProcessGraphicalEditor_AddTaskActionText=Add Task
SmooksProcessGraphicalEditor_FormText=Smooks Processing
SmooksProcessGraphicalEditor_TaskConfigurationSectionTitle=Selected Task Details
Show replies by date