JBoss Tools SVN: r9671 - trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/helpers.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-08-12 12:47:13 -0400 (Tue, 12 Aug 2008)
New Revision: 9671
Modified:
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/helpers/SeamPagesDiagramHelper.java
Log:
JBIDE-2612
Modified: trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/helpers/SeamPagesDiagramHelper.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/helpers/SeamPagesDiagramHelper.java 2008-08-12 16:11:18 UTC (rev 9670)
+++ trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/helpers/SeamPagesDiagramHelper.java 2008-08-12 16:47:13 UTC (rev 9671)
@@ -175,7 +175,7 @@
String[] paths = (String[])targets.keySet().toArray(new String[0]);
for (int i = 0; i < paths.length; i++) {
String fvi = toFromViewId(paths[i]);
- fvi = findBestMatch(fvi);
+// fvi = findBestMatch(fvi);
XModelObject g = findOrCreateItem(fvi, toNavigationRulePathPart(fvi), TYPE_PAGE);
targets.put(paths[i], g);
}
@@ -205,7 +205,10 @@
}
private void updatePageItem(ReferenceObjectImpl item) {
- if(item.getReference() == null) return;
+ if(item.getReference() == null) {
+ //TODO update virtual link to findBestMatch(path) element
+ return;
+ }
// if(item.isUpToDate()) return;
item.notifyUpdate();
XModelObject sourcePage = item.getReference();
@@ -353,7 +356,9 @@
output.setAttributeValue(ATTR_PATH, path);
// String title = SeamPagesDiagramStructureHelper.createItemOutputPresentation(rulecase);
// output.setAttributeValue("title", title);
- XModelObject g = getPage(findBestMatch(path));
+
+// String fvi = findBestMatch(path);
+ XModelObject g = getPage(path);
String target = (g == null) ? "" : g.getPathPart();
output.setAttributeValue(ATTR_TARGET, target);
}
17 years, 4 months
JBoss Tools SVN: r9670 - in trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4: src/org/jboss/tools/flow/jpdl4/editor and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2008-08-12 12:11:18 -0400 (Tue, 12 Aug 2008)
New Revision: 9670
Removed:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/TransitionEditPart.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
Log:
icons, colors and figures are pluggable (initial implementation)
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml 2008-08-12 16:10:55 UTC (rev 9669)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml 2008-08-12 16:11:18 UTC (rev 9670)
@@ -24,6 +24,7 @@
point="org.jboss.tools.flow.common.elements">
<element
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">
@@ -32,6 +33,7 @@
</element>
<element
class="org.jboss.tools.flow.common.model.DefaultContainer"
+ figure="icons/super.gif"
id="org.jboss.tools.flow.jpdl4.superState"
language="org.jboss.tools.flow.jpdl4"
name="Super State">
@@ -39,31 +41,46 @@
</element>
<element
class="org.jboss.tools.flow.jpdl4.model.StartState"
+ figure="icons/start.gif"
id="org.jboss.tools.flow.jpdl4.startState"
language="org.jboss.tools.flow.jpdl4"
name="Start">
<node
acceptsIncomingConnectionStrategy="org.jboss.tools.flow.jpdl4.strategy.StartStateAcceptsIncomingConnectionStrategy">
+ <figure>
+ <rectangle></rectangle>
+ </figure>
</node>
</element>
<element
class="org.jboss.tools.flow.jpdl4.model.EndState"
+ figure="icons/end.gif"
id="org.jboss.tools.flow.jpdl4.endState"
language="org.jboss.tools.flow.jpdl4"
name="End">
<node
acceptsOutgoingConnectionStrategy="org.jboss.tools.flow.jpdl4.strategy.EndStateAcceptsOutgoingConnectionStrategy">
+ <figure>
+ <rectangle>
+
+ </rectangle>
+ </figure>
</node>
</element>
<element
class="org.jboss.tools.flow.jpdl4.model.State"
+ figure="icons/state.gif"
id="org.jboss.tools.flow.jpdl4.state"
language="org.jboss.tools.flow.jpdl4"
name="State">
- <node></node>
+ <node>
+ <figure>
+ <rounded-rectangle></rounded-rectangle>
+ </figure></node>
</element>
<element
class="org.jboss.tools.flow.jpdl4.model.Transition"
+ figure="icons/transition.gif"
id="org.jboss.tools.flow.jpdl4.transition"
language="org.jboss.tools.flow.jpdl4"
name="Transition">
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 2008-08-12 16:10:55 UTC (rev 9669)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlEditor.java 2008-08-12 16:11:18 UTC (rev 9670)
@@ -7,13 +7,14 @@
import org.eclipse.gef.EditPartFactory;
import org.eclipse.gef.palette.PaletteRoot;
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.jpdl4.editpart.JpdlEditPartFactory;
public class JpdlEditor extends GenericModelEditor {
protected EditPartFactory createEditPartFactory() {
- return new JpdlEditPartFactory();
+// return new JpdlEditPartFactory();
+ return new DefaultEditPartFactory();
}
protected PaletteRoot createPalette() {
Deleted: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/TransitionEditPart.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/TransitionEditPart.java 2008-08-12 16:10:55 UTC (rev 9669)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/TransitionEditPart.java 2008-08-12 16:11:18 UTC (rev 9670)
@@ -1,12 +0,0 @@
-package org.jboss.tools.flow.jpdl4.editpart;
-
-import org.jboss.tools.flow.common.editpart.ConnectionEditPart;
-import org.jboss.tools.flow.common.wrapper.DefaultConnectionWrapper;
-
-public class TransitionEditPart extends ConnectionEditPart {
-
- protected Class<?> getElementConnectionType() {
- return DefaultConnectionWrapper.class;
- }
-
-}
17 years, 4 months
JBoss Tools SVN: r9669 - in trunk/flow/plugins/org.jboss.tools.flow.common: src/org/jboss/tools/flow/common/editpart and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2008-08-12 12:10:55 -0400 (Tue, 12 Aug 2008)
New Revision: 9669
Added:
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editpart/DefaultEditPartFactory.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Element.java
Modified:
trunk/flow/plugins/org.jboss.tools.flow.common/schema/elements.exsd
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/figure/ElementContainerFigure.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/figure/ElementFigure.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Connection.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Container.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Flow.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Node.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/registry/ElementRegistry.java
Log:
icons, colors and figures are pluggable (initial implementation)
Modified: trunk/flow/plugins/org.jboss.tools.flow.common/schema/elements.exsd
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/schema/elements.exsd 2008-08-12 14:23:36 UTC (rev 9668)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/schema/elements.exsd 2008-08-12 16:10:55 UTC (rev 9669)
@@ -86,6 +86,16 @@
</documentation>
</annotation>
</attribute>
+ <attribute name="figure" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="resource"/>
+ </appinfo>
+ </annotation>
+ </attribute>
</complexType>
</element>
@@ -106,6 +116,9 @@
<element name="node">
<complexType>
+ <sequence>
+ <element ref="figure" minOccurs="0" maxOccurs="1"/>
+ </sequence>
<attribute name="acceptsIncomingConnectionStrategy" type="string">
<annotation>
<documentation>
@@ -167,6 +180,52 @@
<element name="connection" type="string">
</element>
+ <element name="figure">
+ <complexType>
+ <choice minOccurs="0" maxOccurs="1">
+ <element ref="ellipse"/>
+ <element ref="rectangle"/>
+ <element ref="rounded-rectangle"/>
+ </choice>
+ <attribute name="class" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.jboss.tools.flow.common.figure.ElementFigure"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="color" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="icon" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="resource"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="ellipse" type="string">
+ </element>
+
+ <element name="rectangle" type="string">
+ </element>
+
+ <element name="rounded-rectangle" type="string">
+ </element>
+
<annotation>
<appinfo>
<meta.section type="since"/>
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editpart/DefaultEditPartFactory.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editpart/DefaultEditPartFactory.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editpart/DefaultEditPartFactory.java 2008-08-12 16:10:55 UTC (rev 9669)
@@ -0,0 +1,55 @@
+package org.jboss.tools.flow.common.editpart;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartFactory;
+import org.jboss.tools.flow.common.model.Element;
+import org.jboss.tools.flow.common.registry.ElementRegistry;
+import org.jboss.tools.flow.common.wrapper.Wrapper;
+
+public class DefaultEditPartFactory implements EditPartFactory {
+
+ public EditPart createEditPart(EditPart context, Object model) {
+ EditPart result = null;
+ if (!(model instanceof Wrapper)) return result;
+ Object element = ((Wrapper)model).getElement();
+ if (element != null && element instanceof Element) {
+ result = ElementRegistry.createEditPart((Element)element);
+ }
+// result = createEditPart()
+// if (model instanceof DefaultFlowWrapper) {
+// result = new RootEditPart();
+// } else if (model instanceof DefaultContainerWrapper) {
+// result = new ContainerEditPart();
+// } else if (model instanceof DefaultConnectionWrapper) {
+// result = new ConnectionEditPart();
+// } else if (model instanceof DefaultNodeWrapper && element instanceof StartState) {
+// result = new StartStateEditPart();
+// } else if (model instanceof DefaultNodeWrapper && element instanceof State) {
+// result = new StateEditPart();
+// } else if (model instanceof DefaultNodeWrapper && element instanceof EndState) {
+// result = new EndStateEditPart();
+// } else {
+// throw new IllegalArgumentException(
+// "Unknown model object " + model);
+// }
+ if (result != null) {
+ result.setModel(model);
+ }
+ return result;
+ }
+
+// private EditPart createEditPart(Object element) {
+// if (element instanceof Flow) {
+// return new RootEditPart();
+// } else if (element instanceof Container) {
+// return new ContainerEditPart();
+// } else if (element instanceof Connection) {
+// return new ConnectionEditPart();
+// } else if (element instanceof Node) {
+// return ElementRegistry.createEditPart((Node)element);
+// } else {
+// return null;
+// }
+// }
+
+}
Modified: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/figure/ElementContainerFigure.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/figure/ElementContainerFigure.java 2008-08-12 14:23:36 UTC (rev 9668)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/figure/ElementContainerFigure.java 2008-08-12 16:10:55 UTC (rev 9669)
@@ -27,6 +27,7 @@
import org.eclipse.draw2d.LineBorder;
import org.eclipse.draw2d.ScrollPane;
import org.eclipse.draw2d.StackLayout;
+import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
public class ElementContainerFigure extends Figure implements ElementFigure {
@@ -45,6 +46,10 @@
scrollpane.setContents(pane);
setBorder(new LineBorder(1));
}
+
+ public void setColor(Color color) {
+ setBackgroundColor(color);
+ }
public Label getLabel() {
return null;
Modified: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/figure/ElementFigure.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/figure/ElementFigure.java 2008-08-12 14:23:36 UTC (rev 9668)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/figure/ElementFigure.java 2008-08-12 16:10:55 UTC (rev 9669)
@@ -19,6 +19,7 @@
import org.eclipse.draw2d.ConnectionAnchor;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Label;
+import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
/**
@@ -30,6 +31,8 @@
void setIcon(Image icon);
+ void setColor(Color color);
+
void setText(String text);
void setSelected(boolean b);
Modified: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Connection.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Connection.java 2008-08-12 14:23:36 UTC (rev 9668)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Connection.java 2008-08-12 16:10:55 UTC (rev 9669)
@@ -21,7 +21,7 @@
*
* @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
*/
-public interface Connection {
+public interface Connection extends Element {
/**
* Returns the from node of the connection.
@@ -49,8 +49,4 @@
*/
String getToType();
- void setMetaData(String name, Object value);
-
- Object getMetaData(String name);
-
}
Modified: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Container.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Container.java 2008-08-12 14:23:36 UTC (rev 9668)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Container.java 2008-08-12 16:10:55 UTC (rev 9669)
@@ -7,7 +7,7 @@
*
* @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
*/
-public interface Container {
+public interface Container extends Element {
/**
* Returns the nodes of this node container.
Added: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Element.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Element.java (rev 0)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Element.java 2008-08-12 16:10:55 UTC (rev 9669)
@@ -0,0 +1,9 @@
+package org.jboss.tools.flow.common.model;
+
+public interface Element {
+
+ void setMetaData(String name, Object value);
+
+ Object getMetaData(String name);
+
+}
Modified: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Flow.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Flow.java 2008-08-12 14:23:36 UTC (rev 9668)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Flow.java 2008-08-12 16:10:55 UTC (rev 9669)
@@ -92,8 +92,4 @@
*/
String getPackageName();
- void setMetaData(String name, Object value);
-
- Object getMetaData(String name);
-
}
Modified: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Node.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Node.java 2008-08-12 14:23:36 UTC (rev 9668)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Node.java 2008-08-12 16:10:55 UTC (rev 9669)
@@ -24,7 +24,7 @@
*
* @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
*/
-public interface Node {
+public interface Node extends Element {
/**
* Returns the id of the node
Modified: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/registry/ElementRegistry.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/registry/ElementRegistry.java 2008-08-12 14:23:36 UTC (rev 9668)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/registry/ElementRegistry.java 2008-08-12 16:10:55 UTC (rev 9669)
@@ -1,13 +1,31 @@
package org.jboss.tools.flow.common.registry;
+import java.net.URL;
import java.util.HashMap;
+import java.util.StringTokenizer;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.gef.EditPart;
import org.eclipse.gef.requests.CreationFactory;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
import org.jboss.tools.flow.common.Logger;
+import org.jboss.tools.flow.common.editpart.ConnectionEditPart;
+import org.jboss.tools.flow.common.editpart.ContainerEditPart;
+import org.jboss.tools.flow.common.editpart.ElementEditPart;
+import org.jboss.tools.flow.common.editpart.RootEditPart;
+import org.jboss.tools.flow.common.figure.ElementFigure;
+import org.jboss.tools.flow.common.figure.EllipseElementFigure;
+import org.jboss.tools.flow.common.figure.RectangleElementFigure;
+import org.jboss.tools.flow.common.figure.RoundedRectangleElementFigure;
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.common.strategy.AcceptsElementStrategy;
@@ -21,9 +39,12 @@
public class ElementRegistry {
+ private static final HashMap<String, Image> imageMap = new HashMap<String, Image>();
+ private static final HashMap<String, Color> colorMap = new HashMap<String, Color>();
private static final String elementsExtensionPointId = "org.jboss.tools.flow.common.elements";
private static HashMap<String, IConfigurationElement> elementMap = null;
+
private static void initializeRegistry() {
elementMap = new HashMap<String, IConfigurationElement>();
IConfigurationElement[] configurationElements =
@@ -64,6 +85,7 @@
Logger.logError(message, new RuntimeException(message));
return null;
}
+ ((Node)element).setMetaData("configurationElement", configurationElement);
DefaultNodeWrapper result = new DefaultNodeWrapper();
result.setElement(element);
AcceptsIncomingConnectionStrategy acceptsIncomingConnectionStrategy = createAcceptsIncomingConnectionStrategy(configurationElement);
@@ -88,6 +110,7 @@
Logger.logError(message, new RuntimeException(message));
return null;
}
+ ((Container)element).setMetaData("configurationElement", configurationElement);
DefaultContainerWrapper result = new DefaultContainerWrapper();
result.setElement(element);
AcceptsElementStrategy acceptsElementStrategy = createAcceptsElementStrategy(configurationElement);
@@ -149,6 +172,7 @@
Logger.logError(message, new RuntimeException(message));
return null;
}
+ ((Container)element).setMetaData("configurationElement", configurationElement);
DefaultFlowWrapper result = new DefaultFlowWrapper();
result.setElement(element);
AcceptsElementStrategy acceptsElementStrategy = createAcceptsElementStrategy(configurationElement);
@@ -162,6 +186,118 @@
return result;
}
+ public static EditPart createEditPart(Element element) {
+ IConfigurationElement configurationElement =
+ (IConfigurationElement)element.getMetaData("configurationElement");
+ if (configurationElement == null) return null;
+ IConfigurationElement[] children = configurationElement.getChildren();
+ if (children.length != 1) return null;
+ String type = children[0].getName();
+ if ("flow".equals(type)) {
+ return new RootEditPart();
+ } else if ("container".equals(type)) {
+ return new ContainerEditPart();
+ } else if ("node".equals(type)) {
+ return createNodeEditPart(configurationElement);
+ } else if ("connection".equals(type)) {
+ return new ConnectionEditPart();
+ } else {
+ return null;
+ }
+ }
+
+ private static EditPart createNodeEditPart(final IConfigurationElement configurationElement) {
+ return new ElementEditPart() {
+ protected IFigure createFigure() {
+ ElementFigure result = null;
+ IConfigurationElement figureElement = null;
+ IConfigurationElement[] children = configurationElement.getChildren("node");
+ if (children.length == 1) {
+ children = children[0].getChildren("figure");
+ if (children.length == 1) {
+ figureElement = children[0];
+ }
+ }
+ if (figureElement == null) {
+ return new RectangleElementFigure();
+ }
+ if (figureElement.getAttribute("class") != null) {
+ try {
+ return (IFigure)figureElement.createExecutableExtension("class");
+ }
+ catch (CoreException e) {
+ return null;
+ }
+ }
+ children = figureElement.getChildren();
+ if (children.length < 1) {
+ result = new RectangleElementFigure();
+ } else if ("ellipse".equals(children[0])){
+ result = new EllipseElementFigure();
+ } else if ("rounded-rectangle".equals(children[0])) {
+ result = new RoundedRectangleElementFigure();
+ } else {
+ result = new RectangleElementFigure();
+ }
+ if (figureElement.getAttribute("icon") != null) {
+ String iconPath = figureElement.getAttribute("icon");
+ URL url = Platform.getBundle(figureElement.getContributor().getName()).getEntry(iconPath);
+ Image icon = null;
+ if (imageMap.containsKey(url.getPath())) {
+ icon = imageMap.get(url.getPath());
+ } else {
+ icon = ImageDescriptor.createFromURL(url).createImage();
+ imageMap.put(url.getPath(), icon);
+ }
+ result.setIcon(icon);
+ } else if (configurationElement.getAttribute("figure") != null) {
+ String iconPath = configurationElement.getAttribute("icon");
+ URL url = Platform.getBundle(figureElement.getContributor().getName()).getEntry(iconPath);
+ Image icon = null;
+ if (imageMap.containsKey(url.getPath())) {
+ icon = imageMap.get(url.getPath());
+ } else {
+ icon = ImageDescriptor.createFromURL(url).createImage();
+ imageMap.put(url.getPath(), icon);
+ }
+ result.setIcon(icon);
+ }
+ if (figureElement.getAttribute("color") != null) {
+ String colorString = figureElement.getAttribute("color");
+ Color color = null;
+ if (colorMap.containsKey(colorString)) {
+ color = colorMap.get(colorString);
+ } else {
+ try {
+ StringTokenizer tokenizer = new StringTokenizer(colorString, ",");
+ int[] rgb = new int[3];
+ int i = 0;
+ while (tokenizer.hasMoreTokens()) {
+ rgb[i++] = Integer.parseInt(tokenizer.nextToken());
+ }
+ color = new Color(Display.getCurrent(), rgb[0], rgb[1], rgb[2]);
+ colorMap.put(colorString, color);
+ } catch (NumberFormatException e) {}
+ }
+ result.setColor(color);
+ }
+ Dimension size = new Dimension(result.getSize());
+ if (figureElement.getAttribute("width") != null) {
+ try {
+ size.width = Integer.parseInt(figureElement.getAttribute("width"));
+ } catch (NumberFormatException e) {}
+ }
+ if (figureElement.getAttribute("height") != null) {
+ try {
+ size.height = Integer.parseInt(figureElement.getAttribute("height"));
+ } catch (NumberFormatException e) {}
+ }
+ result.setSize(size);
+ return result;
+ }
+ };
+ }
+
public static Wrapper createWrapper(String elementId) {
if (elementMap == null) {
initializeRegistry();
17 years, 4 months
JBoss Tools SVN: r9668 - in trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor: mozilla and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2008-08-12 10:23:36 -0400 (Tue, 12 Aug 2008)
New Revision: 9668
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/DocTypeUtil.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/FileUtil.java
Log:
JBIDE-924
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2008-08-12 14:23:25 UTC (rev 9667)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2008-08-12 14:23:36 UTC (rev 9668)
@@ -3241,7 +3241,7 @@
public void reinit() {
visualBuilder.setSelectionRectangle(null);
- visualEditor.setEditorDomEventListener(this);
+ visualEditor.setEditorDomEventListener(this);
IDOMModel sourceModel = (IDOMModel) getModel();
if (sourceModel != null) {
IDOMDocument sourceDocument = sourceModel.getDocument();
@@ -3249,6 +3249,18 @@
} else {
visualBuilder.rebuildDom(null);
}
+ //reinits selection controller+ controller
+ visualEditor.reinitDesignMode();
+ visualSelectionController = new VpeSelectionController(visualEditor.getEditor().getSelectionController());
+
+ selectionBuilder = new VpeSelectionBuilder(domMapping, sourceBuilder,
+ visualBuilder, visualSelectionController);
+
+ selectionManager = new SelectionManager(pageContext,
+ sourceEditor, visualSelectionController);
+
+ keyEventHandler = new KeyEventManager(sourceEditor, domMapping,
+ pageContext,visualSelectionController);
}
/**
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java 2008-08-12 14:23:25 UTC (rev 9667)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java 2008-08-12 14:23:36 UTC (rev 9668)
@@ -74,6 +74,8 @@
import org.mozilla.interfaces.nsIHTMLInlineTableEditor;
import org.mozilla.interfaces.nsIHTMLObjectResizer;
import org.mozilla.interfaces.nsIPlaintextEditor;
+import org.mozilla.interfaces.nsISelection;
+import org.mozilla.interfaces.nsISelectionPrivate;
public class MozillaEditor extends EditorPart implements IReusableEditor {
protected static final String INIT_URL = /*"file://" +*/ (new File(VpePlugin.getDefault().getResourcePath("ve"), "init.html")).getAbsolutePath(); //$NON-NLS-1$ //$NON-NLS-2$
@@ -668,8 +670,11 @@
private void onReloadWindow() {
removeDomEventListeners();
+ xulRunnerEditor.removeResizerListener();
contentArea = findContentArea();
addDomEventListeners();
+ addSelectionListener();
+ xulRunnerEditor.addResizerListener();
controller.reinit();
}
@@ -678,12 +683,20 @@
*
*/
public void reload() {
-
+
doctype = DocTypeUtil.getDoctype(getEditorInput());
+ //coused page to be refreshed
+ setRefreshPage(true);
xulRunnerEditor.setText(doctype
+ DocTypeUtil.getContentInitFile(new File(INIT_URL)));
-
}
+ /**
+ * Initialized design mode in visual refresh
+ */
+ public void initDesingMode() {
+ editor=null;
+ getEditor();
+ }
/**
* @return Doctype for document
@@ -692,13 +705,18 @@
return doctype;
}
- public boolean isRefreshPage() {
+ private boolean isRefreshPage() {
return isRefreshPage;
}
public void setRefreshPage(boolean isRefreshPage) {
this.isRefreshPage = isRefreshPage;
}
+
+ public void reinitDesignMode() {
+ editor=null;
+ getEditor();
+ }
/**
* Returns Editor for This Document
* @return
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/DocTypeUtil.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/DocTypeUtil.java 2008-08-12 14:23:25 UTC (rev 9667)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/DocTypeUtil.java 2008-08-12 14:23:36 UTC (rev 9668)
@@ -143,7 +143,7 @@
// get file
IFile templateFile = FileUtil.getFile(fileName, file);
- if (templateFile != null)
+ if (templateFile != null) {
//if it's was first call of DOCTYPE function
if(previousFiles==null) {
@@ -155,7 +155,7 @@
previousFiles.add(templateFile);
docTypeValue = getDoctype(templateFile,previousFiles);
}
-
+ }
}
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/FileUtil.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/FileUtil.java 2008-08-12 14:23:25 UTC (rev 9667)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/FileUtil.java 2008-08-12 14:23:36 UTC (rev 9668)
@@ -31,6 +31,8 @@
import org.jboss.tools.common.model.project.IModelNature;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.vpe.VpePlugin;
+import org.jboss.tools.vpe.editor.css.AbsoluteFolderReferenceList;
+import org.jboss.tools.vpe.editor.css.ResourceReference;
public class FileUtil {
@@ -77,17 +79,24 @@
*/
public static IFile getFile(String fileName, IFile includeFile) {
IFile file = null;
- if(fileName.startsWith("/")) {
+ if(fileName.startsWith("/")) { //$NON-NLS-1$
try {
- WebArtifactEdit edit =
- WebArtifactEdit.getWebArtifactEditForRead(includeFile.getProject());
- IVirtualComponent com = ComponentCore.createComponent(includeFile.getProject());
- IVirtualFolder webRootFolder = com.getRootFolder().getFolder(new Path("/"));
- IContainer folder = webRootFolder.getUnderlyingFolder();
- IPath path = folder.getFullPath().append(fileName);
- file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
- } catch (Exception ex) {
- // do nothing that means include will shown as text region with included file name
+ ResourceReference[] resources = AbsoluteFolderReferenceList.getInstance().getAllResources(includeFile);
+ if(resources!=null && resources.length==1) {
+ String location =resources[0].getLocation()+fileName;
+ IPath path=new Path(location);
+ return ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(path);
+ }else {
+ WebArtifactEdit edit =
+ WebArtifactEdit.getWebArtifactEditForRead(includeFile.getProject());
+ IVirtualComponent com = ComponentCore.createComponent(includeFile.getProject());
+ IVirtualFolder webRootFolder = com.getRootFolder().getFolder(new Path("/"));
+ IContainer folder = webRootFolder.getUnderlyingFolder();
+ IPath path = folder.getFullPath().append(fileName);
+ file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
+ }
+ }catch (Exception ex) {
+ // do nothing that means include will shown as text region with included file name
}
} else {
IPath currentFolder = includeFile.getParent().getFullPath();
17 years, 4 months
JBoss Tools SVN: r9667 - trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2008-08-12 10:23:25 -0400 (Tue, 12 Aug 2008)
New Revision: 9667
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerEditor.java
Log:
JBIDE-924
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerEditor.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerEditor.java 2008-08-12 13:54:55 UTC (rev 9666)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerEditor.java 2008-08-12 14:23:25 UTC (rev 9667)
@@ -46,12 +46,9 @@
import org.mozilla.interfaces.nsISupports;
import org.mozilla.interfaces.nsITooltipListener;
import org.mozilla.interfaces.nsITransferable;
-import org.mozilla.interfaces.nsIWebProgressListener;
import org.mozilla.xpcom.Mozilla;
import org.mozilla.xpcom.XPCOMException;
-import com.sun.org.apache.bcel.internal.generic.RETURN;
-
/**
* @author Sergey Vasilyev (svasilyev(a)exadel.com)
*
@@ -66,7 +63,7 @@
/**
* color which used for highlight elements which user can see
*/
- public static final String flasherVisialElementColor = "blue";
+ public static final String flasherVisialElementColor = "blue"; //$NON-NLS-1$
/**
* color which used for highlight parent elements for elements which user
@@ -133,11 +130,7 @@
//TODO Max Areshkau this caused en error when we close editor under Mac OS
// getWebBrowser().removeWebBrowserListener(XulRunnerEditor.this, nsIWebProgressListener.NS_IWEBPROGRESSLISTENER_IID);
getWebBrowser().removeWebBrowserListener(XulRunnerEditor.this, nsITooltipListener.NS_ITOOLTIPLISTENER_IID);
- if (selectionListener != null) {
- nsISelection selection = getSelection();
- nsISelectionPrivate selectionPrivate = (nsISelectionPrivate) selection.queryInterface(nsISelectionPrivate.NS_ISELECTIONPRIVATE_IID);
- selectionPrivate.removeSelectionListener(selectionListener);
- }
+ removeSelectionListener();
if (resizeListener != null)
getIXulRunnerVpeResizer().removeResizeListener(resizeListener);
xulRunnerVpeResizer.dispose();
@@ -214,14 +207,27 @@
public void onElementResize(nsIDOMElement element, int handle, int top, int left, int width, int height) {
}
- public void onLoadWindow() {
+ /**
+ * Removes resizer listener
+ */
+ public void removeResizerListener() {
+ if (resizeListener != null)
+ getIXulRunnerVpeResizer().removeResizeListener(resizeListener);
+ }
+ /**
+ * Add Resizer Listener
+ */
+ public void addResizerListener() {
if (getIXulRunnerVpeResizer() != null) {
getIXulRunnerVpeResizer().init(getDOMDocument());
getIXulRunnerVpeResizer().addResizeListener(resizeListener);
}
-
}
+ public void onLoadWindow() {
+ addResizerListener();
+ }
+
public nsIDragSession getCurrentDragSession() {
nsIServiceManager serviceManager = getServiceManager();
nsIDragService dragService = (nsIDragService) serviceManager.getServiceByContractID(XPCOM.NS_DRAGSERVICE_CONTRACTID, nsIDragService.NS_IDRAGSERVICE_IID);
@@ -572,6 +578,10 @@
getIFlasher().scrollElementIntoView(element);
}
+ /**
+ * Adds selection listener
+ * @param selectionListener
+ */
public void addSelectionListener (
nsISelectionListener selectionListener) {
nsISelection selection = getSelection();
@@ -579,8 +589,18 @@
selectionPrivate.addSelectionListener(selectionListener);
this.selectionListener = selectionListener;
}
-
/**
+ * Removes selection listener
+ */
+ public void removeSelectionListener() {
+ if (this.selectionListener != null) {
+ nsISelection selection = getSelection();
+ nsISelectionPrivate selectionPrivate = (nsISelectionPrivate) selection.queryInterface(nsISelectionPrivate.NS_ISELECTIONPRIVATE_IID);
+ selectionPrivate.removeSelectionListener(selectionListener);
+ }
+ selectionListener=null;
+ }
+ /**
* get nsIDomElement from nsIDomNode
*
* if node is nsIDomElement - return it
17 years, 4 months
JBoss Tools SVN: r9666 - in trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor: template and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: sdzmitrovich
Date: 2008-08-12 09:54:55 -0400 (Tue, 12 Aug 2008)
New Revision: 9666
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeSourceDomBuilder.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/SelectionManager.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2569
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeSourceDomBuilder.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeSourceDomBuilder.java 2008-08-12 13:31:48 UTC (rev 9665)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeSourceDomBuilder.java 2008-08-12 13:54:55 UTC (rev 9666)
@@ -261,10 +261,13 @@
VpeTemplate template = elementMapping.getTemplate();
- if (!template.openBundle(pageContext, visualNode, elementMapping))
- template.openBundleEditors(pageContext,
- (Element) elementMapping.getSourceNode(),
- elementMapping.getData());
+ // as all templates implement new method
+ template.openBundle(pageContext, visualNode, elementMapping);
+ // if (!template.openBundle(pageContext, visualNode,
+ // elementMapping))
+ // template.openBundleEditors(pageContext,
+ // (Element) elementMapping.getSourceNode(),
+ // elementMapping.getData());
}
return false;
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/SelectionManager.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/SelectionManager.java 2008-08-12 13:31:48 UTC (rev 9665)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/SelectionManager.java 2008-08-12 13:54:55 UTC (rev 9666)
@@ -122,7 +122,11 @@
isNodeEditable = true;
}
-
+
+ if (targetVisualNode.getNodeType() != nsIDOMNode.TEXT_NODE
+ && SelectionUtil.getLastSelectedNode(getPageContext()) == targetVisualNode)
+ return;
+
int focusOffset;
int length;
@@ -294,7 +298,7 @@
// if mapping is elementMapping
- SelectionUtil.clearSelection(selectionController);
+// SelectionUtil.clearSelection(selectionController);
if (nodeMapping instanceof VpeElementMapping) {
@@ -373,6 +377,9 @@
int visualNodeAnchorOffcet = TextUtil.visualPosition(
((Node) targetSourceNode).getNodeValue(),
anchorOffcetReferenceToSourceNode);
+
+ nsISelection selection = selectionController.getSelection(
+ nsISelectionController.SELECTION_NORMAL);
selectionController.getSelection(
nsISelectionController.SELECTION_NORMAL).collapse(
17 years, 4 months
JBoss Tools SVN: r9665 - trunk/documentation/jboss-tools-docs/index/en.
by jbosstools-commits@lists.jboss.org
Author: smukhina
Date: 2008-08-12 09:31:48 -0400 (Tue, 12 Aug 2008)
New Revision: 9665
Modified:
trunk/documentation/jboss-tools-docs/index/en/master.xml
Log:
https://jira.jboss.org/jira/browse/JBDS-91 - index name for esb pdf file is corrected
Modified: trunk/documentation/jboss-tools-docs/index/en/master.xml
===================================================================
--- trunk/documentation/jboss-tools-docs/index/en/master.xml 2008-08-12 13:11:26 UTC (rev 9664)
+++ trunk/documentation/jboss-tools-docs/index/en/master.xml 2008-08-12 13:31:48 UTC (rev 9665)
@@ -75,7 +75,7 @@
<primaryie>WS Reference Guide<ulink
url="en/ws_ref_guide/html/index.html">(html)</ulink>
<ulink url="en/ws_ref_guide/html_single/index.html">(html single)</ulink>
- <ulink url="en/ws_ref_guide/pdf/Exadel_Studio_Migration_Guide.pdf"
+ <ulink url="en/ws_ref_guide/pdf/WS_Reference_Guide.pdf"
>(pdf)</ulink>
</primaryie>
</indexentry>
17 years, 4 months
JBoss Tools SVN: r9664 - trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2008-08-12 09:11:26 -0400 (Tue, 12 Aug 2008)
New Revision: 9664
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/PageFigure.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2254
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/PageFigure.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/PageFigure.java 2008-08-12 10:10:49 UTC (rev 9663)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/PageFigure.java 2008-08-12 13:11:26 UTC (rev 9664)
@@ -10,22 +10,21 @@
******************************************************************************/
package org.jboss.tools.seam.ui.pages.editor.figures;
-import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.ConnectionAnchor;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.LineBorder;
-import org.eclipse.draw2d.ScaledGraphics;
import org.eclipse.draw2d.XYLayout;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Insets;
-import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gef.handles.HandleBounds;
+import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Pattern;
-import org.eclipse.swt.widgets.Display;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.jst.web.model.ReferenceObject;
+import org.jboss.tools.seam.pages.xml.model.helpers.SeamPagesDiagramStructureHelper;
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.Page;
import org.jboss.tools.seam.ui.pages.editor.edit.PageEditPart;
import org.jboss.tools.seam.ui.pages.editor.figures.xpl.FixedConnectionAnchor;
@@ -122,8 +121,11 @@
// drawIcon
if (icon != null)
g.drawImage(icon, start + getInsetX(), getInsetY());
-
+ if(SeamPagesDiagramStructureHelper.instance.isUnconfirmedPage((XModelObject)page.getData())){
+ g.drawImage(errorIcon, start + getInsetX(), getInsetY()+8);
+ }
+
//color the page
if (page != null /*&& group.isConfirmed()*/) {
g.setBackgroundColor(new Color(null, 0xff, 0xff, 0xc2));
@@ -231,6 +233,11 @@
int width = r.width - 1;
int height = r.height - 1;
+ if(page.getData() instanceof ReferenceObject && ((ReferenceObject)page.getData()).getReference() == null){
+ graphics.setLineDash(new int[]{3,3});
+ graphics.setLineStyle(SWT.LINE_CUSTOM);
+ }
+
if (page != null /*&& group.isConfirmed()*/)
graphics.setForegroundColor(blackColor);
else
17 years, 4 months
JBoss Tools SVN: r9663 - in workspace/grid: org.jboss.tools.bpmn2jpdl and 14 other directories.
by jbosstools-commits@lists.jboss.org
Author: Grid.Qian
Date: 2008-08-12 06:10:49 -0400 (Tue, 12 Aug 2008)
New Revision: 9663
Added:
workspace/grid/org.jboss.tools.bpmn2jpdl/
workspace/grid/org.jboss.tools.bpmn2jpdl/.classpath
workspace/grid/org.jboss.tools.bpmn2jpdl/.project
workspace/grid/org.jboss.tools.bpmn2jpdl/.settings/
workspace/grid/org.jboss.tools.bpmn2jpdl/.settings/org.eclipse.jdt.core.prefs
workspace/grid/org.jboss.tools.bpmn2jpdl/META-INF/
workspace/grid/org.jboss.tools.bpmn2jpdl/META-INF/MANIFEST.MF
workspace/grid/org.jboss.tools.bpmn2jpdl/build.properties
workspace/grid/org.jboss.tools.bpmn2jpdl/lib/
workspace/grid/org.jboss.tools.bpmn2jpdl/lib/commons-logging.jar
workspace/grid/org.jboss.tools.bpmn2jpdl/lib/dom4j-1.6.1.jar
workspace/grid/org.jboss.tools.bpmn2jpdl/lib/jbpm-jpdl.jar
workspace/grid/org.jboss.tools.bpmn2jpdl/lib/jbpm.cfg.xml
workspace/grid/org.jboss.tools.bpmn2jpdl/lib/org/
workspace/grid/org.jboss.tools.bpmn2jpdl/lib/org/jbpm/
workspace/grid/org.jboss.tools.bpmn2jpdl/lib/org/jbpm/default.jbpm.cfg.xml
workspace/grid/org.jboss.tools.bpmn2jpdl/plugin.properties
workspace/grid/org.jboss.tools.bpmn2jpdl/plugin.xml
workspace/grid/org.jboss.tools.bpmn2jpdl/src/
workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/
workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/
workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/
workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/
workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/B2J.java
workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/action/
workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/action/B2JAction.java
workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/messages/
workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/messages/B2J.properties
workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/messages/B2JMessages.java
workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/translate/
workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/translate/BPMN2JPDL.java
workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/translate/JpdlXmlWriter.java
workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/translate/TranslateHelper.java
workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/util/
workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/util/B2JUtil.java
Log:
Added: workspace/grid/org.jboss.tools.bpmn2jpdl/.classpath
===================================================================
--- workspace/grid/org.jboss.tools.bpmn2jpdl/.classpath (rev 0)
+++ workspace/grid/org.jboss.tools.bpmn2jpdl/.classpath 2008-08-12 10:10:49 UTC (rev 9663)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry exported="true" kind="lib" path="lib/"/>
+ <classpathentry exported="true" kind="lib" path="lib/commons-logging.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/dom4j-1.6.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/jbpm-jpdl.jar" sourcepath="D:/sources/jbpm/trunk/modules/jpdl"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: workspace/grid/org.jboss.tools.bpmn2jpdl/.project
===================================================================
--- workspace/grid/org.jboss.tools.bpmn2jpdl/.project (rev 0)
+++ workspace/grid/org.jboss.tools.bpmn2jpdl/.project 2008-08-12 10:10:49 UTC (rev 9663)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.bpmn2jpdl</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: workspace/grid/org.jboss.tools.bpmn2jpdl/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- workspace/grid/org.jboss.tools.bpmn2jpdl/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ workspace/grid/org.jboss.tools.bpmn2jpdl/.settings/org.eclipse.jdt.core.prefs 2008-08-12 10:10:49 UTC (rev 9663)
@@ -0,0 +1,7 @@
+#Wed Jul 23 02:43:33 CST 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: workspace/grid/org.jboss.tools.bpmn2jpdl/META-INF/MANIFEST.MF
===================================================================
--- workspace/grid/org.jboss.tools.bpmn2jpdl/META-INF/MANIFEST.MF (rev 0)
+++ workspace/grid/org.jboss.tools.bpmn2jpdl/META-INF/MANIFEST.MF 2008-08-12 10:10:49 UTC (rev 9663)
@@ -0,0 +1,19 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %PLUGIN_NAME
+Bundle-SymbolicName: org.jboss.tools.bpmn2jpdl;singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Bundle-Activator: org.jboss.tools.b2j.B2J
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.stp.bpmn;bundle-version="1.0.0",
+ org.jboss.tools.common;bundle-version="2.0.0"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ClassPath: lib/jbpm-jpdl.jar,
+ .,
+ lib/dom4j-1.6.1.jar,
+ lib/commons-logging.jar,
+ lib/
+Bundle-Vendor: %PLUGIN_PROVIDER
Added: workspace/grid/org.jboss.tools.bpmn2jpdl/build.properties
===================================================================
--- workspace/grid/org.jboss.tools.bpmn2jpdl/build.properties (rev 0)
+++ workspace/grid/org.jboss.tools.bpmn2jpdl/build.properties 2008-08-12 10:10:49 UTC (rev 9663)
@@ -0,0 +1,10 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ lib/jbpm-jpdl.jar,\
+ lib/dom4j-1.6.1.jar,\
+ lib/commons-logging.jar,\
+ lib/,\
+ plugin.properties
Added: workspace/grid/org.jboss.tools.bpmn2jpdl/lib/commons-logging.jar
===================================================================
(Binary files differ)
Property changes on: workspace/grid/org.jboss.tools.bpmn2jpdl/lib/commons-logging.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/grid/org.jboss.tools.bpmn2jpdl/lib/dom4j-1.6.1.jar
===================================================================
(Binary files differ)
Property changes on: workspace/grid/org.jboss.tools.bpmn2jpdl/lib/dom4j-1.6.1.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/grid/org.jboss.tools.bpmn2jpdl/lib/jbpm-jpdl.jar
===================================================================
(Binary files differ)
Property changes on: workspace/grid/org.jboss.tools.bpmn2jpdl/lib/jbpm-jpdl.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/grid/org.jboss.tools.bpmn2jpdl/lib/jbpm.cfg.xml
===================================================================
--- workspace/grid/org.jboss.tools.bpmn2jpdl/lib/jbpm.cfg.xml (rev 0)
+++ workspace/grid/org.jboss.tools.bpmn2jpdl/lib/jbpm.cfg.xml 2008-08-12 10:10:49 UTC (rev 9663)
@@ -0,0 +1,52 @@
+<jbpm-configuration>
+
+ <!--
+ This configuration is used when there is no jbpm.cfg.xml file found in the
+ root of the classpath. It is a very basic configuration without persistence
+ and message services. Only the authorization service installed.
+ You can parse and create processes, but when you try to use one of the
+ unavailable services, you'll get an exception.
+ -->
+
+ <jbpm-context>
+ <service name="persistence" factory="org.jbpm.persistence.db.DbPersistenceServiceFactory" />
+ <service name="tx" factory="org.jbpm.tx.TxServiceFactory" />
+ <service name="message" factory="org.jbpm.msg.db.DbMessageServiceFactory" />
+ <service name="scheduler" factory="org.jbpm.scheduler.db.DbSchedulerServiceFactory" />
+ <service name="logging" factory="org.jbpm.logging.db.DbLoggingServiceFactory" />
+ <service name="authentication" factory="org.jbpm.security.authentication.DefaultAuthenticationServiceFactory" />
+ </jbpm-context>
+
+ <!-- configuration property used by persistence service impl org.jbpm.persistence.db.DbPersistenceServiceFactory -->
+ <string name="resource.hibernate.cfg.xml" value="hibernate.cfg.xml" />
+
+ <!-- configuration resource files pointing to default configuration files in jbpm-{version}.jar -->
+ <string name="resource.business.calendar" value="org/jbpm/calendar/jbpm.business.calendar.properties" />
+ <string name="resource.default.modules" value="org/jbpm/graph/def/jbpm.default.modules.properties" />
+ <string name="resource.converter" value="org/jbpm/db/hibernate/jbpm.converter.properties" />
+ <string name="resource.action.types" value="org/jbpm/graph/action/action.types.xml" />
+ <string name="resource.node.types" value="org/jbpm/graph/node/node.types.xml" />
+ <string name="resource.parsers" value="org/jbpm/jpdl/par/jbpm.parsers.xml" />
+ <string name="resource.varmapping" value="org/jbpm/context/exe/jbpm.varmapping.xml" />
+ <string name="resource.mail.templates" value="jbpm.mail.templates.xml" />
+
+ <int name="jbpm.byte.block.size" value="1024" singleton="true" />
+ <bean name="jbpm.task.instance.factory" class="org.jbpm.taskmgmt.impl.DefaultTaskInstanceFactoryImpl" singleton="true" />
+ <bean name="jbpm.variable.resolver" class="org.jbpm.jpdl.el.impl.JbpmVariableResolver" singleton="true" />
+ <string name="jbpm.mail.smtp.host" value="localhost" />
+ <bean name="jbpm.mail.address.resolver" class="org.jbpm.identity.mail.IdentityAddressResolver" singleton="true" />
+ <string name="jbpm.mail.from.address" value="jbpm@noreply" />
+
+ <bean name="jbpm.job.executor" class="org.jbpm.job.executor.JobExecutor">
+ <field name="jbpmConfiguration"><ref bean="jbpmConfiguration" /></field>
+ <field name="name"><string value="JbpmJobExector" /></field>
+ <field name="nbrOfThreads"><int value="1" /></field>
+ <field name="idleInterval"><int value="5000" /></field>
+ <field name="maxIdleInterval"><int value="3600000" /></field> <!-- 1 hour -->
+ <field name="historyMaxSize"><int value="20" /></field>
+ <field name="maxLockTime"><int value="600000" /></field> <!-- 10 minutes -->
+ <field name="lockMonitorInterval"><int value="60000" /></field> <!-- 1 minute -->
+ <field name="lockBufferTime"><int value="5000" /></field> <!-- 5 seconds -->
+ </bean>
+
+</jbpm-configuration>
Added: workspace/grid/org.jboss.tools.bpmn2jpdl/lib/org/jbpm/default.jbpm.cfg.xml
===================================================================
--- workspace/grid/org.jboss.tools.bpmn2jpdl/lib/org/jbpm/default.jbpm.cfg.xml (rev 0)
+++ workspace/grid/org.jboss.tools.bpmn2jpdl/lib/org/jbpm/default.jbpm.cfg.xml 2008-08-12 10:10:49 UTC (rev 9663)
@@ -0,0 +1,52 @@
+<jbpm-configuration>
+
+ <!--
+ This configuration is used when there is no jbpm.cfg.xml file found in the
+ root of the classpath. It is a very basic configuration without persistence
+ and message services. Only the authorization service installed.
+ You can parse and create processes, but when you try to use one of the
+ unavailable services, you'll get an exception.
+ -->
+
+ <jbpm-context>
+ <service name="persistence" factory="org.jbpm.persistence.db.DbPersistenceServiceFactory" />
+ <service name="tx" factory="org.jbpm.tx.TxServiceFactory" />
+ <service name="message" factory="org.jbpm.msg.db.DbMessageServiceFactory" />
+ <service name="scheduler" factory="org.jbpm.scheduler.db.DbSchedulerServiceFactory" />
+ <service name="logging" factory="org.jbpm.logging.db.DbLoggingServiceFactory" />
+ <service name="authentication" factory="org.jbpm.security.authentication.DefaultAuthenticationServiceFactory" />
+ </jbpm-context>
+
+ <!-- configuration property used by persistence service impl org.jbpm.persistence.db.DbPersistenceServiceFactory -->
+ <string name="resource.hibernate.cfg.xml" value="hibernate.cfg.xml" />
+
+ <!-- configuration resource files pointing to default configuration files in jbpm-{version}.jar -->
+ <string name="resource.business.calendar" value="org/jbpm/calendar/jbpm.business.calendar.properties" />
+ <string name="resource.default.modules" value="org/jbpm/graph/def/jbpm.default.modules.properties" />
+ <string name="resource.converter" value="org/jbpm/db/hibernate/jbpm.converter.properties" />
+ <string name="resource.action.types" value="org/jbpm/graph/action/action.types.xml" />
+ <string name="resource.node.types" value="org/jbpm/graph/node/node.types.xml" />
+ <string name="resource.parsers" value="org/jbpm/jpdl/par/jbpm.parsers.xml" />
+ <string name="resource.varmapping" value="org/jbpm/context/exe/jbpm.varmapping.xml" />
+ <string name="resource.mail.templates" value="jbpm.mail.templates.xml" />
+
+ <int name="jbpm.byte.block.size" value="1024" singleton="true" />
+ <bean name="jbpm.task.instance.factory" class="org.jbpm.taskmgmt.impl.DefaultTaskInstanceFactoryImpl" singleton="true" />
+ <bean name="jbpm.variable.resolver" class="org.jbpm.jpdl.el.impl.JbpmVariableResolver" singleton="true" />
+ <string name="jbpm.mail.smtp.host" value="localhost" />
+ <bean name="jbpm.mail.address.resolver" class="org.jbpm.identity.mail.IdentityAddressResolver" singleton="true" />
+ <string name="jbpm.mail.from.address" value="jbpm@noreply" />
+
+ <bean name="jbpm.job.executor" class="org.jbpm.job.executor.JobExecutor">
+ <field name="jbpmConfiguration"><ref bean="jbpmConfiguration" /></field>
+ <field name="name"><string value="JbpmJobExector" /></field>
+ <field name="nbrOfThreads"><int value="1" /></field>
+ <field name="idleInterval"><int value="5000" /></field>
+ <field name="maxIdleInterval"><int value="3600000" /></field> <!-- 1 hour -->
+ <field name="historyMaxSize"><int value="20" /></field>
+ <field name="maxLockTime"><int value="600000" /></field> <!-- 10 minutes -->
+ <field name="lockMonitorInterval"><int value="60000" /></field> <!-- 1 minute -->
+ <field name="lockBufferTime"><int value="5000" /></field> <!-- 5 seconds -->
+ </bean>
+
+</jbpm-configuration>
Added: workspace/grid/org.jboss.tools.bpmn2jpdl/plugin.properties
===================================================================
--- workspace/grid/org.jboss.tools.bpmn2jpdl/plugin.properties (rev 0)
+++ workspace/grid/org.jboss.tools.bpmn2jpdl/plugin.properties 2008-08-12 10:10:49 UTC (rev 9663)
@@ -0,0 +1,3 @@
+b2jaction=BPMN -> JPDL
+PLUGIN_NAME=BPMN2JPDL
+PLUGIN_PROVIDER=Red Hat, Inc.
\ No newline at end of file
Added: workspace/grid/org.jboss.tools.bpmn2jpdl/plugin.xml
===================================================================
--- workspace/grid/org.jboss.tools.bpmn2jpdl/plugin.xml (rev 0)
+++ workspace/grid/org.jboss.tools.bpmn2jpdl/plugin.xml 2008-08-12 10:10:49 UTC (rev 9663)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="org.eclipse.ui.popupMenus">
+ <objectContribution
+ id="org.jboss.tools.b2j.objectContribution.bpmnfile"
+ nameFilter="*.bpmn"
+ objectClass="org.eclipse.core.resources.IFile">
+ <action
+ label="%b2jaction"
+ class="org.jboss.tools.b2j.action.B2JAction"
+ menubarPath="additions"
+ enablesFor="1"
+ id="org.jboss.tools.b2j.Bpmn2JpdlAction">
+ </action>
+ </objectContribution>
+ </extension>
+
+</plugin>
Added: workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/B2J.java
===================================================================
--- workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/B2J.java (rev 0)
+++ workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/B2J.java 2008-08-12 10:10:49 UTC (rev 9663)
@@ -0,0 +1,50 @@
+package org.jboss.tools.b2j;
+
+import org.jboss.tools.common.log.BaseUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class B2J extends BaseUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.tools.b2j";
+
+ // The shared instance
+ private static B2J plugin;
+
+ /**
+ * The constructor
+ */
+ public B2J() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static B2J getDefault() {
+ return plugin;
+ }
+
+}
Added: workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/action/B2JAction.java
===================================================================
--- workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/action/B2JAction.java (rev 0)
+++ workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/action/B2JAction.java 2008-08-12 10:10:49 UTC (rev 9663)
@@ -0,0 +1,30 @@
+package org.jboss.tools.b2j.action;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+import org.jboss.tools.b2j.translate.BPMN2JPDL;
+
+public class B2JAction implements IObjectActionDelegate{
+
+ //private IWorkbenchPart myPart;
+ private IFile bpmnFile;
+
+ public void setActivePart(IAction arg0, IWorkbenchPart part) {
+ //myPart = part;
+ }
+
+ public void run(IAction arg0) {
+ BPMN2JPDL translator = new BPMN2JPDL();
+ translator.setBpmnFile(bpmnFile);
+ translator.translateToFiles();
+ }
+
+ public void selectionChanged(IAction arg0, ISelection selection) {
+ bpmnFile = (IFile) ((IStructuredSelection) selection).getFirstElement();
+ }
+
+}
Added: workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/messages/B2J.properties
===================================================================
--- workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/messages/B2J.properties (rev 0)
+++ workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/messages/B2J.properties 2008-08-12 10:10:49 UTC (rev 9663)
@@ -0,0 +1,21 @@
+Loop_Decision=Loop Decition
+Loop_Decision_Description=this decision is for mocking bpmn loop activity
+To=to
+Bpmn_Suffix=bpmn
+Workspace_Prefix=platform:/resource
+Jpdl_Suffix=jpdl
+Jpdl_Process_Definition_Name=processdefinition.xml
+Jpdl_32_Namespace_Url=urn:jbpm.org:jpdl-3.2
+Jpdl_Element_Name=name
+Jpdl_Process_Definition_Element=process-definition
+Jpdl_Transition_Element=transition
+Jpdl_ProcessState_Element_Name=process-state
+Jpdl_SubProcess_Element_Name=sub-process
+Folder_Name_Separator=.
+Translate_Error_JpdlWriter_Null=The JPDL Writer is null.
+Translate_Error_JpdlProcess_Definition_Null=The JPDL process definition is null.
+Translate_Error_JpdlFile_CanNotGenerate=Couldn't write process definition xml:
+Translate_Error_JpdlFile_CanNotWrite=Couldn't write process definition to a jpdl file:
+Translate_Error_BpmnFile_CanNotRead=Couldn't read bpmn file:
+Translate_Warning_Bpmn_Element_Name= The bpmn element's name is null or same to another element's name:
+Translate_Warning_Bpmn_Element_Type=The type of this bpmn element is not translated to corresponding jpdl element:
\ No newline at end of file
Added: workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/messages/B2JMessages.java
===================================================================
--- workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/messages/B2JMessages.java (rev 0)
+++ workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/messages/B2JMessages.java 2008-08-12 10:10:49 UTC (rev 9663)
@@ -0,0 +1,39 @@
+package org.jboss.tools.b2j.messages;
+
+import org.eclipse.osgi.util.NLS;
+
+public class B2JMessages {
+
+ private static final String BUNDLE_NAME = "org.jboss.tools.b2j.messages.B2J"; //$NON-NLS-1$
+
+ private B2JMessages() {
+ // Do not instantiate
+ }
+
+ public static String Loop_Decision;
+ public static String Loop_Decision_Description;
+ public static String To;
+ public static String Bpmn_Suffix;
+ public static String Workspace_Prefix;
+ public static String Folder_Name_Separator;
+ public static String Jpdl_Suffix;
+ public static String Jpdl_Process_Definition_Name;
+ public static String Jpdl_ProcessState_Element_Name;
+ public static String Jpdl_SubProcess_Element_Name;
+ public static String Jpdl_32_Namespace_Url;
+ public static String Jpdl_Process_Definition_Element;
+ public static String Jpdl_Transition_Element;
+ public static String Jpdl_Element_Name;
+ public static String Translate_Error_JpdlWriter_Null;
+ public static String Translate_Error_JpdlProcess_Definition_Null;
+ public static String Translate_Error_JpdlFile_CanNotWrite;
+ public static String Translate_Error_JpdlFile_CanNotGenerate;
+ public static String Translate_Error_BpmnFile_CanNotRead;
+ public static String Translate_Warning_Bpmn_Element_Name;
+ public static String Translate_Warning_Bpmn_Element_Type;
+
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, B2JMessages.class);
+ }
+}
\ No newline at end of file
Added: workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/translate/BPMN2JPDL.java
===================================================================
--- workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/translate/BPMN2JPDL.java (rev 0)
+++ workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/translate/BPMN2JPDL.java 2008-08-12 10:10:49 UTC (rev 9663)
@@ -0,0 +1,332 @@
+package org.jboss.tools.b2j.translate;
+
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.stp.bpmn.*;
+import org.jboss.tools.b2j.B2J;
+import org.jboss.tools.b2j.messages.B2JMessages;
+import org.jbpm.graph.def.*;
+import org.jbpm.graph.node.*;
+
+public class BPMN2JPDL {
+
+ IFile bpmnFile;
+ IFile[] jpdlFiles;
+ List<ProcessDefinition> processDefs = new LinkedList<ProcessDefinition>();
+ Map<String, String> map = new HashMap<String, String>();
+
+ List<String> warnings = new ArrayList<String>();
+ List<String> errors = new ArrayList<String>();
+
+ public List<String> getErrors() {
+ return errors;
+ }
+
+ public void setErrors(List<String> errors) {
+ this.errors = errors;
+ }
+
+ public List<String> getWarnings() {
+ return warnings;
+ }
+
+ public void setWarnings(List<String> warnings) {
+ this.warnings = warnings;
+ }
+
+ public IFile[] getJpdlFiles() {
+ return jpdlFiles;
+ }
+
+ public IFile getBpmnFile() {
+ return bpmnFile;
+ }
+
+ public void setBpmnFile(IFile bpmnFile) {
+ this.bpmnFile = bpmnFile;
+ }
+
+ public BPMN2JPDL() {
+ }
+
+ public BPMN2JPDL(IFile bpmnFile) {
+ this.bpmnFile = bpmnFile;
+ }
+
+ /*
+ * Translate a bpmn diagram to string[]. Every string is jpdl process
+ * definition
+ */
+ public String[] translateToStrings() {
+ this.translateDiagram(this.bpmnFile);
+ String[] strForProcessDefs = new String[processDefs.size()];
+
+ JpdlXmlWriter writer = new JpdlXmlWriter();
+ int i = 0;
+ for (ProcessDefinition def : processDefs) {
+ writer.setWriter(new StringWriter());
+ writer.setUseNamespace(true);
+ strForProcessDefs[i] = translatetoString(writer, def);
+ this.errors.addAll(writer.getProblems());
+ i++;
+ }
+
+ return strForProcessDefs;
+ }
+
+ /*
+ * Tranlate a jpdl process definition to a string
+ */
+ private String translatetoString(JpdlXmlWriter writer, ProcessDefinition def) {
+ return writer.toString(def);
+ }
+
+ /*
+ * Translate a bpmn diagram to file[]. Every file is a jpdl file
+ */
+ public void translateToFiles() {
+ String[] strForProcessDefs = translateToStrings();
+ String[] jpdlFileNames = new String[processDefs.size()];
+
+ int i = 0;
+ for (ProcessDefinition def : processDefs) {
+ jpdlFileNames[i] = def.getName();
+ i++;
+ }
+
+ try {
+ jpdlFiles = TranslateHelper.createJpdlFiles(this.getBpmnFile(),
+ strForProcessDefs, jpdlFileNames);
+ } catch (CoreException e) {
+ errors.add(B2JMessages.Translate_Error_JpdlFile_CanNotWrite
+ + e.getMessage());
+ }
+
+ if (errors.size() != 0) {
+ for (String str : errors) {
+ B2J.getDefault().logError(str);
+ }
+ }
+
+ if (warnings.size() != 0) {
+ for (String str : warnings) {
+ B2J.getDefault().logWarning(str);
+ }
+ }
+ }
+
+ /*
+ * Translate a bpmn diagram to jpdl process definitions
+ */
+ public void translateDiagram(IFile bpmnFile) {
+ BpmnDiagram bpmnDiagram = null;
+ try {
+ bpmnDiagram = TranslateHelper.getBpmnDiagram(bpmnFile);
+ } catch (IOException e) {
+ errors.add(B2JMessages.Translate_Error_BpmnFile_CanNotRead
+ + e.getMessage());
+ }
+ for (Pool pool : bpmnDiagram.getPools()) {
+ ProcessDefinition processDef = new ProcessDefinition();
+ translateGraph(pool, processDef);
+ }
+
+ }
+
+ /*
+ * Translate a bpmn graph(pool or subprocess) to a jpdl process difinition
+ */
+ private void translateGraph(Graph graph, ProcessDefinition processDef) {
+
+ // if graph is subprocess type, we will check the name when look it as activity not as sub process
+ if (!(graph instanceof SubProcess) && !TranslateHelper.check_mapElementName((NamedBpmnObject) graph,processDef)) {
+ warnings.add(B2JMessages.Translate_Warning_Bpmn_Element_Name
+ + graph.getID());
+ }
+ processDef.setName(TranslateHelper
+ .generateProcessName((NamedBpmnObject) graph));
+ processDef.setDescription(graph.getDocumentation());
+
+ if (graph instanceof Pool && ((Pool) graph).getLanes().size() != 0) {
+ for (Lane lane : ((Pool) graph).getLanes()) {
+ for (Activity activity : lane.getActivities()) {
+ translateActivity(activity, processDef);
+ }
+ }
+ } else {
+ for (Vertex activity : graph.getVertices()) {
+ if (activity instanceof Activity) {
+ translateActivity((Activity) activity, processDef);
+ }
+ }
+ }
+ translateSequenceFlows(graph, processDef);
+ processDefs.add(processDef);
+
+ }
+
+ /*
+ * Translate a bpmn activity to a jpdl node according to activity type
+ */
+ private void translateActivity(Activity activity,
+ ProcessDefinition processDef) {
+ ActivityType type = activity.getActivityType();
+ Node element = null;
+
+ // According to bpmn activity type, map to different jpdl node
+ // Some type can not be supported by this translation, we give
+ // a warining message for it.
+ if (ActivityType.TASK == type.getValue()) {
+ element = new Node();
+ } else if (ActivityType.SUB_PROCESS == type.getValue()) {
+ element = new ProcessState();
+ translateSubprocess((Graph)activity,
+ (ProcessState) element);
+ } else if (ActivityType.EVENT_START_EMPTY <= type.getValue()
+ && type.getValue() <= ActivityType.EVENT_START_TIMER
+ || ActivityType.EVENT_START_SIGNAL == type.getValue()) {
+ element = new StartState();
+ if (type.getValue() != ActivityType.EVENT_START_EMPTY) {
+ warnings.add(B2JMessages.Translate_Warning_Bpmn_Element_Type
+ + type.getName());
+ }
+ } else if (ActivityType.EVENT_INTERMEDIATE_EMPTY <= type.getValue()
+ && type.getValue() <= ActivityType.EVENT_INTERMEDIATE_CANCEL
+ || ActivityType.EVENT_INTERMEDIATE_SIGNAL == type.getValue()) {
+ element = new State();
+ if (type.getValue() != ActivityType.EVENT_INTERMEDIATE_EMPTY) {
+ warnings.add(B2JMessages.Translate_Warning_Bpmn_Element_Type
+ + type.getName());
+ }
+ } else if (ActivityType.EVENT_END_EMPTY <= type.getValue()
+ && type.getValue() <= ActivityType.EVENT_END_CANCEL
+ || ActivityType.EVENT_END_SIGNAL == type.getValue()) {
+ element = new EndState();
+ if (type.getValue() != ActivityType.EVENT_END_EMPTY) {
+ warnings.add(B2JMessages.Translate_Warning_Bpmn_Element_Type
+ + type.getName());
+ }
+ } else if (ActivityType.GATEWAY_DATA_BASED_EXCLUSIVE <= type.getValue()
+ && type.getValue() <= ActivityType.GATEWAY_EVENT_BASED_EXCLUSIVE
+ || ActivityType.GATEWAY_COMPLEX == type.getValue()) {
+ element = new Decision();
+ if (type.getValue() != ActivityType.GATEWAY_DATA_BASED_EXCLUSIVE) {
+ warnings.add(B2JMessages.Translate_Warning_Bpmn_Element_Type
+ + type.getName());
+ }
+ } else if (ActivityType.GATEWAY_PARALLEL == type.getValue()
+ || ActivityType.GATEWAY_DATA_BASED_INCLUSIVE == type.getValue()) {
+ if (activity.getIncomingEdges().size() <= 1) {
+ element = new Fork();
+ } else {
+ element = new Join();
+ }
+ if (type.getValue() != ActivityType.GATEWAY_PARALLEL) {
+ warnings.add(B2JMessages.Translate_Warning_Bpmn_Element_Type
+ + type.getName());
+ }
+ }
+
+ element.setProcessDefinition(processDef);
+ processDef.addNode(element);
+ if (!TranslateHelper.check_mapElementName(activity,element)) {
+ warnings.add(B2JMessages.Translate_Warning_Bpmn_Element_Name
+ + activity.getID());
+ }
+ map.put(activity.getID(), element.getName());
+
+ // If bpmn activity is loop type, then create a structure to mock it.
+ if (activity.isLooping()) {
+ createMockLoop(activity, element);
+ }
+ }
+
+ /*
+ * Translate a bpmn subprocess to a jpdl processstate and a new jpdl process
+ * difinition
+ */
+ private void translateSubprocess(Graph subProcess,
+ ProcessState element) {
+ ProcessDefinition processDef = new ProcessDefinition();
+ translateGraph(subProcess, processDef);
+ element.setSubProcessDefinition(processDef);
+ }
+
+ /*
+ * Translate bpmn sequenceflows to jpdl transitions
+ */
+ private void translateSequenceFlows(Graph graph,
+ ProcessDefinition processDef) {
+ for (SequenceEdge edge : graph.getSequenceEdges()) {
+ translateSequenceFlow(edge, processDef);
+ }
+ }
+
+ /*
+ * Translate a bpmn sequenceflow to a jpdl transition
+ */
+ private void translateSequenceFlow(SequenceEdge edge,
+ ProcessDefinition processDef) {
+ Transition transition = new Transition();
+ Node element = processDef.getNode(map.get(edge.getSource().getID()));
+ if (!TranslateHelper.check_mapElementName(edge,transition)) {
+ warnings.add(B2JMessages.Translate_Warning_Bpmn_Element_Name
+ + edge.getID());
+ }
+ transition.setProcessDefinition(processDef);
+
+ transition.setFrom(element);
+ transition.setTo(processDef.getNode(map.get(edge.getTarget().getID())));
+ element.addLeavingTransition(transition);
+ if (SequenceFlowConditionType.DEFAULT == edge.getConditionType()
+ .getValue()) {
+ // move default transition to the first of transition list
+ element.reorderLeavingTransition(element.getLeavingTransitions()
+ .size() - 1, 0);
+ } else if (SequenceFlowConditionType.EXPRESSION == edge
+ .getConditionType().getValue()) {
+ transition.setCondition("");
+ }
+ }
+
+ /*
+ * create a jpdl decision structure to map bpmn loop activity
+ */
+ private void createMockLoop(Activity activity, Node element) {
+
+ // create a decision
+ Decision decision = new Decision();
+ String name = activity.getName() + B2JMessages.Loop_Decision;
+ decision.setName(name);
+ decision.setDescription(B2JMessages.Loop_Decision_Description);
+ decision.setProcessDefinition(element.getProcessDefinition());
+ element.getProcessDefinition().addNode(decision);
+ map.put(activity.getID(), name);
+
+ // create a transition from element to decision
+ Transition first = new Transition();
+ first.setName(B2JMessages.To + name);
+ first.setFrom(element);
+ first.setTo(decision);
+ first.setProcessDefinition(element.getProcessDefinition());
+ element.addLeavingTransition(first);
+
+ // create a transition from decision to element
+ Transition second = new Transition();
+ second.setName(B2JMessages.To + element.getName());
+ second.setFrom(decision);
+ second.setTo(element);
+ second.setProcessDefinition(element.getProcessDefinition());
+ decision.addLeavingTransition(second);
+
+ }
+
+}
Added: workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/translate/JpdlXmlWriter.java
===================================================================
--- workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/translate/JpdlXmlWriter.java (rev 0)
+++ workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/translate/JpdlXmlWriter.java 2008-08-12 10:10:49 UTC (rev 9663)
@@ -0,0 +1,211 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.tools.b2j.translate;
+
+import java.io.*;
+import java.util.*;
+
+import org.dom4j.*;
+import org.dom4j.io.*;
+import org.jboss.tools.b2j.messages.B2JMessages;
+import org.jbpm.graph.def.*;
+import org.jbpm.graph.node.*;
+
+public class JpdlXmlWriter {
+
+ Namespace jbpmNamespace = new Namespace(null,
+ B2JMessages.Jpdl_32_Namespace_Url);
+ Writer writer;
+ boolean useNamespace = false;
+
+ List<String> errors;
+
+ public List<String> getProblems() {
+ return errors;
+ }
+
+ public void setProblems(List<String> errors) {
+ this.errors = errors;
+ }
+
+ public Namespace getJbpmNamespace() {
+ return jbpmNamespace;
+ }
+
+ public void setJbpmNamespace(Namespace jbpmNamespace) {
+ this.jbpmNamespace = jbpmNamespace;
+ }
+
+ public JpdlXmlWriter() {
+ }
+
+ public void addError(String msg) {
+ errors.add(msg);
+ }
+
+ public String toString(ProcessDefinition processDefinition) {
+ write(processDefinition);
+ return writer.toString();
+ }
+
+ public void setUseNamespace(boolean useNamespace) {
+ this.useNamespace = useNamespace;
+ }
+
+ public void write(ProcessDefinition processDefinition) {
+ errors = new ArrayList<String>();
+ if (writer == null) {
+ addError(B2JMessages.Translate_Error_JpdlWriter_Null);
+ }
+ if (processDefinition == null) {
+ addError(B2JMessages.Translate_Error_JpdlProcess_Definition_Null);
+ }
+ try {
+ // collect the actions of the process definition
+ // we will remove each named event action and the remaining ones
+ // will be written
+ // on the process definition.
+ // create a dom4j dom-tree for the process definition
+ Document document = createDomTree(processDefinition);
+
+ // write the dom-tree to the given writer
+ OutputFormat outputFormat = new OutputFormat(" ", true);
+ // OutputFormat outputFormat = OutputFormat.createPrettyPrint();
+ XMLWriter xmlWriter = new XMLWriter(writer, outputFormat);
+ xmlWriter.write(document);
+ xmlWriter.flush();
+ writer.flush();
+ } catch (IOException e) {
+ addError(B2JMessages.Translate_Error_JpdlFile_CanNotGenerate
+ + e.getMessage());
+ }
+ }
+
+ private Document createDomTree(ProcessDefinition processDefinition) {
+ Document document = DocumentHelper.createDocument();
+ Element root = null;
+
+ if (useNamespace) {
+ root = document.addElement(
+ B2JMessages.Jpdl_Process_Definition_Element, jbpmNamespace
+ .getURI());
+ } else {
+ root = document
+ .addElement(B2JMessages.Jpdl_Process_Definition_Element);
+ }
+ addAttribute(root, B2JMessages.Jpdl_Element_Name, processDefinition
+ .getName());
+
+ // write the start-state
+ if (processDefinition.getStartState() != null) {
+ writeStartNode(root, (StartState) processDefinition.getStartState());
+ }
+
+ // write the nodeMap
+ if ((processDefinition.getNodes() != null)
+ && (processDefinition.getNodes().size() > 0)) {
+ writeNodes(root, processDefinition.getNodes());
+ }
+
+ root.addText(System.getProperty("line.separator"));
+
+ return document;
+ }
+
+ private void writeStartNode(Element element, StartState startState) {
+ if (startState != null) {
+ writeNode(addElement(element, getTypeName(startState)), startState);
+ }
+ }
+
+ private void writeNodes(Element parentElement, Collection<?> nodes) {
+ Iterator<?> iter = nodes.iterator();
+ while (iter.hasNext()) {
+ org.jbpm.graph.def.Node node = (org.jbpm.graph.def.Node) iter
+ .next();
+ if (!(node instanceof StartState)) {
+ Element nodeElement = addElement(parentElement, ProcessFactory
+ .getTypeName(node));
+ node.write(nodeElement);
+ writeNode(nodeElement, node);
+ }
+ }
+ }
+
+ private void writeNode(Element element, org.jbpm.graph.def.Node node) {
+ addAttribute(element, B2JMessages.Jpdl_Element_Name, node.getName());
+
+ if (B2JMessages.Jpdl_ProcessState_Element_Name
+ .equals(getTypeName(node))) {
+ Element ele = addElement(element,
+ B2JMessages.Jpdl_SubProcess_Element_Name);
+ addAttribute(ele, B2JMessages.Jpdl_Element_Name,
+ ((ProcessState) node).getSubProcessDefinition().getName());
+ }
+
+ writeTransitions(element, node);
+ }
+
+ private void writeTransitions(Element element, org.jbpm.graph.def.Node node) {
+ if (node.getLeavingTransitionsMap() != null) {
+ Iterator<?> iter = node.getLeavingTransitionsList().iterator();
+ while (iter.hasNext()) {
+ Transition transition = (Transition) iter.next();
+ writeTransition(element
+ .addElement(B2JMessages.Jpdl_Transition_Element),
+ transition);
+ }
+ }
+ }
+
+ private void writeTransition(Element transitionElement,
+ Transition transition) {
+ if (transition.getTo() != null) {
+ transitionElement.addAttribute(B2JMessages.To, transition.getTo()
+ .getName());
+ }
+ if (transition.getName() != null) {
+ transitionElement.addAttribute(B2JMessages.Jpdl_Element_Name,
+ transition.getName());
+ }
+ }
+
+ private Element addElement(Element element, String elementName) {
+ Element newElement = element.addElement(elementName);
+ return newElement;
+ }
+
+ private void addAttribute(Element e, String attributeName, String value) {
+ if (value != null) {
+ e.addAttribute(attributeName, value);
+ }
+ }
+
+ private String getTypeName(Object o) {
+ return ProcessFactory.getTypeName((org.jbpm.graph.def.Node) o);
+ }
+
+ public void setWriter(Writer writer) {
+ this.writer = writer;
+ }
+
+}
Added: workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/translate/TranslateHelper.java
===================================================================
--- workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/translate/TranslateHelper.java (rev 0)
+++ workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/translate/TranslateHelper.java 2008-08-12 10:10:49 UTC (rev 9663)
@@ -0,0 +1,111 @@
+package org.jboss.tools.b2j.translate;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactory;
+import org.eclipse.stp.bpmn.BpmnDiagram;
+import org.eclipse.stp.bpmn.NamedBpmnObject;
+import org.jboss.tools.b2j.messages.B2JMessages;
+import org.jboss.tools.b2j.util.B2JUtil;
+import org.jbpm.graph.def.GraphElement;
+
+public class TranslateHelper {
+
+ static Map<String, Integer> nameMap = new HashMap<String, Integer>();
+
+ /*
+ * get a bpmn diagram from a bpmn file
+ */
+ public static BpmnDiagram getBpmnDiagram(IFile bpmnFile) throws IOException {
+ nameMap.clear();
+ GMFResourceFactory RESOURCE_FACTORY = new GMFResourceFactory();
+ ResourceSet resourceSet = new ResourceSetImpl();
+ resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap()
+ .put(B2JMessages.Bpmn_Suffix, RESOURCE_FACTORY);
+ URI uriBpmn = URI.createURI(B2JMessages.Workspace_Prefix
+ + bpmnFile.getFullPath());
+ Resource resBpmn = resourceSet.createResource(uriBpmn);
+ resBpmn.load(GMFResourceFactory.getDefaultLoadOptions());
+ return (BpmnDiagram) resBpmn.getContents().get(0);
+ }
+
+ public static IFile[] createJpdlFiles(IFile bpmnFile,
+ String[] strForProcessDefs, String[] jpdlFileNames)
+ throws CoreException {
+ IFolder jpdlFolder = B2JUtil.createFolder(bpmnFile.getParent(),
+ B2JMessages.Jpdl_Suffix);
+ IFolder diagramFolder = B2JUtil.createFolder(jpdlFolder, bpmnFile
+ .getName());
+
+ IFile[] jpdlFiles = new IFile[strForProcessDefs.length];
+ IFolder processFolder = null;
+ int i = 0;
+ ByteArrayInputStream bytes = null;
+ for (String str : strForProcessDefs) {
+ bytes = new ByteArrayInputStream(str.getBytes());
+ processFolder = B2JUtil.createFolder(diagramFolder,
+ jpdlFileNames[i]);
+ jpdlFiles[i] = B2JUtil.createFile(processFolder,
+ B2JMessages.Jpdl_Process_Definition_Name, bytes);
+ i++;
+ }
+ return jpdlFiles;
+ }
+
+ /*
+ * generate a process definition name. the name is composed of the names
+ * from bpmn diagram to the element
+ */
+ public static String generateProcessName(NamedBpmnObject graph) {
+ if (graph instanceof BpmnDiagram) {
+ return graph.getName();
+ } else {
+ String str = generateProcessName((NamedBpmnObject) graph
+ .eContainer());
+ if (str == null) {
+ return graph.getName();
+ } else {
+ return str + B2JMessages.Folder_Name_Separator
+ + graph.getName();
+ }
+ }
+
+ }
+
+ /*
+ * check the bpmn element name is null or "" or same to another element name
+ * and generate jpdl name
+ */
+ public static boolean check_mapElementName(NamedBpmnObject graph,
+ GraphElement graphEle) {
+
+ boolean isOk = false;
+ String name = graph.getName();
+ if (graph.getName() == null || "".equals(graph.getName())) {
+ name = "graph";
+ }
+ Integer i = nameMap.get(name);
+ if (i == null) {
+ graphEle.setName(name);
+ nameMap.put(name, new Integer("1"));
+ isOk = true;
+ } else {
+ graphEle.setName(name + "_" + i);
+ nameMap.put(name, ++i);
+ }
+
+ return isOk;
+
+ }
+
+}
Added: workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/util/B2JUtil.java
===================================================================
--- workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/util/B2JUtil.java (rev 0)
+++ workspace/grid/org.jboss.tools.bpmn2jpdl/src/org/jboss/tools/b2j/util/B2JUtil.java 2008-08-12 10:10:49 UTC (rev 9663)
@@ -0,0 +1,61 @@
+package org.jboss.tools.b2j.util;
+
+import java.io.InputStream;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Path;
+
+public class B2JUtil {
+
+ public static IFolder createFolder(IContainer parent, String folderName)
+ throws CoreException {
+ IResource child = parent.findMember(folderName);
+ if (child == null) {
+ IFolder folder = parent.getFolder(new Path(folderName));
+ folder.create(true, true, null);
+ return folder;
+ } else {
+ if (child.getType() == IResource.FOLDER) {
+ return (IFolder) child;
+ } else {
+ return null;
+ }
+ }
+ }
+
+ public static IFile createFile(IContainer parent, String fileName,
+ InputStream inputStream) throws CoreException {
+ IResource child = parent.findMember(fileName);
+
+ if (child != null) {
+ if (child.getType() == IResource.FILE) {
+
+ // We have permission to overwrite so check if file is read-only
+ if (child.getResourceAttributes() != null
+ && child.getResourceAttributes().isReadOnly()) {
+ IFile[] files = new IFile[1];
+ files[0] = (IFile) child;
+ }
+
+ // Change the contents of the existing file.
+ IFile file = parent.getFile(new Path(fileName));
+ file.setContents(inputStream, true, true, null);
+
+ return file;
+
+ } else {
+ return null;
+ }
+ } else {
+ // Create a new file.
+ IFile file = parent.getFile(new Path(fileName));
+ file.create(inputStream, true, null);
+ return file;
+ }
+ }
+
+}
17 years, 4 months
JBoss Tools SVN: r9662 - workspace.
by jbosstools-commits@lists.jboss.org
Author: Grid.Qian
Date: 2008-08-12 06:06:39 -0400 (Tue, 12 Aug 2008)
New Revision: 9662
Added:
workspace/grid/
Log:
create grid workspace
17 years, 4 months