Author: koen.aers(a)jboss.com
Date: 2009-01-26 16:15:27 -0500 (Mon, 26 Jan 2009)
New Revision: 13282
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/AdvancedPropertySection.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/JpdlPropertySheetPage.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/JpdlEditor.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/Process.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/util/Jpdl4Helper.java
Log:
- updated labels of elements
- created property sheet implementation to support undoable commands in the advanced
property section
- direct editing when nodes are added
- nodes have default names based on their label
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml 2009-01-26 21:13:45 UTC (rev
13281)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml 2009-01-26 21:15:27 UTC (rev
13282)
@@ -45,8 +45,8 @@
class="org.jboss.tools.flow.jpdl4.model.Process"
figure="icons/process.gif"
id="org.jboss.tools.flow.jpdl4.process"
- language="org.jboss.tools.flow.jpdl4"
- name="Process Definition">
+ label="process"
+ language="org.jboss.tools.flow.jpdl4">
<flow
acceptsElementStrategy="org.jboss.tools.flow.jpdl4.strategy.ProcessAcceptsElementStrategy"></flow>
</element>
@@ -60,7 +60,9 @@
</element> -->
<element
class="org.jboss.tools.flow.jpdl4.model.StartEvent"
+ figure="icons/16/start_event_empty.png"
id="org.jboss.tools.flow.jpdl4.startEvent"
+ label="start"
language="org.jboss.tools.flow.jpdl4">
<node
acceptsIncomingConnectionStrategy="org.jboss.tools.flow.jpdl4.strategy.StartEventAcceptsIncomingConnectionStrategy">
@@ -69,7 +71,9 @@
</element>
<element
class="org.jboss.tools.flow.jpdl4.model.TerminateEndEvent"
+ figure="icons/16/end_event_terminate.png"
id="org.jboss.tools.flow.jpdl4.terminateEndEvent"
+ label="end"
language="org.jboss.tools.flow.jpdl4">
<node
acceptsOutgoingConnectionStrategy="org.jboss.tools.flow.jpdl4.strategy.EndEventAcceptsOutgoingConnectionStrategy">
@@ -78,7 +82,9 @@
</element>
<element
class="org.jboss.tools.flow.jpdl4.model.CancelEndEvent"
+ figure="icons/16/end_event_cancel.png"
id="org.jboss.tools.flow.jpdl4.cancelEndEvent"
+ label="cancel"
language="org.jboss.tools.flow.jpdl4">
<node
acceptsOutgoingConnectionStrategy="org.jboss.tools.flow.jpdl4.strategy.EndEventAcceptsOutgoingConnectionStrategy">
@@ -87,7 +93,9 @@
</element>
<element
class="org.jboss.tools.flow.jpdl4.model.ErrorEndEvent"
+ figure="icons/16/end_event_error.png"
id="org.jboss.tools.flow.jpdl4.errorEndEvent"
+ label="error"
language="org.jboss.tools.flow.jpdl4">
<node
acceptsOutgoingConnectionStrategy="org.jboss.tools.flow.jpdl4.strategy.EndEventAcceptsOutgoingConnectionStrategy">
@@ -96,7 +104,9 @@
</element>
<element
class="org.jboss.tools.flow.jpdl4.model.WaitTask"
+ figure="icons/16/task_wait.png"
id="org.jboss.tools.flow.jpdl4.waitTask"
+ label="state"
language="org.jboss.tools.flow.jpdl4">
<node>
<figure
class="org.jboss.tools.flow.jpdl4.figure.TaskFigure"></figure>
@@ -104,7 +114,9 @@
</element>
<element
class="org.jboss.tools.flow.jpdl4.model.HqlTask"
+ figure="icons/16/task_hql.png"
id="org.jboss.tools.flow.jpdl4.hqlTask"
+ label="hql"
language="org.jboss.tools.flow.jpdl4">
<node>
<figure
class="org.jboss.tools.flow.jpdl4.figure.TaskFigure"></figure>
@@ -112,7 +124,9 @@
</element>
<element
class="org.jboss.tools.flow.jpdl4.model.SqlTask"
+ figure="icons/16/task_sql.png"
id="org.jboss.tools.flow.jpdl4.sqlTask"
+ label="sql"
language="org.jboss.tools.flow.jpdl4">
<node>
<figure
class="org.jboss.tools.flow.jpdl4.figure.TaskFigure"></figure>
@@ -120,7 +134,9 @@
</element>
<element
class="org.jboss.tools.flow.jpdl4.model.JavaTask"
+ figure="icons/16/task_java.png"
id="org.jboss.tools.flow.jpdl4.javaTask"
+ label="java"
language="org.jboss.tools.flow.jpdl4">
<node>
<figure
class="org.jboss.tools.flow.jpdl4.figure.TaskFigure"></figure>
@@ -128,7 +144,9 @@
</element>
<element
class="org.jboss.tools.flow.jpdl4.model.ScriptTask"
+ figure="icons/16/task_empty.png"
id="org.jboss.tools.flow.jpdl4.scriptTask"
+ label="script"
language="org.jboss.tools.flow.jpdl4">
<node>
<figure
class="org.jboss.tools.flow.jpdl4.figure.TaskFigure"></figure>
@@ -136,7 +154,9 @@
</element>
<element
class="org.jboss.tools.flow.jpdl4.model.ServiceTask"
+ figure="icons/16/task_empty.png"
id="org.jboss.tools.flow.jpdl4.serviceTask"
+ label="esb"
language="org.jboss.tools.flow.jpdl4">
<node>
<figure
class="org.jboss.tools.flow.jpdl4.figure.TaskFigure"></figure>
@@ -144,7 +164,9 @@
</element>
<element
class="org.jboss.tools.flow.jpdl4.model.HumanTask"
+ figure="icons/16/task_empty.png"
id="org.jboss.tools.flow.jpdl4.humanTask"
+ label="task"
language="org.jboss.tools.flow.jpdl4">
<node>
<figure
class="org.jboss.tools.flow.jpdl4.figure.TaskFigure"></figure>
@@ -152,7 +174,9 @@
</element>
<element
class="org.jboss.tools.flow.jpdl4.model.ExclusiveGateway"
+ figure="icons/16/gateway_exclusive.png"
id="org.jboss.tools.flow.jpdl4.exclusiveGateway"
+ label="exclusive"
language="org.jboss.tools.flow.jpdl4">
<node>
<figure
class="org.jboss.tools.flow.jpdl4.figure.ExclusiveGatewayFigure"></figure>
@@ -160,7 +184,9 @@
</element>
<element
class="org.jboss.tools.flow.jpdl4.model.ForkParallelGateway"
+ figure="icons/16/gateway_parallel.png"
id="org.jboss.tools.flow.jpdl4.parallelForkGateway"
+ label="fork"
language="org.jboss.tools.flow.jpdl4">
<node>
<figure
class="org.jboss.tools.flow.jpdl4.figure.ParallelGatewayFigure"></figure>
@@ -168,7 +194,9 @@
</element>
<element
class="org.jboss.tools.flow.jpdl4.model.JoinParallelGateway"
+ figure="icons/16/gateway_parallel.png"
id="org.jboss.tools.flow.jpdl4.parallelJoinGateway"
+ label="join"
language="org.jboss.tools.flow.jpdl4">
<node>
<figure
class="org.jboss.tools.flow.jpdl4.figure.ParallelGatewayFigure"></figure>
@@ -178,8 +206,8 @@
class="org.jboss.tools.flow.jpdl4.model.SequenceFlow"
figure="icons/sequence.gif"
id="org.jboss.tools.flow.jpdl4.sequenceFlow"
- language="org.jboss.tools.flow.jpdl4"
- name="Flow">
+ label="flow"
+ language="org.jboss.tools.flow.jpdl4">
<connection></connection>
</element>
</extension>
@@ -216,7 +244,7 @@
<extension
point="org.eclipse.ui.views.properties.tabbed.propertySections">
<propertySections
contributorId="org.jboss.tools.flow.jpdl4.editor">
<propertySection
-
class="org.eclipse.ui.views.properties.tabbed.AdvancedPropertySection"
+
class="org.jboss.tools.flow.jpdl4.properties.AdvancedPropertySection"
id="org.jboss.tools.jpdl4.advanced"
tab="org.jboss.tools.jpdl4.advanced">
<input type="java.lang.Object"/>
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlEditor.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlEditor.java 2009-01-26
21:13:45 UTC (rev 13281)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlEditor.java 2009-01-26
21:15:27 UTC (rev 13282)
@@ -5,19 +5,20 @@
import java.io.OutputStream;
import org.eclipse.gef.EditPartFactory;
+import org.eclipse.gef.commands.CommandStack;
import org.eclipse.gef.palette.PaletteRoot;
import org.eclipse.ui.views.properties.IPropertySheetPage;
import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
import org.jboss.tools.flow.common.editor.GenericModelEditor;
import org.jboss.tools.flow.common.editpart.DefaultEditPartFactory;
import org.jboss.tools.flow.common.registry.ElementRegistry;
import org.jboss.tools.flow.common.wrapper.Wrapper;
+import org.jboss.tools.flow.jpdl4.properties.JpdlPropertySheetPage;
public class JpdlEditor extends GenericModelEditor implements
ITabbedPropertySheetPageContributor {
public static String ID = "org.jboss.tools.flow.jpdl4.editor";
-
+
protected EditPartFactory createEditPartFactory() {
return new DefaultEditPartFactory();
}
@@ -50,11 +51,15 @@
public String getContributorId() {
return getSite().getId();
}
-
+
+ public CommandStack getCommandStack() {
+ return super.getCommandStack();
+ }
+
@SuppressWarnings("unchecked")
public Object getAdapter(Class adapter) {
- if (adapter == IPropertySheetPage.class)
- return new TabbedPropertySheetPage(this);
+ if (adapter == IPropertySheetPage.class)
+ return new JpdlPropertySheetPage(this, getCommandStack());
return super.getAdapter(adapter);
}
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-01-26
21:13:45 UTC (rev 13281)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlSerializer.java 2009-01-26
21:15:27 UTC (rev 13282)
@@ -292,263 +292,44 @@
private void appendOpening(StringBuffer buffer, Wrapper wrapper, int level) {
Element element = (Element)wrapper.getElement();
-// ArrayList<Node> leadingNodeList =
(ArrayList<Node>)element.getMetaData("leadingNodes");
-// boolean appendLeadingNodes = leadingNodeList != null &&
!leadingNodeList.isEmpty();
-// if (appendLeadingNodes) {
-// appendNodeList(buffer, leadingNodeList);
-// } else {
-// buffer.append("\n");
-// appendPadding(buffer, level);
-// }
if (element instanceof SequenceFlow) {
new SequenceFlowWrapperSerializer().appendOpening(buffer, wrapper, level);
-// SequenceFlow transition = (SequenceFlow)element;
-// if (!appendLeadingNodes) {
-// buffer.append("\n");
-// appendPadding(buffer, level);
-// }
-// buffer.append("<flow");
-// if (transition.getTo() != null) {
-// buffer.append(" ");
-// String value = transition.getTo().getName();
-// value = value == null ? "" : value;
-// buffer.append("to=\"" + value + "\"");
-// }
-// appendConnectionGraphics(buffer, (ConnectionWrapper)wrapper);
} else if (element instanceof TerminateEndEvent) {
new ProcessNodeWrapperSerializer().appendOpening(buffer, wrapper, level);
-// TerminateEndEvent terminateEndEvent = (TerminateEndEvent)element;
-// if (!appendLeadingNodes) {
-// buffer.append("\n");
-// appendPadding(buffer, level);
-// }
-// buffer.append("<end");
-// if (!isEmpty(terminateEndEvent.getName())) {
-// buffer.append(" ");
-// String value = terminateEndEvent.getName();
-// buffer.append("name=\"" + value + "\"");
-// }
-// appendNodeGraphics(buffer, (NodeWrapper)wrapper);
} else if (element instanceof ErrorEndEvent) {
new ProcessNodeWrapperSerializer().appendOpening(buffer, wrapper, level);
-// ErrorEndEvent errorEndEvent = (ErrorEndEvent)element;
-// if (!appendLeadingNodes) {
-// buffer.append("\n");
-// appendPadding(buffer, level);
-// }
-// buffer.append("<end-error");
-// if (!isEmpty(errorEndEvent.getName())) {
-// buffer.append(" ");
-// String value = errorEndEvent.getName();
-// buffer.append("name=\"" + value + "\"");
-// }
-// appendNodeGraphics(buffer, (NodeWrapper)wrapper);
} else if (element instanceof CancelEndEvent) {
new ProcessNodeWrapperSerializer().appendOpening(buffer, wrapper, level);
-// CancelEndEvent cancelEndEvent = (CancelEndEvent)element;
-// if (!appendLeadingNodes) {
-// buffer.append("\n");
-// appendPadding(buffer, level);
-// }
-// buffer.append("<end-cancel");
-// if (!isEmpty(cancelEndEvent.getName())) {
-// buffer.append(" ");
-// String value = cancelEndEvent.getName();
-// buffer.append("name=\"" + value + "\"");
-// }
-// appendNodeGraphics(buffer, (NodeWrapper)wrapper);
} else if (element instanceof StartEvent) {
new ProcessNodeWrapperSerializer().appendOpening(buffer, wrapper, level);
-// StartEvent startEvent = (StartEvent)element;
-// if (!appendLeadingNodes) {
-// buffer.append("\n");
-// appendPadding(buffer, level);
-// }
-// buffer.append("<start");
-// if (!isEmpty(startEvent.getName())) {
-// buffer.append(" ");
-// String value = startEvent.getName();
-// buffer.append("name=\"" + value + "\"");
-// }
-// appendNodeGraphics(buffer, (NodeWrapper)wrapper);
} else if (element instanceof SuperState) {
new ProcessNodeWrapperSerializer().appendOpening(buffer, wrapper, level);
-// SuperState superState = (SuperState)element;
-// if (!appendLeadingNodes) {
-// buffer.append("\n");
-// appendPadding(buffer, level);
-// }
-// buffer.append("<super-state");
-// if (!isEmpty(superState.getName())) {
-// buffer.append(" ");
-// String value = superState.getName();
-// buffer.append("name=\"" + value + "\"");
-// }
} else if (element instanceof WaitTask) {
new ProcessNodeWrapperSerializer().appendOpening(buffer, wrapper, level);
-// WaitTask waitTask = (WaitTask)element;
-// if (!appendLeadingNodes) {
-// buffer.append("\n");
-// appendPadding(buffer, level);
-// }
-// buffer.append("<state");
-// if (!isEmpty(waitTask.getName())) {
-// buffer.append(" ");
-// String value = waitTask.getName();
-// buffer.append("name=\"" + value + "\"");
-// }
-// appendNodeGraphics(buffer, (NodeWrapper)wrapper);
} else if (element instanceof HqlTask) {
new ProcessNodeWrapperSerializer().appendOpening(buffer, wrapper, level);
-// HqlTask hqlTask = (HqlTask)element;
-// if (!appendLeadingNodes) {
-// buffer.append("\n");
-// appendPadding(buffer, level);
-// }
-// buffer.append("<hql");
-// if (!isEmpty(hqlTask.getName())) {
-// buffer.append(" ");
-// String value = hqlTask.getName();
-// buffer.append("name=\"" + value + "\"");
-// }
-// appendNodeGraphics(buffer, (NodeWrapper)wrapper);
} else if (element instanceof SqlTask) {
new ProcessNodeWrapperSerializer().appendOpening(buffer, wrapper, level);
-// SqlTask sqlTask = (SqlTask)element;
-// if (!appendLeadingNodes) {
-// buffer.append("\n");
-// appendPadding(buffer, level);
-// }
-// buffer.append("<sql");
-// if (!isEmpty(sqlTask.getName())) {
-// buffer.append(" ");
-// String value = sqlTask.getName();
-// buffer.append("name=\"" + value + "\"");
-// }
-// appendNodeGraphics(buffer, (NodeWrapper)wrapper);
} else if (element instanceof JavaTask) {
new ProcessNodeWrapperSerializer().appendOpening(buffer, wrapper, level);
-// JavaTask javaTask = (JavaTask)element;
-// if (!appendLeadingNodes) {
-// buffer.append("\n");
-// appendPadding(buffer, level);
-// }
-// buffer.append("<java");
-// if (!isEmpty(javaTask.getName())) {
-// buffer.append(" ");
-// String value = javaTask.getName();
-// buffer.append("name=\"" + value + "\"");
-// }
-// appendNodeGraphics(buffer, (NodeWrapper)wrapper);
} else if (element instanceof ScriptTask) {
new ProcessNodeWrapperSerializer().appendOpening(buffer, wrapper, level);
-// ScriptTask scriptTask = (ScriptTask)element;
-// if (!appendLeadingNodes) {
-// buffer.append("\n");
-// appendPadding(buffer, level);
-// }
-// buffer.append("<script");
-// if (!isEmpty(scriptTask.getName())) {
-// buffer.append(" ");
-// String value = scriptTask.getName();
-// buffer.append("name=\"" + value + "\"");
-// }
-// appendNodeGraphics(buffer, (NodeWrapper)wrapper);
} else if (element instanceof ServiceTask) {
new ProcessNodeWrapperSerializer().appendOpening(buffer, wrapper, level);
-// ServiceTask serviceTask = (ServiceTask)element;
-// if (!appendLeadingNodes) {
-// buffer.append("\n");
-// appendPadding(buffer, level);
-// }
-// buffer.append("<esb");
-// if (!isEmpty(serviceTask.getName())) {
-// buffer.append(" ");
-// String value = serviceTask.getName();
-// buffer.append("name=\"" + value + "\"");
-// }
-// appendNodeGraphics(buffer, (NodeWrapper)wrapper);
} else if (element instanceof HumanTask) {
new ProcessNodeWrapperSerializer().appendOpening(buffer, wrapper, level);
-// HumanTask humanTask = (HumanTask)element;
-// if (!appendLeadingNodes) {
-// buffer.append("\n");
-// appendPadding(buffer, level);
-// }
-// buffer.append("<task");
-// if (!isEmpty(humanTask.getName())) {
-// buffer.append(" ");
-// String value = humanTask.getName();
-// buffer.append("name=\"" + value + "\"");
-// }
-// appendNodeGraphics(buffer, (NodeWrapper)wrapper);
} else if (element instanceof ExclusiveGateway) {
new ProcessNodeWrapperSerializer().appendOpening(buffer, wrapper, level);
-// ExclusiveGateway exclusiveGateway = (ExclusiveGateway)element;
-// if (!appendLeadingNodes) {
-// buffer.append("\n");
-// appendPadding(buffer, level);
-// }
-// buffer.append("<exclusive");
-// if (!isEmpty(exclusiveGateway.getName())) {
-// buffer.append(" ");
-// String value = exclusiveGateway.getName();
-// buffer.append("name=\"" + value + "\"");
-// }
-// appendNodeGraphics(buffer, (NodeWrapper)wrapper);
} else if (element instanceof ForkParallelGateway) {
new ProcessNodeWrapperSerializer().appendOpening(buffer, wrapper, level);
-// ForkParallelGateway parallelForkGateway = (ForkParallelGateway)element;
-// if (!appendLeadingNodes) {
-// buffer.append("\n");
-// appendPadding(buffer, level);
-// }
-// buffer.append("<fork");
-// if (!isEmpty(parallelForkGateway.getName())) {
-// buffer.append(" ");
-// String value = parallelForkGateway.getName();
-// buffer.append("name=\"" + value + "\"");
-// }
-// appendNodeGraphics(buffer, (NodeWrapper)wrapper);
} else if (element instanceof JoinParallelGateway) {
new ProcessNodeWrapperSerializer().appendOpening(buffer, wrapper, level);
-// JoinParallelGateway parallelJoinGateway = (JoinParallelGateway)element;
-// if (!appendLeadingNodes) {
-// buffer.append("\n");
-// appendPadding(buffer, level);
-// }
-// buffer.append("<join");
-// if (!isEmpty(parallelJoinGateway.getName())) {
-// buffer.append(" ");
-// String value = parallelJoinGateway.getName();
-// buffer.append("name=\"" + value + "\"");
-// }
-// appendNodeGraphics(buffer, (NodeWrapper)wrapper);
} else if (element instanceof Process) {
new ProcessWrapperSerializer().appendOpening(buffer, wrapper, level);
-// Process process = (Process)element;
-// buffer.append("<?xml version=\"1.0\"
encoding=\"UTF-8\"?>\n\n");
-// buffer.append("<process");
-// buffer.append("
xmlns=\"http://jbpm.org/4/jpdl\"");
-// if (process.getInitial() != null) {
-// buffer.append(" ");
-// String value = process.getInitial().getName();
-// value = value == null ? "" : value;
-// buffer.append("initial=\"" + value + "\"");
-// }
-// if (!isEmpty(process.getName())) {
-// buffer.append(" ");
-// String value = process.getName();
-// buffer.append("name=\"" + value + "\"");
-// }
}
}
-// private boolean isEmpty(String str) {
-// return str == null || "".equals(str);
-// }
-
private void appendPadding(StringBuffer buffer, int level) {
for (int i = 0; i < level; i++) {
buffer.append(" ");
@@ -557,112 +338,39 @@
private void appendClosing(StringBuffer buffer, Wrapper wrapper, int level) {
Element element = (Element)wrapper.getElement();
-// ArrayList<Node> trailingNodeList =
(ArrayList<Node>)element.getMetaData("trailingNodes");
-// boolean appendTrailingNodes = trailingNodeList != null &&
!trailingNodeList.isEmpty();
-// if (appendTrailingNodes) {
-// appendNodeList(buffer, trailingNodeList);
-// }
if (element instanceof SequenceFlow) {
-// if (!appendTrailingNodes) {
-// buffer.append("\n");
-// appendPadding(buffer, level);
-// }
buffer.append("</flow>");
} else if (element instanceof TerminateEndEvent) {
-// if (!appendTrailingNodes) {
-// buffer.append("\n");
-// appendPadding(buffer, level);
-// }
buffer.append("</end>");
} else if (element instanceof ErrorEndEvent) {
-// if (!appendTrailingNodes) {
-// buffer.append("\n");
-// appendPadding(buffer, level);
-// }
buffer.append("</end-error>");
} else if (element instanceof CancelEndEvent) {
-// if (!appendTrailingNodes) {
-// buffer.append("\n");
-// appendPadding(buffer, level);
-// }
buffer.append("</end-cancel>");
} else if (element instanceof StartEvent) {
-// if (!appendTrailingNodes) {
-// buffer.append("\n");
-// appendPadding(buffer, level);
-// }
buffer.append("</start>");
} else if (element instanceof SuperState) {
-// if (!appendTrailingNodes) {
-// buffer.append("\n");
-// appendPadding(buffer, level);
-// }
buffer.append("</super-state>");
} else if (element instanceof WaitTask) {
-// if (!appendTrailingNodes) {
-// buffer.append("\n");
-// appendPadding(buffer, level);
-// }
buffer.append("</state>");
} else if (element instanceof HqlTask) {
-// if (!appendTrailingNodes) {
-// buffer.append("\n");
-// appendPadding(buffer, level);
-// }
buffer.append("</hql>");
} else if (element instanceof SqlTask) {
-// if (!appendTrailingNodes) {
-// buffer.append("\n");
-// appendPadding(buffer, level);
-// }
buffer.append("</sql>");
} else if (element instanceof JavaTask) {
-// if (!appendTrailingNodes) {
-// buffer.append("\n");
-// appendPadding(buffer, level);
-// }
buffer.append("</java>");
} else if (element instanceof ScriptTask) {
-// if (!appendTrailingNodes) {
-// buffer.append("\n");
-// appendPadding(buffer, level);
-// }
buffer.append("</script>");
} else if (element instanceof ServiceTask) {
-// if (!appendTrailingNodes) {
-// buffer.append("\n");
-// appendPadding(buffer, level);
-// }
buffer.append("</esb>");
} else if (element instanceof HumanTask) {
-// if (!appendTrailingNodes) {
-// buffer.append("\n");
-// appendPadding(buffer, level);
-// }
buffer.append("</task>");
} else if (element instanceof ExclusiveGateway) {
-// if (!appendTrailingNodes) {
-// buffer.append("\n");
-// appendPadding(buffer, level);
-// }
buffer.append("</exclusive>");
} else if (element instanceof ForkParallelGateway) {
-// if (!appendTrailingNodes) {
-// buffer.append("\n");
-// appendPadding(buffer, level);
-// }
buffer.append("</fork>");
} else if (element instanceof JoinParallelGateway) {
-// if (!appendTrailingNodes) {
-// buffer.append("\n");
-// appendPadding(buffer, level);
-// }
buffer.append("</join>");
} else if (element instanceof Process) {
-// if (!appendTrailingNodes) {
-// buffer.append("\n");
-// appendPadding(buffer, level);
-// }
buffer.append("</process>");
}
}
@@ -694,30 +402,4 @@
}
}
-// private void appendNodeGraphics(StringBuffer buffer, NodeWrapper wrapper) {
-// Rectangle constraint = wrapper.getConstraint();
-// buffer.append(" g=\"");
-// buffer.append(constraint.x);
-// buffer.append(",");
-// buffer.append(constraint.y);
-// buffer.append(",");
-// buffer.append(constraint.width);
-// buffer.append(",");
-// buffer.append(constraint.height);
-// buffer.append("\"");
-// }
-//
-// private void appendConnectionGraphics(StringBuffer buffer, ConnectionWrapper
wrapper) {
-// List<Point> bendPoints = wrapper.getBendpoints();
-// if (bendPoints.size() == 0) return;
-// buffer.append(" g=\"");
-// for (int i = 0; i < bendPoints.size(); i++) {
-// buffer.append(bendPoints.get(i).x);
-// buffer.append(",");
-// buffer.append(bendPoints.get(i).y);
-// if (i < bendPoints.size() - 1) buffer.append(";");
-// }
-// buffer.append("\"");
-// }
-//
}
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/Process.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/Process.java 2009-01-26
21:13:45 UTC (rev 13281)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/Process.java 2009-01-26
21:15:27 UTC (rev 13282)
@@ -28,9 +28,20 @@
initial = node;
}
+ public void addNode(Node node) {
+ if (node.getName() == null || "".equals(node.getName())) {
+ node.setName(getInitialName(node));
+ }
+ super.addNode(node);
+ }
+
public void removeNode(Node node) {
Jpdl4Helper.mergeLeadingNodes(node);
super.removeNode(node);
}
+
+ private String getInitialName(Node node) {
+ return Jpdl4Helper.getLabel(node, this);
+ }
}
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/AdvancedPropertySection.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/AdvancedPropertySection.java
(rev 0)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/AdvancedPropertySection.java 2009-01-26
21:15:27 UTC (rev 13282)
@@ -0,0 +1,20 @@
+package org.jboss.tools.flow.jpdl4.properties;
+
+import org.eclipse.gef.commands.CommandStack;
+import org.eclipse.gef.ui.properties.UndoablePropertySheetEntry;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+
+public class AdvancedPropertySection
+ extends org.eclipse.ui.views.properties.tabbed.AdvancedPropertySection {
+
+ public void createControls(Composite parent,
+ final TabbedPropertySheetPage atabbedPropertySheetPage) {
+ super.createControls(parent, atabbedPropertySheetPage);
+ if (atabbedPropertySheetPage instanceof JpdlPropertySheetPage) {
+ CommandStack commandStack =
((JpdlPropertySheetPage)atabbedPropertySheetPage).getCommandStack();
+ page.setRootEntry(new UndoablePropertySheetEntry(commandStack));
+ }
+ }
+
+}
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/JpdlPropertySheetPage.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/JpdlPropertySheetPage.java
(rev 0)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/JpdlPropertySheetPage.java 2009-01-26
21:15:27 UTC (rev 13282)
@@ -0,0 +1,24 @@
+package org.jboss.tools.flow.jpdl4.properties;
+
+import org.eclipse.gef.commands.CommandStack;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+
+public class JpdlPropertySheetPage extends TabbedPropertySheetPage {
+
+ private CommandStack commandStack;
+
+ public JpdlPropertySheetPage(
+ ITabbedPropertySheetPageContributor tabbedPropertySheetPageContributor,
+ CommandStack commandStack) {
+ super(tabbedPropertySheetPageContributor);
+ this.commandStack = commandStack;
+ }
+
+ protected CommandStack getCommandStack() {
+ return commandStack;
+ }
+
+
+
+}
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/util/Jpdl4Helper.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/util/Jpdl4Helper.java 2009-01-26
21:13:45 UTC (rev 13281)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/util/Jpdl4Helper.java 2009-01-26
21:15:27 UTC (rev 13282)
@@ -3,9 +3,11 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.core.runtime.IConfigurationElement;
import org.jboss.tools.flow.common.model.Connection;
import org.jboss.tools.flow.common.model.Container;
import org.jboss.tools.flow.common.model.Element;
+import org.jboss.tools.flow.common.model.Flow;
import org.jboss.tools.flow.common.model.Node;
import org.jboss.tools.flow.jpdl4.model.SequenceFlow;
@@ -90,4 +92,38 @@
return null;
}
+ public static String getLabel(Node child, Flow container) {
+ String result = "node";
+ IConfigurationElement configurationElement =
(IConfigurationElement)child.getMetaData("configurationElement");
+ if (configurationElement != null) {
+ String label = configurationElement.getAttribute("label");
+ if (label != null) {
+ result = label;
+ }
+ }
+ int runner = 1;
+ while (true) {
+ if (getNodeByName(result + runner, container) == null) break;
+ runner++;
+ }
+ return result + runner;
+ }
+
+ private static Node getNodeByName(String name, Container container) {
+ Node result = null;
+ List<Node> nodes = container.getNodes();
+ for (Node node : nodes) {
+ if (name.equals(node.getName())) {
+ result = node;
+ }
+ if (node instanceof Container) {
+ result = getNodeByName(name, (Container)node);
+ }
+ if (result != null) {
+ break;
+ }
+ }
+ return result;
+ }
+
}