Author: koen.aers(a)jboss.com
Date: 2009-06-02 22:51:37 -0400 (Tue, 02 Jun 2009)
New Revision: 15664
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/icons/16/argument.gif
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/icons/16/argument_multiple.gif
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/icons/16/field.gif
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/icons/16/field_multiple.gif
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/command/AddKeyValuePairToMapCommand.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/command/ChangeElementOfListCommand.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/ArgumentListTreeEditPart.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/ArgumentTreeEditPart.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/FieldListTreeEditPart.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/FieldTreeEditPart.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/JavaTaskTreeRootEditPart.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/handler/AddArgumentHandler.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/handler/AddFieldHandler.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/Argument.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/Field.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/ArgumentValueSection.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/FieldNameSection.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/FieldValueSection.java
Removed:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/JavaTaskArgumentsSection.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/JavaTaskFieldsSection.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/editpart/JpdlTreeEditPartFactory.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/handler/DeleteElementHandler.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/JavaTask.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/JpdlPropertySection.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/NameSection.java
Log:
support java attributes and elements (GPD-328)
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/icons/16/argument.gif
===================================================================
(Binary files differ)
Property changes on: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/icons/16/argument.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/icons/16/argument_multiple.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/icons/16/argument_multiple.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/icons/16/field.gif
===================================================================
(Binary files differ)
Property changes on: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/icons/16/field.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/icons/16/field_multiple.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/icons/16/field_multiple.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml 2009-06-03 01:30:14 UTC (rev
15663)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml 2009-06-03 02:51:37 UTC (rev
15664)
@@ -191,6 +191,7 @@
<node>
<figure
class="org.jboss.tools.flow.jpdl4.figure.TaskFigure"></figure>
</node>
+ </element>
<element
class="org.jboss.tools.flow.jpdl4.model.CustomTask"
figure="icons/16/task_empty.png"
@@ -201,7 +202,6 @@
<figure
class="org.jboss.tools.flow.jpdl4.figure.TaskFigure"></figure>
</node>
</element>
- </element>
<element
class="org.jboss.tools.flow.jpdl4.model.ExclusiveGateway"
figure="icons/16/gateway_exclusive.png"
@@ -282,6 +282,20 @@
label="output parameter"
language="org.jboss.tools.flow.jpdl4">
</element>
+ <element
+ class="org.jboss.tools.flow.jpdl4.model.Argument"
+ figure="icons/16/argument.gif"
+ id="org.jboss.tools.flow.jpdl4.argument"
+ label="argument"
+ language="org.jboss.tools.flow.jpdl4">
+ </element>
+ <element
+ class="org.jboss.tools.flow.jpdl4.model.Field"
+ figure="icons/16/field.gif"
+ id="org.jboss.tools.flow.jpdl4.field"
+ label="field"
+ language="org.jboss.tools.flow.jpdl4">
+ </element>
</extension>
<extension
point="org.eclipse.ui.newWizards">
@@ -582,17 +596,24 @@
<input
type="org.jboss.tools.flow.jpdl4.model.OutputParameter"/>
</propertySection>
<propertySection
-
class="org.jboss.tools.flow.jpdl4.properties.JavaTaskFieldsSection"
- id="org.jboss.tools.jpdl4.javaTask.fields"
- tab="org.jboss.tools.jpdl4.javaTask.fields">
- <input type="org.jboss.tools.flow.jpdl4.model.JavaTask"/>
+
class="org.jboss.tools.flow.jpdl4.properties.ArgumentValueSection"
+ id="org.jboss.tools.jpdl4.argument.value"
+ tab="org.jboss.tools.jpdl4.general">
+ <input type="org.jboss.tools.flow.jpdl4.model.Argument"/>
</propertySection>
<propertySection
-
class="org.jboss.tools.flow.jpdl4.properties.JavaTaskArgumentsSection"
- id="org.jboss.tools.jpdl4.javaTask.arguments"
- tab="org.jboss.tools.jpdl4.javaTask.arguments">
- <input type="org.jboss.tools.flow.jpdl4.model.JavaTask"/>
+ class="org.jboss.tools.flow.jpdl4.properties.FieldNameSection"
+ id="org.jboss.tools.jpdl4.field.name"
+ tab="org.jboss.tools.jpdl4.general">
+ <input type="org.jboss.tools.flow.jpdl4.model.Field"/>
</propertySection>
+ <propertySection
+ afterSection="org.jboss.tools.jpdl4.field.name"
+
class="org.jboss.tools.flow.jpdl4.properties.FieldValueSection"
+ id="org.jboss.tools.jpdl4.field.value"
+ tab="org.jboss.tools.jpdl4.general">
+ <input type="org.jboss.tools.flow.jpdl4.model.Field"/>
+ </propertySection>
</propertySections>
</extension>
<extension
@@ -644,6 +665,18 @@
</command>
<command
categoryId="org.jboss.tools.flow.jpdl4"
+
defaultHandler="org.jboss.tools.flow.jpdl4.handler.AddArgumentHandler"
+ id="org.jboss.tools.flow.jpdl4.addArgument"
+ name="Add Argument">
+ </command>
+ <command
+ categoryId="org.jboss.tools.flow.jpdl4"
+
defaultHandler="org.jboss.tools.flow.jpdl4.handler.AddFieldHandler"
+ id="org.jboss.tools.flow.jpdl4.addField"
+ name="Add Field">
+ </command>
+ <command
+ categoryId="org.jboss.tools.flow.jpdl4"
defaultHandler="org.jboss.tools.flow.jpdl4.handler.DeleteElementHandler"
id="org.jboss.tools.flow.jpdl4.delete"
name="Delete">
@@ -754,6 +787,44 @@
</iterate>
</visibleWhen>
</command>
+ <command
+ commandId="org.jboss.tools.flow.jpdl4.addArgument"
+ icon="icons/16/argument.gif"
+ id="org.jboss.tools.flow.jpdl4.addArgument"
+ style="push">
+ <visibleWhen
+ checkEnabled="true">
+ <iterate>
+ <or>
+ <instanceof
+
value="org.jboss.tools.flow.jpdl4.editpart.JavaTaskTreeRootEditPart">
+ </instanceof>
+ <instanceof
+
value="org.jboss.tools.flow.jpdl4.editpart.ArgumentListTreeEditPart">
+ </instanceof>
+ </or>
+ </iterate>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.jboss.tools.flow.jpdl4.addField"
+ icon="icons/16/field.gif"
+ id="org.jboss.tools.flow.jpdl4.addField"
+ style="push">
+ <visibleWhen
+ checkEnabled="true">
+ <iterate>
+ <or>
+ <instanceof
+
value="org.jboss.tools.flow.jpdl4.editpart.JavaTaskTreeRootEditPart">
+ </instanceof>
+ <instanceof
+
value="org.jboss.tools.flow.jpdl4.editpart.FieldListTreeEditPart">
+ </instanceof>
+ </or>
+ </iterate>
+ </visibleWhen>
+ </command>
<separator
name="org.jboss.tools.flow.jpdl4.details.separator1"
visible="true">
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/command/AddKeyValuePairToMapCommand.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/command/AddKeyValuePairToMapCommand.java
(rev 0)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/command/AddKeyValuePairToMapCommand.java 2009-06-03
02:51:37 UTC (rev 15664)
@@ -0,0 +1,61 @@
+package org.jboss.tools.flow.jpdl4.command;
+
+import java.util.Map;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.ui.views.properties.IPropertySource;
+
+public class AddKeyValuePairToMapCommand extends Command {
+
+ private IPropertySource target;
+
+ private Object mapId;
+ private Object key;
+ private Object newValue;
+ private Object oldValue;
+
+ @SuppressWarnings("unchecked")
+ public void execute() {
+ Object object = target.getPropertyValue(mapId);
+ if (! (object instanceof Map)) return;
+ if (oldValue == null) {
+ oldValue = ((Map)object).get(key);
+ }
+ if (newValue == null) {
+ ((Map)object).remove(key);
+ } else {
+ ((Map)object).put(key, newValue);
+ }
+ }
+
+ public boolean canExecute() {
+ return target != null;
+ }
+
+ public void setMapId(Object mapId) {
+ this.mapId = mapId;
+ }
+
+ public void setKey(Object key) {
+ this.key = key;
+ }
+
+ public void setNewValue(Object newValue) {
+ this.newValue = newValue;
+ }
+
+ public void setTarget(IPropertySource target) {
+ this.target = target;
+ }
+
+ @SuppressWarnings("unchecked")
+ public void undo() {
+ Object object = target.getPropertyValue(mapId);
+ if (! (object instanceof Map)) return;
+ if (oldValue == null) {
+ ((Map)object).remove(key);
+ } else {
+ ((Map)object).put(key, oldValue);
+ }
+ }
+}
Property changes on:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/command/AddKeyValuePairToMapCommand.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/command/ChangeElementOfListCommand.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/command/ChangeElementOfListCommand.java
(rev 0)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/command/ChangeElementOfListCommand.java 2009-06-03
02:51:37 UTC (rev 15664)
@@ -0,0 +1,53 @@
+package org.jboss.tools.flow.jpdl4.command;
+
+import java.util.List;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.ui.views.properties.IPropertySource;
+
+public class ChangeElementOfListCommand extends Command {
+
+ private IPropertySource target;
+
+ private Object listId;
+ private int index;
+ private Object newValue;
+ private Object oldValue;
+
+ @SuppressWarnings("unchecked")
+ public void execute() {
+ Object object = target.getPropertyValue(listId);
+ if (! (object instanceof List)) return;
+ if (oldValue == null) {
+ oldValue = ((List)object).get(index);
+ }
+ ((List)object).set(index, newValue);
+ }
+
+ public boolean canExecute() {
+ return target != null;
+ }
+
+ public void setListId(Object listId) {
+ this.listId = listId;
+ }
+
+ public void setIndex(int index) {
+ this.index = index;
+ }
+
+ public void setNewValue(Object newValue) {
+ this.newValue = newValue;
+ }
+
+ public void setTarget(IPropertySource target) {
+ this.target = target;
+ }
+
+ @SuppressWarnings("unchecked")
+ public void undo() {
+ Object object = target.getPropertyValue(listId);
+ if (! (object instanceof List)) return;
+ ((List)object).set(index, oldValue);
+ }
+}
Property changes on:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/command/ChangeElementOfListCommand.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
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-06-03
01:30:14 UTC (rev 15663)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlDeserializer.java 2009-06-03
02:51:37 UTC (rev 15664)
@@ -17,11 +17,13 @@
import org.jboss.tools.flow.common.wrapper.NodeWrapper;
import org.jboss.tools.flow.common.wrapper.Wrapper;
import org.jboss.tools.flow.jpdl4.Logger;
+import org.jboss.tools.flow.jpdl4.model.Argument;
import org.jboss.tools.flow.jpdl4.model.Assignment;
import org.jboss.tools.flow.jpdl4.model.AssignmentPropertySource;
import org.jboss.tools.flow.jpdl4.model.EventListener;
import org.jboss.tools.flow.jpdl4.model.EventListenerContainer;
import org.jboss.tools.flow.jpdl4.model.ExclusiveGateway;
+import org.jboss.tools.flow.jpdl4.model.Field;
import org.jboss.tools.flow.jpdl4.model.HumanTask;
import org.jboss.tools.flow.jpdl4.model.InputParameter;
import org.jboss.tools.flow.jpdl4.model.JavaTask;
@@ -200,6 +202,28 @@
}
}
+ class ArgumentAttributeHandler extends DefaultAttributeDeserializer {
+ protected List<String> getAttributesToRead() {
+ List<String> result = super.getAttributesToRead();
+ return result;
+ }
+ }
+
+ class FieldAttributeHandler extends DefaultAttributeDeserializer {
+ protected List<String> getAttributesToRead() {
+ List<String> result = super.getAttributesToRead();
+ result.add(Field.NAME);
+ return result;
+ }
+ protected String getXmlName(String attributeName) {
+ if (Field.NAME.equals(attributeName)) {
+ return "name";
+ } else {
+ return super.getXmlName(attributeName);
+ }
+ }
+ }
+
class SubprocessTaskAttributeHandler extends NodeAttributeHandler {
protected List<String> getAttributesToRead() {
List<String> result = super.getAttributesToRead();
@@ -339,6 +363,49 @@
}
}
+ class ArgumentChildNodeHandler extends NodeChildNodeHandler {
+ public Wrapper deserializeChildNode(Wrapper parent, Node node) {
+ Wrapper result = null;
+ if (node instanceof Element && "string".equals(node.getNodeName()))
{
+ String value = ((Element)node).getAttribute("value");
+ if (value != null && !("".equals(value))) {
+ parent.setPropertyValue(Argument.VALUE, value);
+ }
+ } else {
+ result = super.deserializeChildNode(parent, node);
+ }
+ return result;
+ }
+ }
+
+ class FieldChildNodeHandler extends NodeChildNodeHandler {
+ public Wrapper deserializeChildNode(Wrapper parent, Node node) {
+ Wrapper result = null;
+ if (node instanceof Element && "string".equals(node.getNodeName()))
{
+ String value = ((Element)node).getAttribute("value");
+ if (value != null && !("".equals(value))) {
+ parent.setPropertyValue(Field.VALUE, value);
+ }
+ } else {
+ result = super.deserializeChildNode(parent, node);
+ }
+ return result;
+ }
+ }
+
+ class JavaTaskChildNodeHandler extends NodeChildNodeHandler {
+ public Wrapper deserializeChildNode(Wrapper parent, Node node) {
+ Wrapper result = super.deserializeChildNode(parent, node);
+ if (result == null) return result;
+ if (result.getElement() instanceof Argument) {
+ parent.addChild(JavaTask.ARGS, result);
+ } else if (result.getElement() instanceof Field) {
+ parent.addChild(JavaTask.FIELDS, result);
+ }
+ return result;
+ }
+ }
+
class ProcessChildNodeHandler implements ChildNodeDeserializer {
public Wrapper deserializeChildNode(Wrapper parent, Node node) {
Wrapper result = null;
@@ -537,6 +604,10 @@
return new EventListenerAttributeHandler();
} else if (element instanceof Parameter) {
return new ParameterAttributeHandler();
+ } else if (element instanceof Argument) {
+ return new ArgumentAttributeHandler();
+ } else if (element instanceof Field) {
+ return new FieldAttributeHandler();
}
return null;
}
@@ -581,15 +652,23 @@
return new ScriptTaskChildNodeHandler();
} else if (element instanceof SubprocessTask) {
return new SubprocessTaskChildNodeHandler();
+ } else if (element instanceof JavaTask) {
+ return new JavaTaskChildNodeHandler();
} else {
return new NodeChildNodeHandler();
}
}
private ChildNodeDeserializer getDefaultChildNodeHandler(Wrapper wrapper) {
- if (wrapper.getElement() != null && wrapper.getElement() instanceof
EventListenerContainer) {
+ Object element = wrapper.getElement();
+ if (element == null) return null;
+ if (element instanceof EventListenerContainer) {
return new EventListenerContainerChildNodeHandler();
- }
+ } else if (element instanceof Argument) {
+ return new ArgumentChildNodeHandler();
+ } else if (element instanceof Field) {
+ return new FieldChildNodeHandler();
+ }
return null;
}
@@ -618,6 +697,8 @@
else if ("event-listener".equals(nodeName)) return
"org.jboss.tools.flow.jpdl4.eventListener";
else if ("parameter-in".equals(nodeName)) return
"org.jboss.tools.flow.jpdl4.inputParameter";
else if ("parameter-out".equals(nodeName)) return
"org.jboss.tools.flow.jpdl4.outputParameter";
+ else if ("field".equals(nodeName)) return
"org.jboss.tools.flow.jpdl4.field";
+ else if ("arg".equals(nodeName)) return
"org.jboss.tools.flow.jpdl4.argument";
else return null;
}
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-06-03
01:30:14 UTC (rev 15663)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlSerializer.java 2009-06-03
02:51:37 UTC (rev 15664)
@@ -29,6 +29,7 @@
import org.jboss.tools.flow.common.wrapper.NodeWrapper;
import org.jboss.tools.flow.common.wrapper.Wrapper;
import org.jboss.tools.flow.jpdl4.Logger;
+import org.jboss.tools.flow.jpdl4.model.Argument;
import org.jboss.tools.flow.jpdl4.model.Assignment;
import org.jboss.tools.flow.jpdl4.model.CancelEndEvent;
import org.jboss.tools.flow.jpdl4.model.CustomTask;
@@ -36,6 +37,7 @@
import org.jboss.tools.flow.jpdl4.model.EventListener;
import org.jboss.tools.flow.jpdl4.model.EventListenerContainer;
import org.jboss.tools.flow.jpdl4.model.ExclusiveGateway;
+import org.jboss.tools.flow.jpdl4.model.Field;
import org.jboss.tools.flow.jpdl4.model.ForkParallelGateway;
import org.jboss.tools.flow.jpdl4.model.HqlTask;
import org.jboss.tools.flow.jpdl4.model.HumanTask;
@@ -209,6 +211,8 @@
else if ("org.jboss.tools.flow.jpdl4.eventListener".equals(elementId)) return
"event-listener";
else if ("org.jboss.tools.flow.jpdl4.inputParameter".equals(elementId))
return "parameter-in";
else if ("org.jboss.tools.flow.jpdl4.outputParameter".equals(elementId))
return "parameter-out";
+ else if ("org.jboss.tools.flow.jpdl4.argument".equals(elementId)) return
"arg";
+ else if ("org.jboss.tools.flow.jpdl4.field".equals(elementId)) return
"field";
else return null;
}
@@ -393,6 +397,23 @@
}
return super.getPropertyName(attributeName);
}
+ public void appendBody(StringBuffer buffer, Wrapper wrapper, int level) {
+ List<Element> fields = wrapper.getChildren(JavaTask.FIELDS);
+ if (fields != null) {
+ for (Element field : fields) {
+ if (!(field instanceof Wrapper)) continue;
+ appendToBuffer(buffer, (Wrapper)field, level+1);
+ }
+ }
+ List<Element> arguments = wrapper.getChildren(JavaTask.ARGS);
+ if (arguments != null) {
+ for (Element argument : arguments) {
+ if (!(argument instanceof Wrapper)) continue;
+ appendToBuffer(buffer, (Wrapper)argument, level+1);
+ }
+ }
+ super.appendBody(buffer, wrapper, level);
+ }
}
class ScriptTaskWrapperSerializer extends ProcessNodeWrapperSerializer {
@@ -542,6 +563,45 @@
}
}
+ class ArgumentWrapperSerializer extends AbstractWrapperSerializer {
+ protected List<String> getAttributesToSave() {
+ ArrayList<String> result = new ArrayList<String>();
+ return result;
+ }
+ public void appendBody(StringBuffer buffer, Wrapper wrapper, int level) {
+ String value = (String)wrapper.getPropertyValue(Argument.VALUE);
+ if (value != null && !("".equals(value))) {
+ buffer.append("\n");
+ appendPadding(buffer, level + 1);
+ buffer.append("<string value=\"" + value +
"\"/>");
+ }
+ super.appendBody(buffer, wrapper, level);
+ }
+ }
+
+ class FieldWrapperSerializer extends AbstractWrapperSerializer {
+ protected List<String> getAttributesToSave() {
+ ArrayList<String> result = new ArrayList<String>();
+ result.add("name");
+ return result;
+ }
+ protected String getPropertyName(String attributeName) {
+ if ("name".equals(attributeName)) {
+ return Field.NAME;
+ }
+ return super.getPropertyName(attributeName);
+ }
+ public void appendBody(StringBuffer buffer, Wrapper wrapper, int level) {
+ String value = (String)wrapper.getPropertyValue(Field.VALUE);
+ if (value != null && !("".equals(value))) {
+ buffer.append("\n");
+ appendPadding(buffer, level + 1);
+ buffer.append("<string value=\"" + value +
"\"/>");
+ }
+ super.appendBody(buffer, wrapper, level);
+ }
+ }
+
class SubprocessTaskWrapperSerializer extends ProcessNodeWrapperSerializer {
protected List<String> getAttributesToSave() {
List<String> result = super.getAttributesToSave();
@@ -769,6 +829,10 @@
new EventListenerWrapperSerializer().appendOpening(buffer, wrapper, level);
} else if (element instanceof Parameter) {
new ParameterWrapperSerializer().appendOpening(buffer, wrapper, level);
+ } else if (element instanceof Argument) {
+ new ArgumentWrapperSerializer().appendOpening(buffer, wrapper, level);
+ } else if (element instanceof Field) {
+ new FieldWrapperSerializer().appendOpening(buffer, wrapper, level);
}
}
@@ -795,7 +859,7 @@
} else if (element instanceof SqlTask) {
new ProcessNodeWrapperSerializer().appendBody(buffer, wrapper, level);
} else if (element instanceof JavaTask) {
- new ProcessNodeWrapperSerializer().appendBody(buffer, wrapper, level);
+ new JavaTaskWrapperSerializer().appendBody(buffer, wrapper, level);
} else if (element instanceof ScriptTask) {
new ScriptTaskWrapperSerializer().appendBody(buffer, wrapper, level);
} else if (element instanceof MailTask) {
@@ -824,6 +888,10 @@
new EventListenerContainerWrapperSerializer().appendBody(buffer, wrapper, level);
} else if (element instanceof EventListener) {
new EventListenerWrapperSerializer().appendBody(buffer, wrapper, level);
+ } else if (element instanceof Argument) {
+ new ArgumentWrapperSerializer().appendBody(buffer, wrapper, level);
+ } else if (element instanceof Field) {
+ new FieldWrapperSerializer().appendBody(buffer, wrapper, level);
}
ArrayList<Node> trailingNodeList =
(ArrayList<Node>)element.getMetaData("trailingNodes");
boolean appendTrailingNodes = trailingNodeList != null &&
!trailingNodeList.isEmpty();
@@ -895,6 +963,10 @@
buffer.append("</parameter-in>");
} else if (element instanceof OutputParameter) {
buffer.append("</parameter-out>");
+ } else if (element instanceof Argument) {
+ buffer.append("</arg>");
+ } else if (element instanceof Field) {
+ buffer.append("</field>");
}
}
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/ArgumentListTreeEditPart.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/ArgumentListTreeEditPart.java
(rev 0)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/ArgumentListTreeEditPart.java 2009-06-03
02:51:37 UTC (rev 15664)
@@ -0,0 +1,34 @@
+package org.jboss.tools.flow.jpdl4.editpart;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+import org.jboss.tools.flow.common.model.Element;
+import org.jboss.tools.flow.jpdl4.util.SharedImages;
+
+public class ArgumentListTreeEditPart extends JpdlTreeEditPart {
+
+ public ArgumentListTreeEditPart(List<Element> arguments) {
+ super(arguments);
+ }
+
+ protected Image getImage() {
+ String iconPath = "icons/16/argument_multiple.gif";
+ ImageDescriptor descriptor = ImageDescriptor.createFromURL(
+ Platform.getBundle("org.jboss.tools.flow.jpdl4").getEntry(iconPath));
+ return SharedImages.INSTANCE.getImage(descriptor);
+ }
+
+ protected String getText() {
+ return "Arguments";
+ }
+
+ @SuppressWarnings("unchecked")
+ protected List<Object> getModelChildren() {
+ return (List<Object>)getModel();
+ }
+
+
+}
Property changes on:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/ArgumentListTreeEditPart.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/ArgumentTreeEditPart.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/ArgumentTreeEditPart.java
(rev 0)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/ArgumentTreeEditPart.java 2009-06-03
02:51:37 UTC (rev 15664)
@@ -0,0 +1,44 @@
+package org.jboss.tools.flow.jpdl4.editpart;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+import org.jboss.tools.flow.common.wrapper.ModelEvent;
+import org.jboss.tools.flow.common.wrapper.Wrapper;
+import org.jboss.tools.flow.jpdl4.model.Argument;
+import org.jboss.tools.flow.jpdl4.util.SharedImages;
+
+public class ArgumentTreeEditPart extends JpdlTreeEditPart implements ElementTreeEditPart
{
+
+ public ArgumentTreeEditPart(Wrapper wrapper) {
+ super(wrapper);
+ }
+
+ protected Image getImage() {
+ String iconPath = "icons/16/argument.gif";
+ ImageDescriptor descriptor = ImageDescriptor.createFromURL(
+ Platform.getBundle("org.jboss.tools.flow.jpdl4").getEntry(iconPath));
+ return SharedImages.INSTANCE.getImage(descriptor);
+ }
+
+ protected String getText() {
+ String value = (String)((Wrapper)getModel()).getPropertyValue(Argument.VALUE);
+ return (value != null && !("".equals(value))) ? value :
"field";
+ }
+
+ public void modelChanged(ModelEvent event) {
+ if (event.getChangeType() == Wrapper.CHANGE_PROPERTY) {
+ refreshVisuals();
+ }
+ }
+
+ public void activate() {
+ super.activate();
+ ((Wrapper)getModel()).addListener(this);
+ }
+
+ public void deactivate() {
+ ((Wrapper)getModel()).removeListener(this);
+ super.deactivate();
+ }
+}
Property changes on:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/ArgumentTreeEditPart.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/FieldListTreeEditPart.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/FieldListTreeEditPart.java
(rev 0)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/FieldListTreeEditPart.java 2009-06-03
02:51:37 UTC (rev 15664)
@@ -0,0 +1,34 @@
+package org.jboss.tools.flow.jpdl4.editpart;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+import org.jboss.tools.flow.common.model.Element;
+import org.jboss.tools.flow.jpdl4.util.SharedImages;
+
+public class FieldListTreeEditPart extends JpdlTreeEditPart {
+
+ public FieldListTreeEditPart(List<Element> fields) {
+ super(fields);
+ }
+
+ protected Image getImage() {
+ String iconPath = "icons/16/field_multiple.gif";
+ ImageDescriptor descriptor = ImageDescriptor.createFromURL(
+ Platform.getBundle("org.jboss.tools.flow.jpdl4").getEntry(iconPath));
+ return SharedImages.INSTANCE.getImage(descriptor);
+ }
+
+ protected String getText() {
+ return "Fields";
+ }
+
+ @SuppressWarnings("unchecked")
+ protected List<Object> getModelChildren() {
+ return (List<Object>)getModel();
+ }
+
+
+}
Property changes on:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/FieldListTreeEditPart.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/FieldTreeEditPart.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/FieldTreeEditPart.java
(rev 0)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/FieldTreeEditPart.java 2009-06-03
02:51:37 UTC (rev 15664)
@@ -0,0 +1,44 @@
+package org.jboss.tools.flow.jpdl4.editpart;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+import org.jboss.tools.flow.common.wrapper.ModelEvent;
+import org.jboss.tools.flow.common.wrapper.Wrapper;
+import org.jboss.tools.flow.jpdl4.model.Field;
+import org.jboss.tools.flow.jpdl4.util.SharedImages;
+
+public class FieldTreeEditPart extends JpdlTreeEditPart implements ElementTreeEditPart {
+
+ public FieldTreeEditPart(Wrapper wrapper) {
+ super(wrapper);
+ }
+
+ protected Image getImage() {
+ String iconPath = "icons/16/field.gif";
+ ImageDescriptor descriptor = ImageDescriptor.createFromURL(
+ Platform.getBundle("org.jboss.tools.flow.jpdl4").getEntry(iconPath));
+ return SharedImages.INSTANCE.getImage(descriptor);
+ }
+
+ protected String getText() {
+ String name = (String)((Wrapper)getModel()).getPropertyValue(Field.NAME);
+ return (name != null && !("".equals(name))) ? name :
"field";
+ }
+
+ public void modelChanged(ModelEvent event) {
+ if (event.getChangeType() == Wrapper.CHANGE_PROPERTY) {
+ refreshVisuals();
+ }
+ }
+
+ public void activate() {
+ super.activate();
+ ((Wrapper)getModel()).addListener(this);
+ }
+
+ public void deactivate() {
+ ((Wrapper)getModel()).removeListener(this);
+ super.deactivate();
+ }
+}
Property changes on:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/FieldTreeEditPart.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/JavaTaskTreeRootEditPart.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/JavaTaskTreeRootEditPart.java
(rev 0)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/JavaTaskTreeRootEditPart.java 2009-06-03
02:51:37 UTC (rev 15664)
@@ -0,0 +1,39 @@
+package org.jboss.tools.flow.jpdl4.editpart;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.tools.flow.common.model.Element;
+import org.jboss.tools.flow.common.wrapper.Wrapper;
+import org.jboss.tools.flow.jpdl4.model.JavaTask;
+
+public class JavaTaskTreeRootEditPart extends TaskTreeRootEditPart {
+
+ public JavaTaskTreeRootEditPart(Wrapper wrapper) {
+ super(wrapper);
+ }
+
+ protected List<Object> getModelChildren() {
+ List<Object> result = new ArrayList<Object>();
+ addFields(result, (Wrapper)getModel());
+ addArguments(result, (Wrapper)getModel());
+ result.addAll(super.getModelChildren());
+ return result;
+ }
+
+ private void addFields(List<Object> list, Wrapper wrapper) {
+ List<Element> fields = wrapper.getChildren(JavaTask.FIELDS);
+ if (fields != null && !fields.isEmpty()) {
+ list.add(new FieldListTreeEditPart(fields));
+ }
+ }
+
+ private void addArguments(List<Object> list, Wrapper wrapper) {
+ List<Element> arguments = wrapper.getChildren(JavaTask.ARGS);
+ if (arguments != null && !arguments.isEmpty()) {
+ list.add(new ArgumentListTreeEditPart(arguments));
+ }
+ }
+
+
+}
Property changes on:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/JavaTaskTreeRootEditPart.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/JpdlTreeEditPartFactory.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/JpdlTreeEditPartFactory.java 2009-06-03
01:30:14 UTC (rev 15663)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/JpdlTreeEditPartFactory.java 2009-06-03
02:51:37 UTC (rev 15664)
@@ -7,8 +7,11 @@
import org.jboss.tools.flow.common.wrapper.FlowWrapper;
import org.jboss.tools.flow.common.wrapper.NodeWrapper;
import org.jboss.tools.flow.common.wrapper.Wrapper;
+import org.jboss.tools.flow.jpdl4.model.Argument;
import org.jboss.tools.flow.jpdl4.model.EventListener;
import org.jboss.tools.flow.jpdl4.model.EventListenerContainer;
+import org.jboss.tools.flow.jpdl4.model.Field;
+import org.jboss.tools.flow.jpdl4.model.JavaTask;
import org.jboss.tools.flow.jpdl4.model.Parameter;
import org.jboss.tools.flow.jpdl4.model.SubprocessTask;
import org.jboss.tools.flow.jpdl4.model.Swimlane;
@@ -21,6 +24,7 @@
if (model instanceof NodeWrapper && context == null) {
Element element = ((NodeWrapper)model).getElement();
if (element instanceof SubprocessTask) return new
SubprocessTaskTreeRootEditPart((Wrapper)model);
+ if (element instanceof JavaTask) return new JavaTaskTreeRootEditPart((Wrapper)model);
return new TaskTreeRootEditPart((NodeWrapper)model);
}
if (model instanceof ConnectionWrapper && context == null) return new
SequenceFlowTreeRootEditPart((ConnectionWrapper)model);
@@ -28,6 +32,8 @@
Element element = ((Wrapper)model).getElement();
if (element instanceof Swimlane) return new SwimlaneTreeEditPart((Wrapper)model);
if (element instanceof Parameter) return new ParameterTreeEditPart((Wrapper)model);
+ if (element instanceof Argument) return new ArgumentTreeEditPart((Wrapper)model);
+ if (element instanceof Field) return new FieldTreeEditPart((Wrapper)model);
if (element instanceof EventListenerContainer) return new
EventListenerListTreeEditPart((Wrapper)model);
if (element instanceof EventListener) return new
EventListenerTreeEditPart((Wrapper)model);
if (element instanceof Timer) return new TimerTreeEditPart((Wrapper)model);
@@ -36,6 +42,8 @@
if (model instanceof SwimlaneListTreeEditPart) return (EditPart)model;
if (model instanceof InputParameterListTreeEditPart) return (EditPart)model;
if (model instanceof OutputParameterListTreeEditPart) return (EditPart)model;
+ if (model instanceof ArgumentListTreeEditPart) return (EditPart)model;
+ if (model instanceof FieldListTreeEditPart) return (EditPart)model;
if (model instanceof TimerListTreeEditPart) return (EditPart)model;
if (model instanceof ListenerListTreeEditPart) return (EditPart)model;
return new NoDetailsTreeRootEditPart();
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/handler/AddArgumentHandler.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/handler/AddArgumentHandler.java
(rev 0)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/handler/AddArgumentHandler.java 2009-06-03
02:51:37 UTC (rev 15664)
@@ -0,0 +1,17 @@
+package org.jboss.tools.flow.jpdl4.handler;
+
+import org.jboss.tools.flow.jpdl4.model.JavaTask;
+
+public class AddArgumentHandler extends AddChildHandler {
+
+ @Override
+ protected String getChildId() {
+ return "org.jboss.tools.flow.jpdl4.argument";
+ }
+
+ @Override
+ protected String getChildType() {
+ return JavaTask.ARGS;
+ }
+
+}
Property changes on:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/handler/AddArgumentHandler.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/handler/AddFieldHandler.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/handler/AddFieldHandler.java
(rev 0)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/handler/AddFieldHandler.java 2009-06-03
02:51:37 UTC (rev 15664)
@@ -0,0 +1,17 @@
+package org.jboss.tools.flow.jpdl4.handler;
+
+import org.jboss.tools.flow.jpdl4.model.JavaTask;
+
+public class AddFieldHandler extends AddChildHandler {
+
+ @Override
+ protected String getChildId() {
+ return "org.jboss.tools.flow.jpdl4.field";
+ }
+
+ @Override
+ protected String getChildType() {
+ return JavaTask.FIELDS;
+ }
+
+}
Property changes on:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/handler/AddFieldHandler.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/handler/DeleteElementHandler.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/handler/DeleteElementHandler.java 2009-06-03
01:30:14 UTC (rev 15663)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/handler/DeleteElementHandler.java 2009-06-03
02:51:37 UTC (rev 15664)
@@ -17,9 +17,12 @@
import org.jboss.tools.flow.common.wrapper.Wrapper;
import org.jboss.tools.flow.jpdl4.Logger;
import org.jboss.tools.flow.jpdl4.editpart.EventListenerListTreeEditPart;
+import org.jboss.tools.flow.jpdl4.model.Argument;
import org.jboss.tools.flow.jpdl4.model.EventListener;
import org.jboss.tools.flow.jpdl4.model.EventListenerContainer;
+import org.jboss.tools.flow.jpdl4.model.Field;
import org.jboss.tools.flow.jpdl4.model.InputParameter;
+import org.jboss.tools.flow.jpdl4.model.JavaTask;
import org.jboss.tools.flow.jpdl4.model.OutputParameter;
import org.jboss.tools.flow.jpdl4.model.SequenceFlow;
import org.jboss.tools.flow.jpdl4.model.SubprocessTask;
@@ -68,6 +71,10 @@
deleteChildCommand.setType(SubprocessTask.INPUT_PARAMETERS);
} else if (child.getElement() instanceof OutputParameter) {
deleteChildCommand.setType(SubprocessTask.OUTPUT_PARAMETERS);
+ } else if (child.getElement() instanceof Field) {
+ deleteChildCommand.setType(JavaTask.FIELDS);
+ } else if (child.getElement() instanceof Argument) {
+ deleteChildCommand.setType(JavaTask.ARGS);
}
deleteChildCommand.setParent(parent);
if (deleteChildCommand.canExecute()) {
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/Argument.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/Argument.java
(rev 0)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/Argument.java 2009-06-03
02:51:37 UTC (rev 15664)
@@ -0,0 +1,59 @@
+package org.jboss.tools.flow.jpdl4.model;
+
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.jboss.tools.flow.common.model.DefaultElement;
+
+public class Argument extends DefaultElement {
+
+ public static final String VALUE =
"org.jboss.tools.flow.jpdl4.model.argument.value";
+
+ private String value;
+
+ public Argument() {
+ setMetaData("propertySource", new PropertySource());
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ private class PropertySource implements IPropertySource {
+
+ public Object getEditableValue() {
+ return null;
+ }
+
+ public IPropertyDescriptor[] getPropertyDescriptors() {
+ return new IPropertyDescriptor[0];
+ }
+
+ public Object getPropertyValue(Object id) {
+ if (VALUE.equals(id)) {
+ return getValue();
+ }
+ return null;
+ }
+
+ public boolean isPropertySet(Object id) {
+ if (VALUE.equals(id)) {
+ return getValue() != null;
+ }
+ return false;
+ }
+
+ public void resetPropertyValue(Object id) {
+ }
+
+ public void setPropertyValue(Object id, Object value) {
+ if (VALUE.equals(id)) {
+ setValue((String)value);
+ }
+ }
+
+ }
+}
Property changes on:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/Argument.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/Field.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/Field.java
(rev 0)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/Field.java 2009-06-03
02:51:37 UTC (rev 15664)
@@ -0,0 +1,75 @@
+package org.jboss.tools.flow.jpdl4.model;
+
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.jboss.tools.flow.common.model.DefaultElement;
+
+public class Field extends DefaultElement {
+
+ public static final String NAME =
"org.jboss.tools.flow.jpdl4.model.field.name";
+ public static final String VALUE =
"org.jboss.tools.flow.jpdl4.model.field.value";
+
+ private String value;
+ private String name;
+
+ public Field() {
+ setMetaData("propertySource", new PropertySource());
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ private class PropertySource implements IPropertySource {
+
+ public Object getEditableValue() {
+ return null;
+ }
+
+ public IPropertyDescriptor[] getPropertyDescriptors() {
+ return new IPropertyDescriptor[0];
+ }
+
+ public Object getPropertyValue(Object id) {
+ if (VALUE.equals(id)) {
+ return getValue();
+ } else if (NAME.equals(id)) {
+ return getName();
+ }
+ return null;
+ }
+
+ public boolean isPropertySet(Object id) {
+ if (VALUE.equals(id)) {
+ return getValue() != null;
+ } else if (NAME.equals(id)) {
+ return getName() != null;
+ }
+ return false;
+ }
+
+ public void resetPropertyValue(Object id) {
+ }
+
+ public void setPropertyValue(Object id, Object value) {
+ if (VALUE.equals(id)) {
+ setValue((String)value);
+ } else if (NAME.equals(id)) {
+ setName((String)value);
+ }
+ }
+
+ }
+}
Property changes on:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/Field.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/JavaTask.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/JavaTask.java 2009-06-03
01:30:14 UTC (rev 15663)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/JavaTask.java 2009-06-03
02:51:37 UTC (rev 15664)
@@ -1,5 +1,8 @@
package org.jboss.tools.flow.jpdl4.model;
+import java.util.ArrayList;
+import java.util.List;
+
import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.IPropertySource;
@@ -9,10 +12,14 @@
public static final String CLASS =
"org.jboss.tools.flow.jpdl4.model.javaTask.class";
public static final String METHOD =
"org.jboss.tools.flow.jpdl4.model.javaTask.method";
public static final String VAR =
"org.jboss.tools.flow.jpdl4.model.javaTask.var";
+ public static final String FIELDS =
"org.jboss.tools.flow.jpdl4.model.javaTask.fields";
+ public static final String ARGS =
"org.jboss.tools.flow.jpdl4.model.javaTask.args";
private String className;
private String methodName;
private String variableName;
+ private List<Argument> arguments = new ArrayList<Argument>();
+ private List<Field> fields = new ArrayList<Field>();
public JavaTask() {
setMetaData("propertySource", new PropertySource());
@@ -41,7 +48,7 @@
public void setVariableName(String variableName) {
this.variableName = variableName;
}
-
+
protected boolean isPropagationExclusive() {
return true;
}
@@ -63,6 +70,10 @@
return getMethodName();
} else if (VAR.equals(id)) {
return getVariableName();
+ } else if (FIELDS.equals(id)) {
+ return fields;
+ } else if (ARGS.equals(id)) {
+ return arguments;
}
return null;
}
@@ -74,6 +85,10 @@
return getMethodName() != null;
} else if (VAR.equals(id)) {
return getVariableName() != null;
+ } else if (FIELDS.equals(id)) {
+ return true;
+ } else if (ARGS.equals(id)) {
+ return true;
}
return false;
}
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/ArgumentValueSection.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/ArgumentValueSection.java
(rev 0)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/ArgumentValueSection.java 2009-06-03
02:51:37 UTC (rev 15664)
@@ -0,0 +1,11 @@
+package org.jboss.tools.flow.jpdl4.properties;
+
+import org.jboss.tools.flow.jpdl4.model.Argument;
+
+public class ArgumentValueSection extends TextFieldPropertySection {
+
+ public ArgumentValueSection() {
+ super(Argument.VALUE, "Value");
+ }
+
+}
Property changes on:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/ArgumentValueSection.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/FieldNameSection.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/FieldNameSection.java
(rev 0)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/FieldNameSection.java 2009-06-03
02:51:37 UTC (rev 15664)
@@ -0,0 +1,11 @@
+package org.jboss.tools.flow.jpdl4.properties;
+
+import org.jboss.tools.flow.jpdl4.model.Field;
+
+public class FieldNameSection extends TextFieldPropertySection {
+
+ public FieldNameSection() {
+ super(Field.NAME, "Name");
+ }
+
+}
Property changes on:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/FieldNameSection.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/FieldValueSection.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/FieldValueSection.java
(rev 0)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/FieldValueSection.java 2009-06-03
02:51:37 UTC (rev 15664)
@@ -0,0 +1,11 @@
+package org.jboss.tools.flow.jpdl4.properties;
+
+import org.jboss.tools.flow.jpdl4.model.Field;
+
+public class FieldValueSection extends TextFieldPropertySection {
+
+ public FieldValueSection() {
+ super(Field.VALUE, "Value");
+ }
+
+}
Property changes on:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/FieldValueSection.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/JavaTaskArgumentsSection.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/JavaTaskArgumentsSection.java 2009-06-03
01:30:14 UTC (rev 15663)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/JavaTaskArgumentsSection.java 2009-06-03
02:51:37 UTC (rev 15664)
@@ -1,87 +0,0 @@
-package org.jboss.tools.flow.jpdl4.properties;
-
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
-import org.jboss.tools.flow.common.properties.IPropertyId;
-
-public class JavaTaskArgumentsSection extends JpdlPropertySection implements IPropertyId
{
-
- private final static String NO_ARGUMENTS = "The configured method has no arguments
that can be configured.";
- private final static String CONFIGURE_ARGUMENTS = "Configure the value of the
supported arguments as needed.";
-
- private CLabel infoLabel;
-
-// private ModifyListener nameTextModifyListener = new ModifyListener() {
-// public void modifyText(ModifyEvent arg0) {
-// IPropertySource input = getInput();
-// if (input != null) {
-// RenameElementCommand rec = new RenameElementCommand();
-// rec.setSource(input);
-// rec.setOldName((String)input.getPropertyValue(NAME));
-// rec.setName(nameText.getText());
-// getCommandStack().execute(rec);
-// }
-// }
-// };
-//
-// private CommandStackListener commandStackListener = new CommandStackListener() {
-// public void commandStackChanged(EventObject event) {
-// refresh();
-// }
-// };
-//
-// public void dispose() {
-// if (getCommandStack() != null) {
-// getCommandStack().removeCommandStackListener(commandStackListener);
-// }
-// super.dispose();
-// }
-
- public void createControls(Composite parent,
- TabbedPropertySheetPage aTabbedPropertySheetPage) {
- super.createControls(parent, aTabbedPropertySheetPage);
- Composite composite = getFlatFormComposite();
- createInfoLabel(composite);
- createFieldsComposite(composite);
- }
-
-
- private void createInfoLabel(Composite parent) {
- infoLabel = getWidgetFactory().createCLabel(parent, NO_ARGUMENTS);
- FormData data = new FormData();
- data.left = new FormAttachment(0, 0);
- data.top = new FormAttachment(0, 5);
- data.right = new FormAttachment(100, 0);
- infoLabel.setLayoutData(data);
- }
-
- private void createFieldsComposite(Composite parent) {
- Composite fieldsComposite = getWidgetFactory().createComposite(parent);
- FormData data = new FormData();
- data.top = new FormAttachment(0, 0);
- data.left = new FormAttachment(JpdlPropertySection.SECOND_COLUMN_LEFT_LIMIT, 0);
- data.right = new FormAttachment(100, 0);
- fieldsComposite.setLayoutData(data);
- }
-
- protected void hookListeners() {
-// nameText.addModifyListener(nameTextModifyListener);
- }
-
- protected void unhookListeners() {
-// nameText.removeModifyListener(nameTextModifyListener);
- }
-
- protected void updateValues() {
-// IPropertySource input = getInput();
-// if (input != null) {
-// nameText.setText(getValueNotNull((String)input.getPropertyValue(NAME)));
-// } else {
-// nameText.setText("");
-// }
- }
-
-}
Deleted:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/JavaTaskFieldsSection.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/JavaTaskFieldsSection.java 2009-06-03
01:30:14 UTC (rev 15663)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/JavaTaskFieldsSection.java 2009-06-03
02:51:37 UTC (rev 15664)
@@ -1,124 +0,0 @@
-package org.jboss.tools.flow.jpdl4.properties;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.gef.EditPart;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
-import org.jboss.tools.flow.common.properties.IPropertyId;
-import org.jboss.tools.flow.common.wrapper.ModelEvent;
-import org.jboss.tools.flow.common.wrapper.ModelListener;
-import org.jboss.tools.flow.common.wrapper.Wrapper;
-import org.jboss.tools.flow.jpdl4.model.JavaTask;
-
-public class JavaTaskFieldsSection extends JpdlPropertySection implements IPropertyId {
-
- private final static String NO_FIELDS = "The configured class has no fields that
can be configured.";
- private final static String CONFIGURE_FIELDS = "Configure the value of the
supported fields as needed.";
-
- private Wrapper input;
-
- private CLabel infoLabel;
-
- private ModelListener modelListener = new ModelListener() {
- public void modelChanged(ModelEvent event) {
- System.out.println("changeDiscriminator; " +
event.getChangeDiscriminator());
- System.out.println("changeType " + event.getChangeType());
- }
-
- };
-
-// private ModifyListener nameTextModifyListener = new ModifyListener() {
-// public void modifyText(ModifyEvent arg0) {
-// IPropertySource input = getInput();
-// if (input != null) {
-// RenameElementCommand rec = new RenameElementCommand();
-// rec.setSource(input);
-// rec.setOldName((String)input.getPropertyValue(NAME));
-// rec.setName(nameText.getText());
-// getCommandStack().execute(rec);
-// }
-// }
-// };
-//
-// private CommandStackListener commandStackListener = new CommandStackListener() {
-// public void commandStackChanged(EventObject event) {
-// refresh();
-// }
-// };
-//
- public void dispose() {
- if (input != null) {
- input.removeListener(modelListener);
- }
- super.dispose();
- }
-
- public void createControls(Composite parent,
- TabbedPropertySheetPage aTabbedPropertySheetPage) {
- super.createControls(parent, aTabbedPropertySheetPage);
- Composite composite = getFlatFormComposite();
- createInfoLabel(composite);
- createFieldsComposite(composite);
- }
-
-
- private void createInfoLabel(Composite parent) {
- infoLabel = getWidgetFactory().createCLabel(parent, NO_FIELDS);
- FormData data = new FormData();
- data.left = new FormAttachment(0, 0);
- data.top = new FormAttachment(0, 5);
- data.right = new FormAttachment(100, 0);
- infoLabel.setLayoutData(data);
- }
-
- private void createFieldsComposite(Composite parent) {
- Composite fieldsComposite = getWidgetFactory().createComposite(parent);
- FormData data = new FormData();
- data.top = new FormAttachment(0, 0);
- data.left = new FormAttachment(JpdlPropertySection.SECOND_COLUMN_LEFT_LIMIT, 0);
- data.right = new FormAttachment(100, 0);
- fieldsComposite.setLayoutData(data);
- }
-
- public void setInput(IWorkbenchPart part, ISelection selection) {
- if (input != null) {
- input.removeListener(modelListener);
- }
- super.setInput(part, selection);
- if (selection instanceof IStructuredSelection) {
- Object object = ((IStructuredSelection)selection).getFirstElement();
- if (object instanceof EditPart && ((EditPart)object).getModel() instanceof
Wrapper) {
- input = (Wrapper)((EditPart)object).getModel();
- input.addListener(modelListener);
- return;
- }
- }
- input = null;
- }
-
- protected void hookListeners() {
-// nameText.addModifyListener(nameTextModifyListener);
- }
-
- protected void unhookListeners() {
-// nameText.removeModifyListener(nameTextModifyListener);
- }
-
- protected void updateValues() {
-// IPropertySource input = getInput();
-// if (input != null) {
-// nameText.setText(getValueNotNull((String)input.getPropertyValue(NAME)));
-// } else {
-// nameText.setText("");
-// }
- }
-
-}
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/JpdlPropertySection.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/JpdlPropertySection.java 2009-06-03
01:30:14 UTC (rev 15663)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/JpdlPropertySection.java 2009-06-03
02:51:37 UTC (rev 15664)
@@ -45,6 +45,9 @@
if (aTabbedPropertySheetPage instanceof JpdlPropertySheetPage) {
commandStack = ((JpdlPropertySheetPage)aTabbedPropertySheetPage).getCommandStack();
}
+ if (commandStack != null) {
+
+ }
flatFormComposite = getWidgetFactory().createFlatFormComposite(parent);
}
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/NameSection.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/NameSection.java 2009-06-03
01:30:14 UTC (rev 15663)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/NameSection.java 2009-06-03
02:51:37 UTC (rev 15664)
@@ -23,7 +23,7 @@
private ModifyListener nameTextModifyListener = new ModifyListener() {
public void modifyText(ModifyEvent arg0) {
IPropertySource input = getInput();
- if (input != null) {
+ if (input != null && getCommandStack() != null) {
RenameElementCommand rec = new RenameElementCommand();
rec.setSource(input);
rec.setOldName((String)input.getPropertyValue(NAME));
@@ -49,6 +49,9 @@
public void createControls(Composite parent,
TabbedPropertySheetPage aTabbedPropertySheetPage) {
super.createControls(parent, aTabbedPropertySheetPage);
+ if (getCommandStack() != null) {
+ getCommandStack().addCommandStackListener(commandStackListener);
+ }
Composite composite = getFlatFormComposite();
createNameLabel(composite);
createNameText(composite);