Author: koen.aers(a)jboss.com
Date: 2009-05-28 17:04:00 -0400 (Thu, 28 May 2009)
New Revision: 15589
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/JavaTaskVariableSection.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/ScriptTaskExpressionSection.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/ScriptTaskLanguageSection.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/ScriptTaskTextSection.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/ScriptTaskVariableSection.java
Removed:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/JavaTaskVarSection.java
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlDeserializer.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlSerializer.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/ScriptTask.java
Log:
support script attributes and elements (GPD-329)
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml 2009-05-28 20:08:34 UTC (rev
15588)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml 2009-05-28 21:04:00 UTC (rev
15589)
@@ -453,11 +453,39 @@
</propertySection>
<propertySection
afterSection="org.jboss.tools.jpdl4.javaTask.method"
-
class="org.jboss.tools.flow.jpdl4.properties.JavaTaskVarSection"
+
class="org.jboss.tools.flow.jpdl4.properties.JavaTaskVariableSection"
id="org.jboss.tools.jpdl4.javaTask.var"
tab="org.jboss.tools.jpdl4.general">
<input type="org.jboss.tools.flow.jpdl4.model.JavaTask"/>
</propertySection>
+ <propertySection
+ afterSection="org.jboss.tools.jpdl4.name"
+
class="org.jboss.tools.flow.jpdl4.properties.ScriptTaskExpressionSection"
+ id="org.jboss.tools.jpdl4.scriptTask.expr"
+ tab="org.jboss.tools.jpdl4.general">
+ <input type="org.jboss.tools.flow.jpdl4.model.ScriptTask"/>
+ </propertySection>
+ <propertySection
+ afterSection="org.jboss.tools.jpdl4.scriptTask.expr"
+
class="org.jboss.tools.flow.jpdl4.properties.ScriptTaskLanguageSection"
+ id="org.jboss.tools.jpdl4.scriptTask.lang"
+ tab="org.jboss.tools.jpdl4.general">
+ <input type="org.jboss.tools.flow.jpdl4.model.ScriptTask"/>
+ </propertySection>
+ <propertySection
+ afterSection="org.jboss.tools.jpdl4.scriptTask.lang"
+
class="org.jboss.tools.flow.jpdl4.properties.ScriptTaskVariableSection"
+ id="org.jboss.tools.jpdl4.scriptTask.var"
+ tab="org.jboss.tools.jpdl4.general">
+ <input type="org.jboss.tools.flow.jpdl4.model.ScriptTask"/>
+ </propertySection>
+ <propertySection
+ afterSection="org.jboss.tools.jpdl4.scriptTask.var"
+
class="org.jboss.tools.flow.jpdl4.properties.ScriptTaskTextSection"
+ id="org.jboss.tools.jpdl4.scriptTask.text"
+ tab="org.jboss.tools.jpdl4.general">
+ <input type="org.jboss.tools.flow.jpdl4.model.ScriptTask"/>
+ </propertySection>
</propertySections>
</extension>
<extension
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlDeserializer.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlDeserializer.java 2009-05-28
20:08:34 UTC (rev 15588)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlDeserializer.java 2009-05-28
21:04:00 UTC (rev 15589)
@@ -25,6 +25,7 @@
import org.jboss.tools.flow.jpdl4.model.HumanTask;
import org.jboss.tools.flow.jpdl4.model.JavaTask;
import org.jboss.tools.flow.jpdl4.model.Process;
+import org.jboss.tools.flow.jpdl4.model.ScriptTask;
import org.jboss.tools.flow.jpdl4.model.SequenceFlow;
import org.jboss.tools.flow.jpdl4.model.SubprocessTask;
import org.jboss.tools.flow.jpdl4.model.Swimlane;
@@ -111,6 +112,15 @@
}
}
+ class ScriptTaskAttributeHandler extends NodeAttributeHandler {
+ public void deserializeAttributes(Wrapper wrapper, Element element) {
+ super.deserializeAttributes(wrapper, element);
+ wrapper.setPropertyValue(ScriptTask.EXPR, element.getAttribute("expr"));
+ wrapper.setPropertyValue(ScriptTask.LANG, element.getAttribute("lang"));
+ wrapper.setPropertyValue(ScriptTask.VAR, element.getAttribute("var"));
+ }
+ }
+
class TerminateEndEventAttributeHandler extends NodeAttributeHandler {
public void deserializeAttributes(Wrapper wrapper, Element element) {
super.deserializeAttributes(wrapper, element);
@@ -278,6 +288,21 @@
}
}
+ class ScriptTaskChildNodeHandler extends NodeChildNodeHandler {
+ public Wrapper deserializeChildNode(Wrapper parent, Node node) {
+ Wrapper result = null;
+ if (node instanceof Element && "text".equals(node.getNodeName())) {
+ String text = ((Element)node).getTextContent();
+ if (text != null && !("".equals(text))) {
+ parent.setPropertyValue(ScriptTask.TEXT, text);
+ }
+ } else {
+ result = super.deserializeChildNode(parent, node);
+ }
+ return result;
+ }
+ }
+
class ProcessChildNodeHandler implements ChildNodeDeserializer {
public Wrapper deserializeChildNode(Wrapper parent, Node node) {
Wrapper result = null;
@@ -477,6 +502,8 @@
return new TerminateEndEventAttributeHandler();
} else if (element instanceof JavaTask) {
return new JavaTaskAttributeHandler();
+ } else if (element instanceof ScriptTask) {
+ return new ScriptTaskAttributeHandler();
} else {
return new NodeAttributeHandler();
}
@@ -499,6 +526,8 @@
Object element = wrapper.getElement();
if (element instanceof ExclusiveGateway) {
return new ExclusiveGateWayChildNodeHandler();
+ } else if (element instanceof ScriptTask) {
+ return new ScriptTaskChildNodeHandler();
} else {
return new NodeChildNodeHandler();
}
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlSerializer.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlSerializer.java 2009-05-28
20:08:34 UTC (rev 15588)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlSerializer.java 2009-05-28
21:04:00 UTC (rev 15589)
@@ -382,6 +382,34 @@
}
}
+ class ScriptTaskWrapperSerializer extends ProcessNodeWrapperSerializer {
+ protected List<String> getAttributesToSave() {
+ List<String> result = super.getAttributesToSave();
+ result.add("expr");
+ result.add("lang");
+ result.add("var");
+ return result;
+ }
+ protected String getPropertyName(String attributeName) {
+ if ("expr".equals(attributeName)) {
+ return ScriptTask.EXPR;
+ } else if ("lang".equals(attributeName)) {
+ return ScriptTask.LANG;
+ } else if ("var".equals(attributeName)) {
+ return ScriptTask.VAR;
+ }
+ return super.getPropertyName(attributeName);
+ }
+ public void appendBody(StringBuffer buffer, Wrapper wrapper, int level) {
+ String text = (String)wrapper.getPropertyValue(ScriptTask.TEXT);
+ if (text != null && !("".equals(text))) {
+ buffer.append("\n");
+ appendPadding(buffer, level + 1);
+ buffer.append("<text>" + text + "</text>");
+ }
+ }
+ }
+
class HumanTaskWrapperSerializer extends ProcessNodeWrapperSerializer {
protected List<String> getAttributesToSave() {
List<String> result = super.getAttributesToSave();
@@ -659,7 +687,7 @@
} else if (element instanceof JavaTask) {
new JavaTaskWrapperSerializer().appendOpening(buffer, wrapper, level);
} else if (element instanceof ScriptTask) {
- new ProcessNodeWrapperSerializer().appendOpening(buffer, wrapper, level);
+ new ScriptTaskWrapperSerializer().appendOpening(buffer, wrapper, level);
} else if (element instanceof MailTask) {
new ProcessNodeWrapperSerializer().appendOpening(buffer, wrapper, level);
} else if (element instanceof ServiceTask) {
@@ -712,7 +740,7 @@
} else if (element instanceof JavaTask) {
new ProcessNodeWrapperSerializer().appendBody(buffer, wrapper, level);
} else if (element instanceof ScriptTask) {
- new ProcessNodeWrapperSerializer().appendBody(buffer, wrapper, level);
+ new ScriptTaskWrapperSerializer().appendBody(buffer, wrapper, level);
} else if (element instanceof MailTask) {
new ProcessNodeWrapperSerializer().appendBody(buffer, wrapper, level);
} else if (element instanceof ServiceTask) {
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/ScriptTask.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/ScriptTask.java 2009-05-28
20:08:34 UTC (rev 15588)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/ScriptTask.java 2009-05-28
21:04:00 UTC (rev 15589)
@@ -1,10 +1,111 @@
package org.jboss.tools.flow.jpdl4.model;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.IPropertySource;
+
public class ScriptTask extends Task {
+ public static final String EXPR =
"org.jboss.tools.flow.jpdl4.model.scriptTask.expr";
+ public static final String LANG =
"org.jboss.tools.flow.jpdl4.model.scriptTask.lang";
+ public static final String VAR =
"org.jboss.tools.flow.jpdl4.model.javaTask.var";
+ public static final String TEXT =
"org.jboss.tools.flow.jpdl4.model.javaTask.text";
+
+ private String expression;
+ private String language;
+ private String variableName;
+ private String text;
+
+ public ScriptTask() {
+ setMetaData("propertySource", new PropertySource());
+ }
+
+ public String getExpression() {
+ return expression;
+ }
+
+ public void setExpression(String expression) {
+ this.expression = expression;
+ }
+
+ public String getLanguage() {
+ return language;
+ }
+
+ public void setLanguage(String language) {
+ this.language = language;
+ }
+
+ public String getVariableName() {
+ return variableName;
+ }
+
+ public void setVariableName(String variableName) {
+ this.variableName = variableName;
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+
protected boolean isPropagationExclusive() {
return true;
}
+ private class PropertySource implements IPropertySource {
+
+ public Object getEditableValue() {
+ return null;
+ }
+
+ public IPropertyDescriptor[] getPropertyDescriptors() {
+ return new IPropertyDescriptor[0];
+ }
+
+ public Object getPropertyValue(Object id) {
+ if (EXPR.equals(id)) {
+ return getExpression();
+ } else if (LANG.equals(id)) {
+ return getLanguage();
+ } else if (VAR.equals(id)) {
+ return getVariableName();
+ } else if (TEXT.equals(id)) {
+ return getText();
+ }
+ return null;
+ }
+
+ public boolean isPropertySet(Object id) {
+ if (EXPR.equals(id)) {
+ return getExpression() != null;
+ } else if (LANG.equals(id)) {
+ return getLanguage() != null;
+ } else if (VAR.equals(id)) {
+ return getVariableName() != null;
+ } else if (TEXT.equals(id)) {
+ return getText() != null;
+ }
+ return false;
+ }
+
+ public void resetPropertyValue(Object id) {
+ }
+
+ public void setPropertyValue(Object id, Object value) {
+ if (EXPR.equals(id)) {
+ setExpression((String)value);
+ } else if (LANG.equals(id)) {
+ setLanguage((String)value);
+ } else if (VAR.equals(id)) {
+ setVariableName((String)value);
+ } else if (TEXT.equals(id)) {
+ setText((String)value);
+ }
+ }
+
+ }
}
Deleted:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/JavaTaskVarSection.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/JavaTaskVarSection.java 2009-05-28
20:08:34 UTC (rev 15588)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/JavaTaskVarSection.java 2009-05-28
21:04:00 UTC (rev 15589)
@@ -1,11 +0,0 @@
-package org.jboss.tools.flow.jpdl4.properties;
-
-import org.jboss.tools.flow.jpdl4.model.JavaTask;
-
-public class JavaTaskVarSection extends TextFieldPropertySection {
-
- public JavaTaskVarSection() {
- super(JavaTask.VAR, "Variable Name");
- }
-
-}
Copied:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/JavaTaskVariableSection.java
(from rev 15588,
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/JavaTaskVarSection.java)
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/JavaTaskVariableSection.java
(rev 0)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/JavaTaskVariableSection.java 2009-05-28
21:04:00 UTC (rev 15589)
@@ -0,0 +1,11 @@
+package org.jboss.tools.flow.jpdl4.properties;
+
+import org.jboss.tools.flow.jpdl4.model.JavaTask;
+
+public class JavaTaskVariableSection extends TextFieldPropertySection {
+
+ public JavaTaskVariableSection() {
+ super(JavaTask.VAR, "Variable Name");
+ }
+
+}
Property changes on:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/JavaTaskVariableSection.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/ScriptTaskExpressionSection.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/ScriptTaskExpressionSection.java
(rev 0)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/ScriptTaskExpressionSection.java 2009-05-28
21:04:00 UTC (rev 15589)
@@ -0,0 +1,11 @@
+package org.jboss.tools.flow.jpdl4.properties;
+
+import org.jboss.tools.flow.jpdl4.model.ScriptTask;
+
+public class ScriptTaskExpressionSection extends TextFieldPropertySection {
+
+ public ScriptTaskExpressionSection() {
+ super(ScriptTask.EXPR, "Expression");
+ }
+
+}
Property changes on:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/ScriptTaskExpressionSection.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/ScriptTaskLanguageSection.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/ScriptTaskLanguageSection.java
(rev 0)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/ScriptTaskLanguageSection.java 2009-05-28
21:04:00 UTC (rev 15589)
@@ -0,0 +1,11 @@
+package org.jboss.tools.flow.jpdl4.properties;
+
+import org.jboss.tools.flow.jpdl4.model.ScriptTask;
+
+public class ScriptTaskLanguageSection extends TextFieldPropertySection {
+
+ public ScriptTaskLanguageSection() {
+ super(ScriptTask.LANG, "Language");
+ }
+
+}
Property changes on:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/ScriptTaskLanguageSection.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/ScriptTaskTextSection.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/ScriptTaskTextSection.java
(rev 0)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/ScriptTaskTextSection.java 2009-05-28
21:04:00 UTC (rev 15589)
@@ -0,0 +1,11 @@
+package org.jboss.tools.flow.jpdl4.properties;
+
+import org.jboss.tools.flow.jpdl4.model.ScriptTask;
+
+public class ScriptTaskTextSection extends TextFieldPropertySection {
+
+ public ScriptTaskTextSection() {
+ super(ScriptTask.TEXT, "Text");
+ }
+
+}
Property changes on:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/ScriptTaskTextSection.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/ScriptTaskVariableSection.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/ScriptTaskVariableSection.java
(rev 0)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/ScriptTaskVariableSection.java 2009-05-28
21:04:00 UTC (rev 15589)
@@ -0,0 +1,11 @@
+package org.jboss.tools.flow.jpdl4.properties;
+
+import org.jboss.tools.flow.jpdl4.model.ScriptTask;
+
+public class ScriptTaskVariableSection extends TextFieldPropertySection {
+
+ public ScriptTaskVariableSection() {
+ super(ScriptTask.VAR, "Variable Name");
+ }
+
+}
Property changes on:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/ScriptTaskVariableSection.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain