JBoss Tools SVN: r10459 - documentation/trunk/movies/index/en.
by jbosstools-commits@lists.jboss.org
Author: smukhina
Date: 2008-09-24 11:33:33 -0400 (Wed, 24 Sep 2008)
New Revision: 10459
Modified:
documentation/trunk/movies/index/en/master.xml
Log:
https://jira.jboss.org/jira/browse/JBDS-426
new demo is added to the page
Modified: documentation/trunk/movies/index/en/master.xml
===================================================================
--- documentation/trunk/movies/index/en/master.xml 2008-09-24 15:20:10 UTC (rev 10458)
+++ documentation/trunk/movies/index/en/master.xml 2008-09-24 15:33:33 UTC (rev 10459)
@@ -63,6 +63,15 @@
</para>
<para>This demo covers a creation of a jsf application with simple content using the RichFaces components</para>
</listitem>
+
+ <listitem>
+ <para>
+ <ulink url="demos/edit_and_run_criteria/edit_and_run_criteria.htm">The movie shows the Criteria Editor in action</ulink>
+ </para>
+ <para>The demo explains how it be used for executing (almost) arbitrary java for quick manipulation/creation of persistent objects.</para>
+ </listitem>
+
+
</itemizedlist>
</index>
</book>
15 years, 8 months
JBoss Tools SVN: r10458 - trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template.
by jbosstools-commits@lists.jboss.org
Author: sdzmitrovich
Date: 2008-09-24 11:20:10 -0400 (Wed, 24 Sep 2008)
New Revision: 10458
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeVisualLinkCreator.java
Log:
corrected copying of "dir" attribute
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeVisualLinkCreator.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeVisualLinkCreator.java 2008-09-24 15:05:39 UTC (rev 10457)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeVisualLinkCreator.java 2008-09-24 15:20:10 UTC (rev 10458)
@@ -122,7 +122,7 @@
if (dirExpr != null) {
String dir = dirExpr.exec(pageContext, sourceNode).stringValue();
- a.setAttribute(HTML.ATTR_DIR, dirStr);
+ a.setAttribute(HTML.ATTR_DIR, dir);
}
if (styleExpr != null) {
15 years, 8 months
JBoss Tools SVN: r10457 - documentation/trunk/movies/index.
by jbosstools-commits@lists.jboss.org
Author: smukhina
Date: 2008-09-24 11:05:39 -0400 (Wed, 24 Sep 2008)
New Revision: 10457
Modified:
documentation/trunk/movies/index/pom.xml
Log:
https://jira.jboss.org/jira/browse/JBDS-426
movies index page is fixed
Modified: documentation/trunk/movies/index/pom.xml
===================================================================
--- documentation/trunk/movies/index/pom.xml 2008-09-24 14:40:07 UTC (rev 10456)
+++ documentation/trunk/movies/index/pom.xml 2008-09-24 15:05:39 UTC (rev 10457)
@@ -83,8 +83,8 @@
<properties>
- <stylesdir>../../jbosstools-docbook-xslt/src/main/resources/</stylesdir>
- <cssdir>../../jbosstools-jdocbook-style/src/main/org/css/</cssdir>
+ <stylesdir>../../trunk/documentation/jbosstools-docbook-xslt/src/main/resources/</stylesdir>
+ <cssdir>../../trunk/documentation/jbosstools-jdocbook-style/src/main/org/css/</cssdir>
<translation>en-US</translation>
</properties>
15 years, 8 months
JBoss Tools SVN: r10456 - in trunk: drools/plugins/org.jboss.tools.flow.ruleflow/META-INF and 10 other directories.
by jbosstools-commits@lists.jboss.org
Author: KrisVerlaenen
Date: 2008-09-24 10:40:07 -0400 (Wed, 24 Sep 2008)
New Revision: 10456
Added:
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/RuleFlowWrapperBuilder.java
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/model/
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/model/ConnectionImpl.java
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/model/NodeImpl.java
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/model/RuleFlowProcess.java
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/model/node/
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/model/node/StartNode.java
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/model/node/SubProcessNode.java
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/strategy/
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/strategy/EndNodeAcceptsOutgoingConnectionStrategy.java
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/strategy/ProcessAcceptsElementStrategy.java
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/strategy/SequenceNodeAcceptsIncomingConnectionStrategy.java
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/strategy/SequenceNodeAcceptsOutgoingConnectionStrategy.java
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/strategy/StartNodeAcceptsIncomingConnectionStrategy.java
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/xml/
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/xml/XmlRuleFlowProcessDumper.java
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/xml/XmlRuleFlowProcessReader.java
Removed:
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/core/
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/editpart/
Modified:
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/.classpath
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/META-INF/MANIFEST.MF
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/build.properties
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/plugin.xml
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/RuleFlowEditor.java
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/RuleFlowPaletteFactory.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editor/GenericModelEditor.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/registry/ElementRegistry.java
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/wrapper/DefaultNodeWrapper.java
Log:
Updated Drools Flow plugin to use new extension points
Modified: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/.classpath
===================================================================
--- trunk/drools/plugins/org.jboss.tools.flow.ruleflow/.classpath 2008-09-24 14:27:12 UTC (rev 10455)
+++ trunk/drools/plugins/org.jboss.tools.flow.ruleflow/.classpath 2008-09-24 14:40:07 UTC (rev 10456)
@@ -1,8 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
+ <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry exported="true" kind="lib" path="lib/antlr-runtime.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/core-3.2.3.v_686_R32x.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/mvel.jar"/>
<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/main/java"/>
- <classpathentry exported="true" kind="lib" path="lib/drools-core.jar" sourcepath="org.jboss.tools.process.ruleflowsrc.zip"/>
+ <classpathentry kind="lib" path="lib/drools-core.jar"/>
+ <classpathentry kind="lib" path="lib/drools-compiler.jar"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
Modified: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/META-INF/MANIFEST.MF
===================================================================
--- trunk/drools/plugins/org.jboss.tools.flow.ruleflow/META-INF/MANIFEST.MF 2008-09-24 14:27:12 UTC (rev 10455)
+++ trunk/drools/plugins/org.jboss.tools.flow.ruleflow/META-INF/MANIFEST.MF 2008-09-24 14:40:07 UTC (rev 10456)
@@ -14,5 +14,9 @@
org.jboss.tools.flow.common
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .,
- lib/drools-core.jar
+ lib/drools-core.jar,
+ lib/drools-compiler.jar,
+ lib/antlr-runtime.jar,
+ lib/core-3.2.3.v_686_R32x.jar,
+ lib/mvel.jar
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Modified: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/build.properties
===================================================================
--- trunk/drools/plugins/org.jboss.tools.flow.ruleflow/build.properties 2008-09-24 14:27:12 UTC (rev 10455)
+++ trunk/drools/plugins/org.jboss.tools.flow.ruleflow/build.properties 2008-09-24 14:40:07 UTC (rev 10456)
@@ -3,4 +3,8 @@
bin.includes = META-INF/,\
.,\
plugin.xml,\
- lib/drools-core.jar
+ lib/drools-core.jar,\
+ lib/drools-compiler.jar,\
+ lib/antlr-runtime.jar,\
+ lib/core-3.2.3.v_686_R32x.jar,\
+ lib/mvel.jar
Modified: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/plugin.xml
===================================================================
--- trunk/drools/plugins/org.jboss.tools.flow.ruleflow/plugin.xml 2008-09-24 14:27:12 UTC (rev 10455)
+++ trunk/drools/plugins/org.jboss.tools.flow.ruleflow/plugin.xml 2008-09-24 14:40:07 UTC (rev 10456)
@@ -13,4 +13,58 @@
</editor>
</extension>
+ <extension point="org.jboss.tools.flow.common.languages">
+ <language
+ editor="org.jboss.tools.flow.ruleflow.editor"
+ id="org.jboss.tools.flow.ruleflow"
+ name="Drools Flow">
+ </language>
+ </extension>
+
+ <extension point="org.jboss.tools.flow.common.elements">
+ <element
+ class="org.jboss.tools.process.ruleflow.model.RuleFlowProcess"
+ figure="icons/process.gif"
+ id="org.jboss.tools.flow.ruleflow.process"
+ language="org.jboss.tools.flow.ruleflow"
+ name="Process">
+ <flow acceptsElementStrategy="org.jboss.tools.process.ruleflow.strategy.ProcessAcceptsElementStrategy" />
+ </element>
+ <element
+ class="org.jboss.tools.process.ruleflow.model.node.StartNode"
+ figure="icons/start.gif"
+ id="org.jboss.tools.flow.ruleflow.start"
+ language="org.jboss.tools.flow.ruleflow"
+ name="Start">
+ <node acceptsIncomingConnectionStrategy="org.jboss.tools.process.ruleflow.strategy.StartNodeAcceptsIncomingConnectionStrategy"
+ acceptsOutgoingConnectionStrategy="org.jboss.tools.process.ruleflow.strategy.SequenceNodeAcceptsOutgoingConnectionStrategy">
+ <figure icon="icons/start.gif">
+ <rectangle></rectangle>
+ </figure>
+ </node>
+ </element>
+ <element
+ class="org.jboss.tools.process.ruleflow.model.node.SubProcessNode"
+ figure="icons/process.gif"
+ id="org.jboss.tools.flow.ruleflow.subProcess"
+ language="org.jboss.tools.flow.ruleflow"
+ name="SubProcess">
+ <node acceptsIncomingConnectionStrategy="org.jboss.tools.process.ruleflow.strategy.SequenceNodeAcceptsIncomingConnectionStrategy"
+ acceptsOutgoingConnectionStrategy="org.jboss.tools.process.ruleflow.strategy.SequenceNodeAcceptsOutgoingConnectionStrategy">
+ <figure color="255,250,205" icon="icons/process.gif">
+ <rounded-rectangle></rounded-rectangle>
+ </figure>
+ </node>
+ </element>
+ <element
+ class="org.jboss.tools.process.ruleflow.model.ConnectionImpl"
+ figure="icons/connection.gif"
+ id="org.jboss.tools.flow.ruleflow.connection"
+ language="org.jboss.tools.flow.ruleflow"
+ name="Connection">
+ <connection>
+ </connection>
+ </element>
+ </extension>
+
</plugin>
Modified: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/RuleFlowEditor.java
===================================================================
--- trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/RuleFlowEditor.java 2008-09-24 14:27:12 UTC (rev 10455)
+++ trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/RuleFlowEditor.java 2008-09-24 14:40:07 UTC (rev 10456)
@@ -18,17 +18,18 @@
import java.io.IOException;
import java.io.InputStream;
+import java.io.InputStreamReader;
import java.io.OutputStream;
+import java.io.OutputStreamWriter;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.EditPartFactory;
import org.eclipse.gef.palette.PaletteRoot;
-import org.eclipse.ui.IFileEditorInput;
+import org.jboss.tools.flow.common.Activator;
import org.jboss.tools.flow.common.editor.GenericModelEditor;
-import org.jboss.tools.process.ruleflow.editor.core.ProcessWrapper;
-import org.jboss.tools.process.ruleflow.editor.core.StartNodeWrapper;
-import org.jboss.tools.process.ruleflow.editor.editpart.RuleFlowEditPartFactory;
+import org.jboss.tools.flow.common.registry.ElementRegistry;
+import org.jboss.tools.flow.common.wrapper.AbstractFlowWrapper;
+import org.jboss.tools.process.ruleflow.model.RuleFlowProcess;
+import org.jboss.tools.process.ruleflow.xml.XmlRuleFlowProcessDumper;
+import org.jboss.tools.process.ruleflow.xml.XmlRuleFlowProcessReader;
/**
* Graphical editor for a RuleFlow.
@@ -37,35 +38,45 @@
*/
public class RuleFlowEditor extends GenericModelEditor {
- protected EditPartFactory createEditPartFactory() {
- return new RuleFlowEditPartFactory();
- }
-
protected PaletteRoot createPalette() {
return new RuleFlowPaletteFactory().createPalette();
}
protected Object createModel() {
- ProcessWrapper result = new ProcessWrapper();
- StartNodeWrapper start = new StartNodeWrapper();
- start.setConstraint(new Rectangle(100, 100, -1, -1));
- result.addElement(start);
- IFile file = ((IFileEditorInput) getEditorInput()).getFile();
- String name = file.getName();
- result.setName(name.substring(0, name.length() - 3));
- return result;
+ return ElementRegistry.createWrapper("org.jboss.tools.flow.ruleflow.process");
}
- public ProcessWrapper getRuleFlowModel() {
- return (ProcessWrapper) getModel();
- }
-
protected void writeModel(OutputStream os) throws IOException {
- // TODO
+ OutputStreamWriter writer = new OutputStreamWriter(os);
+ try {
+ RuleFlowProcess process = (RuleFlowProcess) ((AbstractFlowWrapper) getModel()).getElement();
+ String out = XmlRuleFlowProcessDumper.dump(process);
+ writer.write(out);
+ } catch (Throwable t) {
+ Activator.log(t);
+ }
+ writer.close();
}
protected void createModel(InputStream is) {
- // TODO
- setModel(createModel());
+ try {
+ InputStreamReader reader = new InputStreamReader(is);
+ XmlRuleFlowProcessReader xmlReader = new XmlRuleFlowProcessReader();
+ try {
+ RuleFlowProcess process = (RuleFlowProcess) xmlReader.read(reader);
+ if (process == null) {
+ setModel(createModel());
+ } else {
+ setModel(new RuleFlowWrapperBuilder().getProcessWrapper(process));
+ }
+ } catch (Throwable t) {
+ Activator.log(t);
+ setModel(createModel());
+ }
+ reader.close();
+ } catch (Throwable t) {
+ Activator.log(t);
+ }
}
+
}
Modified: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/RuleFlowPaletteFactory.java
===================================================================
--- trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/RuleFlowPaletteFactory.java 2008-09-24 14:27:12 UTC (rev 10455)
+++ trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/RuleFlowPaletteFactory.java 2008-09-24 14:40:07 UTC (rev 10456)
@@ -24,13 +24,10 @@
import org.eclipse.gef.palette.PaletteContainer;
import org.eclipse.gef.palette.PaletteEntry;
import org.eclipse.gef.palette.PaletteRoot;
-import org.eclipse.gef.requests.SimpleFactory;
import org.eclipse.jface.resource.ImageDescriptor;
import org.jboss.tools.flow.common.editor.PaletteFactory;
+import org.jboss.tools.flow.common.registry.ElementRegistry;
import org.jboss.tools.process.ruleflow.Activator;
-import org.jboss.tools.process.ruleflow.editor.core.BaseConnectionWrapper;
-import org.jboss.tools.process.ruleflow.editor.core.StartNodeWrapper;
-import org.jboss.tools.process.ruleflow.editor.core.SubProcessWrapper;
/**
* Factory for creating a RuleFlow palette.
@@ -46,13 +43,13 @@
}
protected PaletteEntry createConnectionEntry() {
- return new ConnectionCreationToolEntry(
- "Connection Creation",
- "Creating connections",
- new SimpleFactory(BaseConnectionWrapper.class),
- ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/connection.gif")),
- ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/connection.gif"))
- );
+ return new ConnectionCreationToolEntry(
+ "Connection",
+ "Creating a new connection",
+ ElementRegistry.getCreationFactory("org.jboss.tools.flow.ruleflow.connection"),
+ ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/connection.gif")),
+ ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/connection.gif"))
+ );
}
protected List<PaletteEntry> createComponentEntries() {
@@ -60,9 +57,9 @@
CombinedTemplateCreationEntry combined = new CombinedTemplateCreationEntry(
"Start",
- "Create a new Start",
- StartNodeWrapper.class,
- new SimpleFactory(StartNodeWrapper.class),
+ "Create a new start node",
+ "org.jboss.tools.flow.ruleflow.start",
+ ElementRegistry.getCreationFactory("org.jboss.tools.flow.ruleflow.start"),
ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/start.gif")),
ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/start.gif"))
);
@@ -70,14 +67,14 @@
combined = new CombinedTemplateCreationEntry(
"SubProcess",
- "Create a new sub-process",
- SubProcessWrapper.class,
- new SimpleFactory(SubProcessWrapper.class),
+ "Create a new sub process node",
+ "org.jboss.tools.flow.ruleflow.subProcess",
+ ElementRegistry.getCreationFactory("org.jboss.tools.flow.ruleflow.subProcess"),
ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/process.gif")),
ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/process.gif"))
);
entries.add(combined);
-
+
return entries;
}
Added: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/RuleFlowWrapperBuilder.java
===================================================================
--- trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/RuleFlowWrapperBuilder.java (rev 0)
+++ trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/RuleFlowWrapperBuilder.java 2008-09-24 14:40:07 UTC (rev 10456)
@@ -0,0 +1,68 @@
+package org.jboss.tools.process.ruleflow.editor;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.tools.flow.common.model.Connection;
+import org.jboss.tools.flow.common.model.Flow;
+import org.jboss.tools.flow.common.model.Node;
+import org.jboss.tools.flow.common.wrapper.DefaultConnectionWrapper;
+import org.jboss.tools.flow.common.wrapper.DefaultFlowWrapper;
+import org.jboss.tools.flow.common.wrapper.DefaultNodeWrapper;
+import org.jboss.tools.flow.common.wrapper.NodeWrapper;
+import org.jboss.tools.process.ruleflow.model.RuleFlowProcess;
+
+public class RuleFlowWrapperBuilder {
+
+ public DefaultFlowWrapper getProcessWrapper(Flow process) {
+ if (process instanceof RuleFlowProcess) {
+ RuleFlowProcess ruleFlowProcess = (RuleFlowProcess) process;
+ DefaultFlowWrapper processWrapper = new DefaultFlowWrapper();
+ processWrapper.setElement(process);
+ Set<Node> nodes = new HashSet<Node>();
+ nodes.addAll(ruleFlowProcess.getNodes());
+ Set<Connection> connections = new HashSet<Connection>();
+ processNodes(nodes, connections, processWrapper);
+ return processWrapper;
+ }
+ return null;
+ }
+
+ public static void processNodes(Set<Node> nodes, Set<Connection> connections, DefaultFlowWrapper container) {
+ Map<Node, NodeWrapper> nodeWrappers = new HashMap<Node, NodeWrapper>();
+ for (Node node: nodes) {
+ NodeWrapper nodeWrapper = new DefaultNodeWrapper();
+ nodeWrapper.setElement(node);
+ nodeWrapper.setParent(container);
+ container.localAddElement(nodeWrapper);
+ nodeWrappers.put(node, nodeWrapper);
+ for (List<Connection> inConnections: node.getIncomingConnections().values()) {
+ for (Connection connection: inConnections) {
+ connections.add(connection);
+ }
+ }
+ for (List<Connection> outConnections: node.getOutgoingConnections().values()) {
+ for (Connection connection: outConnections) {
+ connections.add(connection);
+ }
+ }
+ }
+ for (Connection connection: connections) {
+ DefaultConnectionWrapper connectionWrapper = new DefaultConnectionWrapper();
+ connectionWrapper.setElement(connection);
+ connectionWrapper.localSetBendpoints(null);
+ NodeWrapper from = nodeWrappers.get(connection.getFrom());
+ NodeWrapper to = nodeWrappers.get(connection.getTo());
+ if (from != null && to != null) {
+ connectionWrapper.localSetSource(from);
+ from.localAddOutgoingConnection(connectionWrapper);
+ connectionWrapper.localSetTarget(to);
+ to.localAddIncomingConnection(connectionWrapper);
+ }
+ }
+ }
+
+}
Added: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/model/ConnectionImpl.java
===================================================================
--- trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/model/ConnectionImpl.java (rev 0)
+++ trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/model/ConnectionImpl.java 2008-09-24 14:40:07 UTC (rev 10456)
@@ -0,0 +1,98 @@
+package org.jboss.tools.process.ruleflow.model;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.tools.flow.common.model.Connection;
+import org.jboss.tools.flow.common.model.Node;
+import org.jboss.tools.flow.common.registry.ElementRegistry;
+
+public class ConnectionImpl implements Connection {
+
+ private org.drools.workflow.core.impl.ConnectionImpl connection;
+
+ private Node from;
+ private Node to;
+ private Map<String, Object> metaData = new HashMap<String, Object>();
+
+ public ConnectionImpl() {
+ }
+
+ public ConnectionImpl(Node from, String fromType, Node to, String toType) {
+ this.from = from;
+ this.to = to;
+ this.connection = new org.drools.workflow.core.impl.ConnectionImpl(
+ ((NodeImpl) from).getNode(), fromType,
+ ((NodeImpl) to).getNode(), toType);
+ }
+
+ public ConnectionImpl(org.drools.workflow.core.Connection connection, Node from, Node to) {
+ this.connection = (org.drools.workflow.core.impl.ConnectionImpl) connection;
+ // TODO XML should contain this meta-data
+ setMetaData("configurationElement",
+ ElementRegistry.getConfigurationElement("org.jboss.tools.flow.ruleflow.connection"));
+ this.from = from;
+ this.to = to;
+ }
+
+ public org.drools.workflow.core.Connection getConnection() {
+ return connection;
+ }
+
+ public Node getFrom() {
+ return from;
+ }
+
+ public void setFrom(Node from) {
+ if (connection != null) {
+ connection.terminate();
+ connection = null;
+ }
+ this.from = from;
+ if (from != null && to != null) {
+ connection = new org.drools.workflow.core.impl.ConnectionImpl(
+ ((NodeImpl) from).getNode(), org.drools.workflow.core.Node.CONNECTION_DEFAULT_TYPE,
+ ((NodeImpl) to).getNode(), org.drools.workflow.core.Node.CONNECTION_DEFAULT_TYPE);
+ for (Map.Entry<String, Object> entry: metaData.entrySet()) {
+ connection.setMetaData(entry.getKey(), entry.getValue());
+ }
+ }
+ }
+
+ public String getFromType() {
+ return connection == null ? null : connection.getFromType();
+ }
+
+ public Node getTo() {
+ return to;
+ }
+
+ public void setTo(Node to) {
+ if (connection != null) {
+ connection.terminate();
+ connection = null;
+ }
+ this.to = to;
+ if (from != null && to != null) {
+ connection = new org.drools.workflow.core.impl.ConnectionImpl(
+ ((NodeImpl) from).getNode(), org.drools.workflow.core.Node.CONNECTION_DEFAULT_TYPE,
+ ((NodeImpl) to).getNode(), org.drools.workflow.core.Node.CONNECTION_DEFAULT_TYPE);
+ }
+ }
+
+ public String getToType() {
+ return connection == null ? null : connection.getToType();
+ }
+
+ public Object getMetaData(String name) {
+ return metaData.get(name);
+ }
+
+ public void setMetaData(String name, Object value) {
+ metaData.put(name, value);
+ if (connection != null) {
+ connection.setMetaData(name, value);
+ }
+ }
+
+}
Added: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/model/NodeImpl.java
===================================================================
--- trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/model/NodeImpl.java (rev 0)
+++ trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/model/NodeImpl.java 2008-09-24 14:40:07 UTC (rev 10456)
@@ -0,0 +1,126 @@
+package org.jboss.tools.process.ruleflow.model;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.tools.flow.common.model.Connection;
+import org.jboss.tools.flow.common.model.Container;
+import org.jboss.tools.flow.common.model.Node;
+
+public class NodeImpl implements Node {
+
+ private org.drools.workflow.core.Node node;
+
+ private Container nodeContainer;
+ private Map<String, List<Connection>> incomingConnections = new HashMap<String, List<Connection>>();
+ private Map<String, List<Connection>> outgoingConnections = new HashMap<String, List<Connection>>();
+
+ public NodeImpl(org.drools.workflow.core.Node node) {
+ this.node = node;
+ }
+
+ public org.drools.workflow.core.Node getNode() {
+ return node;
+ }
+
+ public void addIncomingConnection(String type, Connection connection) {
+ internalAddIncomingConnection(type, connection);
+ node.addIncomingConnection(type, ((ConnectionImpl) connection).getConnection());
+ }
+
+ public void internalAddIncomingConnection(String type, Connection connection) {
+ List<Connection> list = incomingConnections.get(type);
+ if (list == null) {
+ list = new ArrayList<Connection>();
+ incomingConnections.put(type, list);
+ }
+ list.add(connection);
+ }
+
+ public void addOutgoingConnection(String type, Connection connection) {
+ internalAddOutgoingConnection(type, connection);
+ node.addOutgoingConnection(type, ((ConnectionImpl) connection).getConnection());
+ }
+
+ public void internalAddOutgoingConnection(String type, Connection connection) {
+ List<Connection> list = outgoingConnections.get(type);
+ if (list == null) {
+ list = new ArrayList<Connection>();
+ outgoingConnections.put(type, list);
+ }
+ list.add(connection);
+ }
+
+ public long getId() {
+ return node.getId();
+ }
+
+ public Map<String, List<Connection>> getIncomingConnections() {
+ return incomingConnections;
+ }
+
+ public List<Connection> getIncomingConnections(String type) {
+ return incomingConnections.get(type);
+ }
+
+ public Object getMetaData(String name) {
+ return node.getMetaData(name);
+ }
+
+ public String getName() {
+ return node.getName();
+ }
+
+ public Container getNodeContainer() {
+ return nodeContainer;
+ }
+
+ public Map<String, List<Connection>> getOutgoingConnections() {
+ return outgoingConnections;
+ }
+
+ public List<Connection> getOutgoingConnections(String type) {
+ return outgoingConnections.get(type);
+ }
+
+ public void removeIncomingConnection(String type, Connection connection) {
+ List<Connection> list = incomingConnections.get(type);
+ if (list != null) {
+ list.remove(connection);
+ if (list.isEmpty()) {
+ incomingConnections.remove(type);
+ }
+ }
+ node.removeIncomingConnection(type, ((ConnectionImpl) connection).getConnection());
+ }
+
+ public void removeOutgoingConnection(String type, Connection connection) {
+ List<Connection> list = outgoingConnections.get(type);
+ if (list != null) {
+ list.remove(connection);
+ if (list.isEmpty()) {
+ outgoingConnections.remove(type);
+ }
+ }
+ node.removeOutgoingConnection(type, ((ConnectionImpl) connection).getConnection());
+ }
+
+ public void setId(long id) {
+ node.setId(id);
+ }
+
+ public void setMetaData(String name, Object value) {
+ node.setMetaData(name, value);
+ }
+
+ public void setName(String name) {
+ node.setName(name);
+ }
+
+ public void setNodeContainer(Container nodeContainer) {
+ this.nodeContainer = nodeContainer;
+ node.setNodeContainer(((RuleFlowProcess) nodeContainer).getRuleFlowProcess());
+ }
+}
Added: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/model/RuleFlowProcess.java
===================================================================
--- trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/model/RuleFlowProcess.java (rev 0)
+++ trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/model/RuleFlowProcess.java 2008-09-24 14:40:07 UTC (rev 10456)
@@ -0,0 +1,134 @@
+package org.jboss.tools.process.ruleflow.model;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.tools.flow.common.model.Flow;
+import org.jboss.tools.flow.common.model.Node;
+import org.jboss.tools.flow.common.registry.ElementRegistry;
+import org.jboss.tools.process.ruleflow.model.node.StartNode;
+import org.jboss.tools.process.ruleflow.model.node.SubProcessNode;
+
+public class RuleFlowProcess implements Flow {
+
+ private org.drools.ruleflow.core.RuleFlowProcess process;
+
+ private Map<Long, Node> nodes = new HashMap<Long, Node>();
+
+ public RuleFlowProcess() {
+ this.process = new org.drools.ruleflow.core.RuleFlowProcess();
+ }
+
+ public RuleFlowProcess(org.drools.ruleflow.core.RuleFlowProcess process) {
+ this.process = process;
+ // TODO XML should contain this meta-data
+ setMetaData("configurationElement",
+ ElementRegistry.getConfigurationElement("org.jboss.tools.flow.ruleflow.process"));
+ List<org.drools.workflow.core.Connection> connections = new ArrayList<org.drools.workflow.core.Connection>();
+ for (org.drools.workflow.core.Node node: process.getNodes()) {
+ Node newNode = null;
+ if (node instanceof org.drools.workflow.core.node.StartNode) {
+ newNode = new StartNode((org.drools.workflow.core.node.StartNode) node);
+ } else if (node instanceof org.drools.workflow.core.node.SubProcessNode) {
+ newNode = new SubProcessNode((org.drools.workflow.core.node.SubProcessNode) node);
+ }
+ if (newNode == null) {
+ throw new IllegalArgumentException("Could not find NodeImpl for node " + newNode);
+ }
+ this.nodes.put(node.getId(), newNode);
+ for (List<org.drools.workflow.core.Connection> inConnections: node.getIncomingConnections().values()) {
+ for (org.drools.workflow.core.Connection connection: inConnections) {
+ connections.add(connection);
+ }
+ }
+ }
+ for (org.drools.workflow.core.Connection connection: connections) {
+ NodeImpl from = (NodeImpl) nodes.get(connection.getFrom().getId());
+ NodeImpl to = (NodeImpl) nodes.get(connection.getTo().getId());
+ ConnectionImpl newConnection = new ConnectionImpl(connection, from, to);
+ from.internalAddOutgoingConnection(connection.getFromType(), newConnection);
+ to.internalAddIncomingConnection(connection.getToType(), newConnection);
+ }
+ }
+
+ public org.drools.ruleflow.core.RuleFlowProcess getRuleFlowProcess() {
+ return process;
+ }
+
+ public String getId() {
+ return process.getId();
+ }
+
+ public String getName() {
+ return process.getName();
+ }
+
+ public String getPackageName() {
+ return process.getPackageName();
+ }
+
+ public String getType() {
+ return process.getType();
+ }
+
+ public String getVersion() {
+ return process.getVersion();
+ }
+
+ public void setId(String id) {
+ process.setId(id);
+ }
+
+ public void setName(String name) {
+ process.setName(name);
+ }
+
+ public void setPackageName(String packageName) {
+ process.setPackageName(packageName);
+ }
+
+ public void setType(String type) {
+ process.setType(type);
+ }
+
+ public void setVersion(String version) {
+ process.setVersion(version);
+ }
+
+ public void addNode(Node node) {
+ nodes.put(node.getId(), node);
+ process.addNode(((NodeImpl) node).getNode());
+ }
+
+ public Node getNode(long id) {
+ return nodes.get(id);
+ }
+
+ public List<Node> getNodes() {
+ return new ArrayList<Node>(nodes.values());
+ }
+
+ public void removeNode(Node node) {
+ nodes.remove(node.getId());
+ process.removeNode(((NodeImpl) node).getNode());
+ }
+
+ public Object getMetaData(String name) {
+ return process.getMetaData(name);
+ }
+
+ public void setMetaData(String name, Object value) {
+ process.setMetaData(name, value);
+ }
+
+ public StartNode getStart() {
+ org.drools.workflow.core.node.StartNode start = process.getStart();
+ if (start == null) {
+ return null;
+ }
+ return (StartNode) nodes.get(start.getId());
+ }
+
+}
Added: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/model/node/StartNode.java
===================================================================
--- trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/model/node/StartNode.java (rev 0)
+++ trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/model/node/StartNode.java 2008-09-24 14:40:07 UTC (rev 10456)
@@ -0,0 +1,19 @@
+package org.jboss.tools.process.ruleflow.model.node;
+
+import org.jboss.tools.flow.common.registry.ElementRegistry;
+import org.jboss.tools.process.ruleflow.model.NodeImpl;
+
+public class StartNode extends NodeImpl {
+
+ public StartNode() {
+ super(new org.drools.workflow.core.node.StartNode());
+ }
+
+ public StartNode(org.drools.workflow.core.node.StartNode node) {
+ super(node);
+ // TODO XML should contain this meta-data
+ setMetaData("configurationElement",
+ ElementRegistry.getConfigurationElement("org.jboss.tools.flow.ruleflow.start"));
+ }
+
+}
Added: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/model/node/SubProcessNode.java
===================================================================
--- trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/model/node/SubProcessNode.java (rev 0)
+++ trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/model/node/SubProcessNode.java 2008-09-24 14:40:07 UTC (rev 10456)
@@ -0,0 +1,19 @@
+package org.jboss.tools.process.ruleflow.model.node;
+
+import org.jboss.tools.flow.common.registry.ElementRegistry;
+import org.jboss.tools.process.ruleflow.model.NodeImpl;
+
+public class SubProcessNode extends NodeImpl {
+
+ public SubProcessNode() {
+ super(new org.drools.workflow.core.node.SubProcessNode());
+ }
+
+ public SubProcessNode(org.drools.workflow.core.node.SubProcessNode node) {
+ super(node);
+ // TODO XML should contain this meta-data
+ setMetaData("configurationElement",
+ ElementRegistry.getConfigurationElement("org.jboss.tools.flow.ruleflow.subProcess"));
+ }
+
+}
Added: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/strategy/EndNodeAcceptsOutgoingConnectionStrategy.java
===================================================================
--- trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/strategy/EndNodeAcceptsOutgoingConnectionStrategy.java (rev 0)
+++ trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/strategy/EndNodeAcceptsOutgoingConnectionStrategy.java 2008-09-24 14:40:07 UTC (rev 10456)
@@ -0,0 +1,16 @@
+package org.jboss.tools.process.ruleflow.strategy;
+
+import org.jboss.tools.flow.common.model.Connection;
+import org.jboss.tools.flow.common.model.Node;
+import org.jboss.tools.flow.common.strategy.AcceptsOutgoingConnectionStrategy;
+
+public class EndNodeAcceptsOutgoingConnectionStrategy implements AcceptsOutgoingConnectionStrategy {
+
+ public boolean acceptsOutgoingConnection(Connection connection, Node source) {
+ return false;
+ }
+
+ public void setNode(Node node) {
+ }
+
+}
Added: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/strategy/ProcessAcceptsElementStrategy.java
===================================================================
--- trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/strategy/ProcessAcceptsElementStrategy.java (rev 0)
+++ trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/strategy/ProcessAcceptsElementStrategy.java 2008-09-24 14:40:07 UTC (rev 10456)
@@ -0,0 +1,28 @@
+package org.jboss.tools.process.ruleflow.strategy;
+
+import org.jboss.tools.flow.common.model.Container;
+import org.jboss.tools.flow.common.strategy.AcceptsElementStrategy;
+import org.jboss.tools.process.ruleflow.model.RuleFlowProcess;
+import org.jboss.tools.process.ruleflow.model.node.StartNode;
+
+public class ProcessAcceptsElementStrategy implements AcceptsElementStrategy {
+
+ private RuleFlowProcess process;
+
+ public boolean acceptsElement(Object element) {
+ if (process == null) {
+ return false;
+ } else if (element instanceof StartNode) {
+ return process.getStart() == null;
+ } else {
+ return true;
+ }
+ }
+
+ public void setContainer(Container container) {
+ if (container instanceof RuleFlowProcess) {
+ this.process = (RuleFlowProcess) container;
+ }
+ }
+
+}
Added: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/strategy/SequenceNodeAcceptsIncomingConnectionStrategy.java
===================================================================
--- trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/strategy/SequenceNodeAcceptsIncomingConnectionStrategy.java (rev 0)
+++ trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/strategy/SequenceNodeAcceptsIncomingConnectionStrategy.java 2008-09-24 14:40:07 UTC (rev 10456)
@@ -0,0 +1,22 @@
+package org.jboss.tools.process.ruleflow.strategy;
+
+import org.jboss.tools.flow.common.model.Connection;
+import org.jboss.tools.flow.common.model.Node;
+import org.jboss.tools.flow.common.strategy.AcceptsIncomingConnectionStrategy;
+
+public class SequenceNodeAcceptsIncomingConnectionStrategy implements AcceptsIncomingConnectionStrategy {
+
+ private Node node;
+
+ public boolean acceptsIncomingConnection(Connection connection, Node source) {
+ return
+ (source == null
+ || source.getNodeContainer() == node.getNodeContainer())
+ && node.getIncomingConnections().isEmpty();
+ }
+
+ public void setNode(Node node) {
+ this.node = node;
+ }
+
+}
Added: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/strategy/SequenceNodeAcceptsOutgoingConnectionStrategy.java
===================================================================
--- trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/strategy/SequenceNodeAcceptsOutgoingConnectionStrategy.java (rev 0)
+++ trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/strategy/SequenceNodeAcceptsOutgoingConnectionStrategy.java 2008-09-24 14:40:07 UTC (rev 10456)
@@ -0,0 +1,22 @@
+package org.jboss.tools.process.ruleflow.strategy;
+
+import org.jboss.tools.flow.common.model.Connection;
+import org.jboss.tools.flow.common.model.Node;
+import org.jboss.tools.flow.common.strategy.AcceptsOutgoingConnectionStrategy;
+
+public class SequenceNodeAcceptsOutgoingConnectionStrategy implements AcceptsOutgoingConnectionStrategy {
+
+ private Node node;
+
+ public boolean acceptsOutgoingConnection(Connection connection, Node target) {
+ return
+ (target == null
+ || target.getNodeContainer() == node.getNodeContainer())
+ && node.getOutgoingConnections().isEmpty();
+ }
+
+ public void setNode(Node node) {
+ this.node = node;
+ }
+
+}
Added: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/strategy/StartNodeAcceptsIncomingConnectionStrategy.java
===================================================================
--- trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/strategy/StartNodeAcceptsIncomingConnectionStrategy.java (rev 0)
+++ trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/strategy/StartNodeAcceptsIncomingConnectionStrategy.java 2008-09-24 14:40:07 UTC (rev 10456)
@@ -0,0 +1,16 @@
+package org.jboss.tools.process.ruleflow.strategy;
+
+import org.jboss.tools.flow.common.model.Connection;
+import org.jboss.tools.flow.common.model.Node;
+import org.jboss.tools.flow.common.strategy.AcceptsIncomingConnectionStrategy;
+
+public class StartNodeAcceptsIncomingConnectionStrategy implements AcceptsIncomingConnectionStrategy {
+
+ public boolean acceptsIncomingConnection(Connection connection, Node source) {
+ return false;
+ }
+
+ public void setNode(Node node) {
+ }
+
+}
Added: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/xml/XmlRuleFlowProcessDumper.java
===================================================================
--- trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/xml/XmlRuleFlowProcessDumper.java (rev 0)
+++ trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/xml/XmlRuleFlowProcessDumper.java 2008-09-24 14:40:07 UTC (rev 10456)
@@ -0,0 +1,11 @@
+package org.jboss.tools.process.ruleflow.xml;
+
+import org.jboss.tools.process.ruleflow.model.RuleFlowProcess;
+
+public class XmlRuleFlowProcessDumper {
+
+ public static String dump(RuleFlowProcess process) {
+ return org.drools.xml.XmlRuleFlowProcessDumper.INSTANCE.dump(process.getRuleFlowProcess(), true);
+ }
+
+}
Added: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/xml/XmlRuleFlowProcessReader.java
===================================================================
--- trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/xml/XmlRuleFlowProcessReader.java (rev 0)
+++ trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/xml/XmlRuleFlowProcessReader.java 2008-09-24 14:40:07 UTC (rev 10456)
@@ -0,0 +1,24 @@
+package org.jboss.tools.process.ruleflow.xml;
+
+import java.io.Reader;
+
+import org.drools.compiler.PackageBuilderConfiguration;
+import org.drools.xml.XmlProcessReader;
+import org.jboss.tools.process.ruleflow.model.RuleFlowProcess;
+
+public class XmlRuleFlowProcessReader {
+
+ private XmlProcessReader processReader;
+
+ public XmlRuleFlowProcessReader() {
+ PackageBuilderConfiguration configuration = new PackageBuilderConfiguration();
+ processReader = new XmlProcessReader(configuration.getSemanticModules());
+ }
+
+ public RuleFlowProcess read(Reader reader) throws Exception {
+ org.drools.ruleflow.core.RuleFlowProcess process =
+ (org.drools.ruleflow.core.RuleFlowProcess) processReader.read(reader);
+ return new RuleFlowProcess(process);
+ }
+
+}
Modified: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editor/GenericModelEditor.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editor/GenericModelEditor.java 2008-09-24 14:27:12 UTC (rev 10455)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editor/GenericModelEditor.java 2008-09-24 14:40:07 UTC (rev 10456)
@@ -73,6 +73,7 @@
import org.jboss.tools.flow.common.Activator;
import org.jboss.tools.flow.common.action.HorizontalAutoLayoutAction;
import org.jboss.tools.flow.common.action.VerticalAutoLayoutAction;
+import org.jboss.tools.flow.common.editpart.DefaultEditPartFactory;
import org.jboss.tools.flow.common.registry.LanguageRegistry;
/**
@@ -203,7 +204,9 @@
getGraphicalViewer());
}
- protected abstract EditPartFactory createEditPartFactory();
+ protected EditPartFactory createEditPartFactory() {
+ return new DefaultEditPartFactory();
+ }
protected void initializeGraphicalViewer() {
getGraphicalViewer().setContents(model);
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-09-24 14:27:12 UTC (rev 10455)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Container.java 2008-09-24 14:40:07 UTC (rev 10456)
@@ -7,7 +7,7 @@
*
* @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
*/
-public interface Container extends Element {
+public interface Container {
/**
* Returns the nodes of this node container.
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-09-24 14:27:12 UTC (rev 10455)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/model/Flow.java 2008-09-24 14:40:07 UTC (rev 10456)
@@ -25,7 +25,7 @@
*
* @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
*/
-public interface Flow extends Container {
+public interface Flow extends Container, Element {
/**
* Sets the id of this process.
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-09-24 14:27:12 UTC (rev 10455)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/registry/ElementRegistry.java 2008-09-24 14:40:07 UTC (rev 10456)
@@ -120,7 +120,7 @@
Logger.logError(message, new RuntimeException(message));
return null;
}
- ((Container)element).setMetaData("configurationElement", configurationElement);
+ ((Element) element).setMetaData("configurationElement", configurationElement);
DefaultContainerWrapper result = new DefaultContainerWrapper();
result.setElement(element);
AcceptsElementStrategy acceptsElementStrategy = createAcceptsElementStrategy(configurationElement);
@@ -182,7 +182,7 @@
Logger.logError(message, new RuntimeException(message));
return null;
}
- ((Container)element).setMetaData("configurationElement", configurationElement);
+ ((Element) element).setMetaData("configurationElement", configurationElement);
DefaultFlowWrapper result = new DefaultFlowWrapper();
result.setElement(element);
AcceptsElementStrategy acceptsElementStrategy = createAcceptsElementStrategy(configurationElement);
@@ -325,6 +325,10 @@
}
}
+ public static IConfigurationElement getConfigurationElement(String elementId) {
+ return elementMap.get(elementId);
+ }
+
public static CreationFactory getCreationFactory(final String elementId) {
return new CreationFactory() {
public Object getNewObject() {
Modified: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/wrapper/DefaultNodeWrapper.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/wrapper/DefaultNodeWrapper.java 2008-09-24 14:27:12 UTC (rev 10455)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/wrapper/DefaultNodeWrapper.java 2008-09-24 14:40:07 UTC (rev 10456)
@@ -84,4 +84,25 @@
return true;
}
}
+
+ protected void internalAddIncomingConnection(AbstractConnectionWrapper connection) {
+ getNode().addIncomingConnection("DROOLS_DEFAULT",
+ ((DefaultConnectionWrapper) connection).getConnection());
+ }
+
+ protected void internalRemoveIncomingConnection(AbstractConnectionWrapper connection) {
+ getNode().removeIncomingConnection("DROOLS_DEFAULT",
+ ((DefaultConnectionWrapper) connection).getConnection());
+ }
+
+ protected void internalAddOutgoingConnection(AbstractConnectionWrapper connection) {
+ getNode().addOutgoingConnection("DROOLS_DEFAULT",
+ ((DefaultConnectionWrapper) connection).getConnection());
+ }
+
+ protected void internalRemoveOutgoingConnection(AbstractConnectionWrapper connection) {
+ getNode().removeOutgoingConnection("DROOLS_DEFAULT",
+ ((DefaultConnectionWrapper) connection).getConnection());
+ }
+
}
15 years, 8 months
JBoss Tools SVN: r10455 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-09-24 10:27:12 -0400 (Wed, 24 Sep 2008)
New Revision: 10455
Removed:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/ELStringToken.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/ELToken.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELStringTokenizer.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELTokenizer.java
Log:
JBIDE-1497.
Obsolete tokenizers are removed.
Deleted: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/ELStringToken.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/ELStringToken.java 2008-09-24 14:21:45 UTC (rev 10454)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/ELStringToken.java 2008-09-24 14:27:12 UTC (rev 10455)
@@ -1,123 +0,0 @@
- /*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.seam.internal.core.el;
-
-import org.eclipse.jface.text.rules.IToken;
-
-/**
- * Token of the string with EL expression.
- * @author Alexey Kazakov
- */
-public class ELStringToken implements IToken {
- public static final ELStringToken EOF = new ELStringToken(-1, -1, null);
-
- private int start;
- private int length;
- private CharSequence chars;
- private String body;
-
- /**
- * Constructs the ELStringToken object
- *
- * @param start
- * @param length
- * @param chars
- */
- public ELStringToken(int start, int length, CharSequence chars) {
- this.start = start;
- this.length = length;
- this.chars = chars;
- }
-
- /**
- * Returns string representation for the token
- */
- public String toString() {
- return "ELStringToken(" + start + ", " + length + ") [" + (chars == null ? "<Empty>" : chars.toString()) + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- }
-
- /*
- * @see org.eclipse.jface.text.rules.IToken#getData()
- */
- public Object getData() {
-// return (chars == null ? null : chars.subSequence(start, start+length).toString());
- return getText();
- }
-
- /**
- * @return offset of token
- */
- public int getStart() {
- return start;
- }
-
- /**
- * @param start
- */
- public void setStart(int start) {
- this.start = start;
- }
-
- /**
- * @return length of token
- */
- public int getLength() {
- return length;
- }
-
- /*
- * @see org.eclipse.jface.text.rules.IToken#isEOF()
- */
- public boolean isEOF() {
- return (start == -1 && length == -1 && chars == null);
- }
-
- /*
- * @see org.eclipse.jface.text.rules.IToken#isOther()
- */
- public boolean isOther() {
- return false;
- }
-
- /*
- * @see org.eclipse.jface.text.rules.IToken#isUndefined()
- */
- public boolean isUndefined() {
- return false;
- }
-
- /*
- * @see org.eclipse.jface.text.rules.IToken#isWhitespace()
- */
- public boolean isWhitespace() {
- return false;
- }
-
- /*
- * Returns the token text
- */
- public String getText() {
- return chars.toString();
- }
-
- /*
- * Returns text of EL without brackets
- */
- public String getBody() {
- if(chars.length()<4) {
- return "";
- }
- if(body==null) {
- body = chars.subSequence(2, chars.length()-1).toString();
- }
- return body;
- }
-}
\ No newline at end of file
Deleted: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/ELToken.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/ELToken.java 2008-09-24 14:21:45 UTC (rev 10454)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/ELToken.java 2008-09-24 14:27:12 UTC (rev 10455)
@@ -1,118 +0,0 @@
- /*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.seam.internal.core.el;
-
-import org.eclipse.jface.text.rules.IToken;
-
-/**
- * Token for the EL expression parts
- * @author Alexey Kazakov
- */
-public class ELToken implements IToken {
- public static final ELToken EOF = new ELToken(-1, -1, null, -1);
- public static final int EL_VARIABLE_TOKEN = 1;
- public static final int EL_OPERATOR_TOKEN = 2;
- public static final int EL_RESERVED_WORD_TOKEN = 3;
- public static final int EL_SEPARATOR_TOKEN = 4;
- public static final int EL_STRING_TOKEN = 5;
- public static final int EL_NUMBER_TOKEN = 6;
-
- private int start;
- private int length;
- private CharSequence chars;
- private int type;
-
- /**
- * Constructs the ELToken object
- *
- * @param start
- * @param length
- * @param chars
- * @param type
- */
- public ELToken(int start, int length, CharSequence chars, int type) {
- this.start = start;
- this.length = length;
- this.chars = chars;
- this.type = type;
- }
-
- /**
- * Returns string representation for the token
- */
- public String toString() {
- return "ELToken(" + start + ", " + length + ", " + type + ") [" + (chars == null ? "<Empty>" : chars.toString()) + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- }
-
- /*
- * @see org.eclipse.jface.text.rules.IToken#getData()
- */
- public Object getData() {
-// return (chars == null ? null : chars.subSequence(start, start+length).toString());
- return getText();
- }
-
- /**
- * @return offset of token
- */
- public int getStart() {
- return start;
- }
-
- /**
- * @return length of token
- */
- public int getLength() {
- return length;
- }
-
- /*
- * @see org.eclipse.jface.text.rules.IToken#isEOF()
- */
- public boolean isEOF() {
- return (start == -1 && length == -1 && chars == null);
- }
-
- /*
- * @see org.eclipse.jface.text.rules.IToken#isOther()
- */
- public boolean isOther() {
- return false;
- }
-
- /*
- * @see org.eclipse.jface.text.rules.IToken#isUndefined()
- */
- public boolean isUndefined() {
- return false;
- }
-
- /*
- * @see org.eclipse.jface.text.rules.IToken#isWhitespace()
- */
- public boolean isWhitespace() {
- return false;
- }
-
- /*
- * Returns the token type
- */
- public int getType(){
- return type;
- }
-
- /*
- * Returns the token text
- */
- public String getText() {
- return chars.toString();
- }
-}
\ No newline at end of file
Deleted: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELStringTokenizer.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELStringTokenizer.java 2008-09-24 14:21:45 UTC (rev 10454)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELStringTokenizer.java 2008-09-24 14:27:12 UTC (rev 10455)
@@ -1,152 +0,0 @@
- /*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.seam.internal.core.el;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.tools.seam.core.SeamCorePlugin;
-
-/**
- * Parses string and creates list of tokens for each EL of this string.
- * @author Alexey Kazakov
- */
-public class SeamELStringTokenizer {
-
- private String sourceString;
- private List<ELStringToken> fTokens;
- private int index;
- private int offset = 0;
-
- private static final int START_EL_FIRST_SYMBOL = '#';
- private static final int START_EL_LAST_SYMBOL = '{';
- private static final int END_EL_SYMBOL = '}';
-
- /**
- * Constructs SeamELStringTokenizer object.
- * Parse string and get all EL from it.
- * For example: string is '#{var1.pr != var2.pr} #{f1.pr1}'
- * then tokens are ["#{var1.pr != var2.pr}","#{f1.pr1}"]
- * @param sourceString
- */
- public SeamELStringTokenizer(String sourceString) {
- this(sourceString, 0);
- }
-
- private SeamELStringTokenizer(String sourceString, int offset) {
- this.offset = offset;
- this.sourceString = sourceString;
- index = 0;
- fTokens = new ArrayList<ELStringToken>();
- parse();
- }
-
- /**
- * Returns list of tokens for the parsed string
- *
- * @return
- */
- public List<ELStringToken> getTokens() {
- return fTokens;
- }
-
- /*
- * Performs parsing of string
- */
- private void parse() {
- ELStringToken token;
- while ((token = getNextToken()) != ELStringToken.EOF) {
- fTokens.add(token);
- }
- }
-
- /*
- * Calculates and returns next token of string
- *
- * @return
- */
- private ELStringToken getNextToken() {
- int ch = readNextChar();
- while(ch!=-1) {
- int secondCh = readNextChar();
- if (secondCh == -1) {
- return ELStringToken.EOF;
- }
- releaseChar();
-
- if(ch == START_EL_FIRST_SYMBOL && secondCh == START_EL_LAST_SYMBOL) {
- releaseChar();
- return readELToken();
- }
- ch = readNextChar();
- }
- return ELStringToken.EOF;
- }
-
- /*
- * Returns the CharSequence object
- *
- * @param start
- * @param length
- * @return
- */
- private CharSequence getCharSequence(int start, int length) {
- String text = ""; //$NON-NLS-1$
- try {
- text = sourceString.substring(start, start + length);
- } catch (StringIndexOutOfBoundsException e) {
- SeamCorePlugin.getDefault().logError(e);
- }
- return text.subSequence(0, text.length());
- }
- /*
- * Reads and returns the string token from the expression
- * @return
- */
- private ELStringToken readELToken() {
- int startOfToken = index;
- readNextChar();
- readNextChar();
- int ch;
- while((ch = readNextChar()) != -1) {
- if (ch==END_EL_SYMBOL) {
- int length = index - startOfToken;
- return new ELStringToken(offset + startOfToken, length, getCharSequence(startOfToken, length));
- }
- }
- return ELStringToken.EOF;
- }
-
- /* Reads the next character
- * @return
- */
- private int readNextChar() {
- int c = -1;
- try {
- if (index < sourceString.length()) {
- c = sourceString.charAt(index);
- }
- } catch (StringIndexOutOfBoundsException e) {
- SeamCorePlugin.getPluginLog().logError(e);
- }
- index++;
- return c;
- }
-
- /*
- * returns the character to the document
- */
- private void releaseChar() {
- if (index > 0) {
- index--;
- }
- }
-}
\ No newline at end of file
Deleted: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELTokenizer.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELTokenizer.java 2008-09-24 14:21:45 UTC (rev 10454)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELTokenizer.java 2008-09-24 14:27:12 UTC (rev 10455)
@@ -1,340 +0,0 @@
- /*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.seam.internal.core.el;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.tools.seam.core.SeamCorePlugin;
-
-/**
- * Parses EL and creates list of tokens for the operands and operators within one EL.
- * @author Alexey Kazakov
- */
-public class SeamELTokenizer {
- private static final int STATE_INITIAL = 0;
- private static final int STATE_OPERAND = 1;
- private static final int STATE_OPERATOR = 2;
- private static final int STATE_RESERVED_WORD = 3;
- private static final int STATE_SEPARATOR = 4;
- private static final int STATE_STRING = 5;
-
- private String expression;
- private List<ELToken> fTokens;
- private int index;
- private int offset = 0;
-
- private int fState;
- private static final String OPERATOR_SYMBOLS = "!=&(){}[]:+-*%?,|/%<>";
- private static final int START_ROUND_BRACKET_SYMBOL = '(';
- private static final int END_ROUND_BRACKET_SYMBOL = ')';
- private static final int START_SQUARE_BRACKET_SYMBOL = '[';
- private static final int END_SQUARE_BRACKET_SYMBOL = ']';
- private static final int STRING_SYMBOL = '\'';
- private static final String RESERVED_WORDS = " null empty div and or not mod eq ne lt gt le ge true false instanceof invalid required ";
-
- /**
- * Constructs SeamELTokenizer object.
- * Parse an expression.
- * For example: expression is "var1.pr != var2.pr"
- * then tokens are ["var1.pr"," ", "!=", " ", "var2.pr"]
- * @param expression
- */
- public SeamELTokenizer(String expression) {
- this(expression, 0);
- }
-
- private SeamELTokenizer(String expression, int offset) {
- this.offset = offset;
- this.expression = expression;
- index = 0;
- fTokens = new ArrayList<ELToken>();
- parse();
- }
-
- /**
- * Returns list of tokens for the parsed expression
- *
- * @return
- */
- public List<ELToken> getTokens() {
- return fTokens;
- }
-
- /*
- * Performs parsing of expression
- */
- private void parse() {
- ELToken token;
- fState = STATE_INITIAL;
- while ((token = getNextToken()) != ELToken.EOF) {
- fTokens.add(token);
- }
- }
-
- /*
- * Calculates and returns next token of expression
- *
- * @return
- */
- private ELToken getNextToken() {
- switch (fState) {
- case STATE_INITIAL: // Just started
- case STATE_STRING: { // String is read
- int ch = readNextChar();
- if (ch == -1) {
- return ELToken.EOF;
- }
- releaseChar();
- if (Character.isJavaIdentifierPart((char)ch)) {
- return readOperandOrReservedWordToken();
- }
- if (OPERATOR_SYMBOLS.indexOf(ch)>-1) {
- return readOperatorToken();
- }
- if (ch == STRING_SYMBOL) {
- return readStringToken();
- }
- if (ch == ' ') {
- return readSeparatorToken();
- }
- return ELToken.EOF;
- }
- case STATE_RESERVED_WORD: // Reserved word is read - expecting a separator or operator or string
- case STATE_OPERAND: { // Operand is read - expecting a separator or operator or string
- int ch = readNextChar();
- if (ch == -1) {
- return ELToken.EOF;
- }
- releaseChar();
- if (OPERATOR_SYMBOLS.indexOf(ch)>-1) {
- return readOperatorToken();
- }
- if (ch == STRING_SYMBOL) {
- return readStringToken();
- }
- if (ch == ' ') {
- return readSeparatorToken();
- }
- return ELToken.EOF;
- }
- case STATE_OPERATOR: { // Operator is read - expecting a separator or operand or string
- int ch = readNextChar();
- if (ch == -1) {
- return ELToken.EOF;
- }
- releaseChar();
- if (Character.isJavaIdentifierPart((char)ch)) {
- return readOperandOrReservedWordToken();
- }
- if (ch == STRING_SYMBOL) {
- return readStringToken();
- }
- if (ch == ' ') {
- return readSeparatorToken();
- }
- return ELToken.EOF;
- }
- case STATE_SEPARATOR: { // Separator is read - expecting a operand or operator or string
- int ch = readNextChar();
- if (ch == -1) {
- return ELToken.EOF;
- }
- releaseChar();
- if (Character.isJavaIdentifierPart((char)ch)) {
- return readOperandOrReservedWordToken();
- }
- if (OPERATOR_SYMBOLS.indexOf(ch)>-1) {
- return readOperatorToken();
- }
- if (ch == STRING_SYMBOL) {
- return readStringToken();
- }
- releaseChar();
- return ELToken.EOF;
- }
- }
- return ELToken.EOF;
- }
-
- /*
- * Returns the CharSequence object
- *
- * @param start
- * @param length
- * @return
- */
- private CharSequence getCharSequence(int start, int length) {
- String text = ""; //$NON-NLS-1$
- try {
- text = expression.substring(start, start + length);
- } catch (StringIndexOutOfBoundsException e) {
- SeamCorePlugin.getDefault().logError(e);
- text = ""; // For sure //$NON-NLS-1$
- }
- return text.subSequence(0, text.length());
- }
-
- /*
- * Reads and returns the operator token from the expression
- * @return
- */
- private ELToken readOperatorToken() {
- fState = STATE_OPERATOR;
- int startOfToken = index;
- int ch;
- while((ch = readNextChar()) != -1) {
- if (OPERATOR_SYMBOLS.indexOf(ch)==-1) {
- break;
- }
- }
- releaseChar();
- int length = index - startOfToken;
- return (length > 0 ? new ELToken(offset + startOfToken, length, getCharSequence(startOfToken, length), ELToken.EL_OPERATOR_TOKEN) : ELToken.EOF);
- }
-
- /*
- * Reads and returns the separator token from the expression
- * @return
- */
- private ELToken readSeparatorToken() {
- fState = STATE_SEPARATOR;
- int startOfToken = index;
- int ch;
- while((ch = readNextChar()) != -1) {
- if (ch!=' ') {
- break;
- }
- }
- releaseChar();
- int length = index - startOfToken;
- return (length > 0 ? new ELToken(offset + startOfToken, length, getCharSequence(startOfToken, length), ELToken.EL_SEPARATOR_TOKEN) : ELToken.EOF);
- }
-
- /*
- * Reads and returns the string token from the expression
- * @return
- */
- private ELToken readStringToken() {
- fState = STATE_STRING;
- int ch = readNextChar(); // skip first '
- int startOfToken = index;
- while((ch = readNextChar()) != -1) {
- if (ch==STRING_SYMBOL) {
- break;
- }
- }
- releaseChar();
- int length = index - startOfToken;
-
- return (length > 0 ? new ELToken(offset + startOfToken, length, getCharSequence(startOfToken, length), ELToken.EL_STRING_TOKEN) : ELToken.EOF);
- }
-
- /*
- * Reads and returns the operand token from the expression
- * @return
- */
- private ELToken readOperandOrReservedWordToken() {
- fState = STATE_OPERAND;
- int startOfToken = index;
- int ch;
- while((ch = readNextChar()) != -1) {
- if (ch == START_ROUND_BRACKET_SYMBOL) {
- ch = readTokensWithinBrackets(END_ROUND_BRACKET_SYMBOL);
- } else if (ch == START_SQUARE_BRACKET_SYMBOL) {
- ch = readTokensWithinBrackets(END_SQUARE_BRACKET_SYMBOL);
- }
- if (!Character.isJavaIdentifierPart(ch) && ch!='.') {
- break;
- }
- }
- releaseChar();
- int length = index - startOfToken;
- boolean reservedWord = isResorvedWord(startOfToken, length);
- int tokenType = ELToken.EL_VARIABLE_TOKEN;
- if(reservedWord) {
- tokenType = ELToken.EL_RESERVED_WORD_TOKEN;
- fState = STATE_RESERVED_WORD;
- } else if(isNumber(startOfToken, length)) {
- tokenType = ELToken.EL_NUMBER_TOKEN;
- }
-
- return (length > 0 ? new ELToken(offset + startOfToken, length, getCharSequence(startOfToken, length), tokenType) : ELToken.EOF);
- }
-
- private int readTokensWithinBrackets(int expectedEndBracketSymbol) {
- int start = index;
- int ch;
- while((ch = readNextChar()) != -1) {
- if (ch == expectedEndBracketSymbol) {
- CharSequence text = getCharSequence(start, index - 1 - start);
- SeamELTokenizer tokenizer = new SeamELTokenizer(text.toString(), start);
- fTokens.addAll(tokenizer.getTokens());
- return readNextChar();
- }
- }
- return ch;
- }
-
- private boolean isResorvedWord(String word) {
- return RESERVED_WORDS.indexOf(" " + word.trim() + " ")>-1;
- }
-
- private boolean isNumber(String word) {
- if(word.length()>0) {
- char firstChar = word.charAt(0);
- if(firstChar=='-' || (firstChar>='0' && firstChar<='9')) {
- try {
- Long.parseLong(word);
- return true;
- } catch (NumberFormatException e) {
- return false;
- }
- }
- }
- return false;
- }
-
- private boolean isResorvedWord(int beginIndex, int length) {
- String word = expression.substring(beginIndex, beginIndex + length);
- return isResorvedWord(word);
- }
-
- private boolean isNumber(int beginIndex, int length) {
- String word = expression.substring(beginIndex, beginIndex + length);
- return isNumber(word);
- }
-
- /* Reads the next character
- * @return
- */
- private int readNextChar() {
- int c = -1;
- try {
- if (index < expression.length()) {
- c = expression.charAt(index);
- }
- } catch (StringIndexOutOfBoundsException e) {
- SeamCorePlugin.getPluginLog().logError(e);
- }
- index++;
- return c;
- }
-
- /*
- * returns the character to the document
- */
- private void releaseChar() {
- if (index > 0) {
- index--;
- }
- }
-}
\ No newline at end of file
15 years, 8 months
JBoss Tools SVN: r10454 - trunk/birt/docs.
by jbosstools-commits@lists.jboss.org
Author: abogachuk
Date: 2008-09-24 10:21:45 -0400 (Wed, 24 Sep 2008)
New Revision: 10454
Added:
trunk/birt/docs/reference/
Log:
according to the necessary structure of the folders
15 years, 8 months
JBoss Tools SVN: r10453 - trunk/birt.
by jbosstools-commits@lists.jboss.org
Author: abogachuk
Date: 2008-09-24 10:20:46 -0400 (Wed, 24 Sep 2008)
New Revision: 10453
Added:
trunk/birt/docs/
Log:
added for the necessary documentation
15 years, 8 months
JBoss Tools SVN: r10452 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-09-24 10:18:32 -0400 (Wed, 24 Sep 2008)
New Revision: 10452
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidator.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/messages.properties
Log:
JBIDE-1497.
Replacing ELToken with ELModel in SeamELValidator.
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidator.java 2008-09-24 14:17:52 UTC (rev 10451)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidator.java 2008-09-24 14:18:32 UTC (rev 10452)
@@ -41,6 +41,13 @@
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
+import org.jboss.tools.common.el.core.model.ELExpression;
+import org.jboss.tools.common.el.core.model.ELInstance;
+import org.jboss.tools.common.el.core.model.ELInvocationExpression;
+import org.jboss.tools.common.el.core.model.ELModel;
+import org.jboss.tools.common.el.core.parser.ELParser;
+import org.jboss.tools.common.el.core.parser.ELParserFactory;
+import org.jboss.tools.common.el.core.parser.SyntaxError;
import org.jboss.tools.common.model.util.TypeInfoCollector;
import org.jboss.tools.common.util.FileUtil;
import org.jboss.tools.seam.core.ISeamContextVariable;
@@ -49,13 +56,9 @@
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.SeamPreferences;
import org.jboss.tools.seam.internal.core.el.ELOperandToken;
-import org.jboss.tools.seam.internal.core.el.ELStringToken;
-import org.jboss.tools.seam.internal.core.el.ELToken;
import org.jboss.tools.seam.internal.core.el.ElVarSearcher;
import org.jboss.tools.seam.internal.core.el.SeamELCompletionEngine;
import org.jboss.tools.seam.internal.core.el.SeamELOperandResolveStatus;
-import org.jboss.tools.seam.internal.core.el.SeamELStringTokenizer;
-import org.jboss.tools.seam.internal.core.el.SeamELTokenizer;
import org.jboss.tools.seam.internal.core.el.Var;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -69,6 +72,7 @@
protected static final String UNKNOWN_EL_VARIABLE_NAME_MESSAGE_ID = "UNKNOWN_EL_VARIABLE_NAME"; //$NON-NLS-1$
protected static final String UNKNOWN_EL_VARIABLE_PROPERTY_NAME_MESSAGE_ID = "UNKNOWN_EL_VARIABLE_PROPERTY_NAME"; //$NON-NLS-1$
protected static final String UNPAIRED_GETTER_OR_SETTER_MESSAGE_ID = "UNPAIRED_GETTER_OR_SETTER"; //$NON-NLS-1$
+ protected static final String SYNTAX_ERROR_MESSAGE_ID = "SYNTAX_ERROR"; //$NON-NLS-1$
protected static final String VALIDATING_EL_FILE_MESSAGE_ID = "VALIDATING_EL_FILE";
@@ -251,33 +255,42 @@
private void validateString(IFile file, String string, int offset) {
int startEl = string.indexOf("#{"); //$NON-NLS-1$
if(startEl>-1) {
- SeamELStringTokenizer st = new SeamELStringTokenizer(string);
- List<ELStringToken> tokens = st.getTokens();
- for (ELStringToken stringToken : tokens) {
- if(reporter.isCancelled()) {
+ ELParser parser = ELParserFactory.createJbossParser();
+ ELModel model = parser.parse(string);
+ List<SyntaxError> errors = parser.getSyntaxErrors();
+ if(errors.size() > 0) {
+ for (SyntaxError error: errors) {
+ //TODO 1) make message more informative
+ // 2) create other preference
+ addError(SYNTAX_ERROR_MESSAGE_ID, SeamPreferences.UNKNOWN_EL_VARIABLE_PROPERTY_NAME, new String[]{}, 1, offset + error.getPosition(), file);
+ }
+
+ }
+ List<ELInstance> is = model.getInstances();
+ for (ELInstance i : is) {
+ if (reporter.isCancelled()) {
return;
}
- stringToken.setStart(offset + stringToken.getStart() + 2);
- validateEl(file, stringToken);
+ if(i.getErrors().size() > 0) {
+ //Already reported syntax problem in this piece of EL.
+ continue;
+ }
+ validateEl(file, i.getExpression(), offset);
}
}
}
- private void validateEl(IFile file, ELStringToken el) {
- String exp = el.getBody();
- SeamELTokenizer elTokenizer = new SeamELTokenizer(exp);
- List<ELToken> tokens = elTokenizer.getTokens();
- for (ELToken token : tokens) {
- if(token.getType()==ELToken.EL_VARIABLE_TOKEN) {
- validateElOperand(file, token, el.getStart());
- }
+ private void validateEl(IFile file, ELExpression el, int offset) {
+ List<ELInvocationExpression> es = el.getInvocations();
+ for (ELInvocationExpression token: es) {
+ validateElOperand(file, token, offset);
}
}
- private void validateElOperand(IFile file, ELToken operandToken, int documnetOffset) {
+ private void validateElOperand(IFile file, ELInvocationExpression operandToken, int documnetOffset) {
String operand = operandToken.getText();
String varName = operand;
- int offsetOfVarName = documnetOffset + operandToken.getStart();
+ int offsetOfVarName = documnetOffset + operandToken.getFirstToken().getStart();
int lengthOfVarName = varName.length();
boolean unresolvedTokenIsVariable = true;
try {
@@ -327,7 +340,7 @@
for (ELOperandToken token : tokens) {
if((token.getType()==ELOperandToken.EL_VARIABLE_NAME_TOKEN) || (token.getType()==ELOperandToken.EL_PROPERTY_NAME_TOKEN) || (token.getType()==ELOperandToken.EL_METHOD_TOKEN)) {
varName = token.getText();
- offsetOfVarName = documnetOffset + operandToken.getStart() + token.getStart();
+ offsetOfVarName = documnetOffset + operandToken.getFirstToken().getStart() + token.getStart();
lengthOfVarName = varName.length();
unresolvedTokenIsVariable = (token.getType()==ELOperandToken.EL_VARIABLE_NAME_TOKEN);
break;
@@ -347,4 +360,5 @@
addError(UNKNOWN_EL_VARIABLE_PROPERTY_NAME_MESSAGE_ID, SeamPreferences.UNKNOWN_EL_VARIABLE_PROPERTY_NAME, new String[]{varName}, lengthOfVarName, offsetOfVarName, file);
}
}
-}
\ No newline at end of file
+
+}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/messages.properties
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/messages.properties 2008-09-24 14:17:52 UTC (rev 10451)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/messages.properties 2008-09-24 14:18:32 UTC (rev 10452)
@@ -44,6 +44,7 @@
UNKNOWN_EL_VARIABLE_NAME="{0}" cannot be resolved
UNKNOWN_EL_VARIABLE_PROPERTY_NAME="{0}" cannot be resolved
UNPAIRED_GETTER_OR_SETTER=Property "{0}" has only {1}. {2} is missing.
+SYNTAX_ERROR=EL syntax error.
#Invalid seam project settings
INVALID_PARENT_PROJECT=Main Seam project "{0}" specified for Seam project "{1}" does not exist.
15 years, 8 months
JBoss Tools SVN: r10451 - in trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el: core/parser and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-09-24 10:17:52 -0400 (Wed, 24 Sep 2008)
New Revision: 10451
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/model/ELInstance.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/parser/ELParserFactory.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/model/ELInstanceImpl.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/model/ELModelImpl.java
Log:
JBIDE-1497.
Syntax errors are passed to EL model and its instances.
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/model/ELInstance.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/model/ELInstance.java 2008-09-24 13:28:20 UTC (rev 10450)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/model/ELInstance.java 2008-09-24 14:17:52 UTC (rev 10451)
@@ -10,7 +10,10 @@
******************************************************************************/
package org.jboss.tools.common.el.core.model;
+import java.util.List;
+
import org.jboss.tools.common.el.core.parser.LexicalToken;
+import org.jboss.tools.common.el.core.parser.SyntaxError;
/**
* Instance of EL includes opening token, the expression proper,
@@ -29,4 +32,6 @@
public LexicalToken getCloseInstanceToken();
+ public List<SyntaxError> getErrors();
+
}
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/parser/ELParserFactory.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/parser/ELParserFactory.java 2008-09-24 13:28:20 UTC (rev 10450)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/parser/ELParserFactory.java 2008-09-24 14:17:52 UTC (rev 10451)
@@ -37,6 +37,7 @@
}
ELModelImpl model = impl.parse(token);
model.setSource(source);
+ model.setErrors(errors);
return model;
}
@@ -60,6 +61,7 @@
}
ELModelImpl model = impl.parse(token);
model.setSource(source);
+ model.setErrors(errors);
return model;
}
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/model/ELInstanceImpl.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/model/ELInstanceImpl.java 2008-09-24 13:28:20 UTC (rev 10450)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/model/ELInstanceImpl.java 2008-09-24 14:17:52 UTC (rev 10451)
@@ -10,10 +10,14 @@
******************************************************************************/
package org.jboss.tools.common.el.internal.core.model;
+import java.util.ArrayList;
+import java.util.List;
+
import org.jboss.tools.common.el.core.model.ELExpression;
import org.jboss.tools.common.el.core.model.ELInstance;
import org.jboss.tools.common.el.core.model.ELObjectType;
import org.jboss.tools.common.el.core.parser.LexicalToken;
+import org.jboss.tools.common.el.core.parser.SyntaxError;
import org.jboss.tools.common.el.internal.core.parser.token.EndELTokenDescription;
import org.jboss.tools.common.el.internal.core.parser.token.StartELTokenDescription;
@@ -23,6 +27,7 @@
*/
public class ELInstanceImpl extends ELObjectImpl implements ELInstance {
ELExpressionImpl expression;
+ List<SyntaxError> errors = new ArrayList<SyntaxError>();
public ELInstanceImpl() {
}
@@ -49,6 +54,10 @@
return expression;
}
+ public List<SyntaxError> getErrors() {
+ return errors;
+ }
+
public void addChild(ELObjectImpl child) {
if(child instanceof ELExpressionImpl) {
setExpression((ELExpressionImpl)child);
@@ -88,4 +97,18 @@
return ELObjectType.EL_INSTANCE;
}
+ public boolean contains(int position) {
+ if(position < getFirstToken().getStart()) return false;
+ LexicalToken l = getLastToken();
+ if(l == null) l = getFirstToken();
+ int end = l.getStart() + l.getLength();
+ if(position > end) return false;
+ if(getCloseInstanceToken() != null && position == end) return false;
+ return true;
+ }
+
+ public void addError(SyntaxError error) {
+ errors.add(error);
+ }
+
}
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/model/ELModelImpl.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/model/ELModelImpl.java 2008-09-24 13:28:20 UTC (rev 10450)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/model/ELModelImpl.java 2008-09-24 14:17:52 UTC (rev 10451)
@@ -16,6 +16,7 @@
import org.jboss.tools.common.el.core.model.ELInstance;
import org.jboss.tools.common.el.core.model.ELModel;
import org.jboss.tools.common.el.core.model.ELObjectType;
+import org.jboss.tools.common.el.core.parser.SyntaxError;
/**
*
@@ -69,4 +70,17 @@
return ELObjectType.EL_MODEL;
}
+ public void setErrors(List<SyntaxError> errors) {
+ for (SyntaxError e: errors) {
+ for (ELInstance i: instances) {
+ ELInstanceImpl im = (ELInstanceImpl)i;
+ if(im.contains(e.getPosition())) {
+ im.addError(e);
+ break;
+ }
+ }
+ }
+
+ }
+
}
15 years, 8 months
JBoss Tools SVN: r10450 - trunk/documentation/guides/GettingStartedGuide/en/modules.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2008-09-24 09:28:20 -0400 (Wed, 24 Sep 2008)
New Revision: 10450
Modified:
trunk/documentation/guides/GettingStartedGuide/en/modules/first_seam.xml
Log:
https://jira.jboss.org/jira/browse/JBDS-134 - deleting commented faq section as it's moved to the end;
Modified: trunk/documentation/guides/GettingStartedGuide/en/modules/first_seam.xml
===================================================================
--- trunk/documentation/guides/GettingStartedGuide/en/modules/first_seam.xml 2008-09-24 13:26:37 UTC (rev 10449)
+++ trunk/documentation/guides/GettingStartedGuide/en/modules/first_seam.xml 2008-09-24 13:28:20 UTC (rev 10450)
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<chapter id="first_seam" xreflabel="first_seam" revisionflag="added">
+<chapter id="first_seam" xreflabel="first_seam" revisionflag="added" role="updated">
<?dbhtml filename="first_seam.html"?>
<chapterinfo>
<keywordset>
@@ -971,44 +971,4 @@
</section>
</section>
-
- <!--section id="gsg_seam_faq">
- <title>FAQ</title>
- <para>For more information on work with Seam in JBoss Developer Studio, refer to the following
- FAQ to get the answers on the most "popular" questions.</para>
-
- <para><emphasis role="bold">How to import an example Seam project from jboss-eap directory?</emphasis></para>
-
- <para>To import an example Seam project from <emphasis>
- <property>jboss-eap</property>
- </emphasis> into your working directory, you should perform the following steps:</para>
-
- <itemizedlist>
- <listitem>
- <para>Go to <emphasis>
- <property>New > Other > Java Project from Existing Buildfile</property>
- </emphasis></para>
- </listitem>
-
- <listitem>
- <para>Point to the <emphasis>
- <property>build.xml</property>
- </emphasis> of any chosen project by pressing <emphasis>
- <property>Browse</property>
- </emphasis> button</para>
- </listitem>
-
- <listitem>
- <para>Hit <emphasis>
- <property>Finish</property>
- </emphasis> to open the project</para>
- </listitem>
- </itemizedlist>
-
- <para>As these seam examples are non WTP projects, next you should enable Seam support for
- them. To do that, right click the project and go to<emphasis>
- <property>Properties > Seam Settings</property>. </emphasis></para>
-
- </section-->
-
</chapter>
15 years, 8 months