JBoss Tools SVN: r9268 - trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template.
by jbosstools-commits@lists.jboss.org
Author: estherbin
Date: 2008-07-24 09:42:39 -0400 (Thu, 24 Jul 2008)
New Revision: 9268
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxTemplate.java
Log:
Fix some from https://jira.jboss.org/jira/browse/JBIDE-2430 issue.
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxTemplate.java 2008-07-24 13:31:06 UTC (rev 9267)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxTemplate.java 2008-07-24 13:42:39 UTC (rev 9268)
@@ -39,7 +39,6 @@
import com.sun.org.apache.xerces.internal.impl.xpath.regex.ParseException;
-// TODO: Auto-generated Javadoc
/**
* The Class RichFacesComboBox2Template.
*
@@ -82,6 +81,8 @@
/** The Constant STYLE_EXT. */
private static final String STYLE_EXT = "richFacesComboBox";
+
+ private static final int LIST_ITEM_HEIGHT_DEFAULT_VALUE=18;
/** The style clasess. */
private Map<String, String> styleClasess = new HashMap<String, String>();
@@ -130,6 +131,10 @@
/** The source item class. */
private String sourceItemClass;
+
+
+ /** Source button icon **/
+ private String sourceButtonIcon;
/**
* The Constructor.
@@ -287,7 +292,16 @@
final nsIDOMElement scrollDiv = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
scrollDiv.setAttribute(HTML.ATTR_CLASS, "rich-combobox-list-scroll");
- scrollDiv.setAttribute(HTML.ATTR_STYLE, "height: 54px; width: " + calculateWithForDiv(sourceListWidth, 2));
+ final List<Element> items = ComponentUtil.getSelectItems(source.getChildNodes());
+ int defaultHeight = LIST_ITEM_HEIGHT_DEFAULT_VALUE;
+
+ if((items!=null) && (items.size() > 1)){
+ defaultHeight = ((items.size() - 1)* LIST_ITEM_HEIGHT_DEFAULT_VALUE);
+ }
+
+ final String listHeight = ComponentUtil.isNotBlank(this.sourceListHeight) ? this.sourceListHeight : String.valueOf(defaultHeight)
+ + "px";
+ scrollDiv.setAttribute(HTML.ATTR_STYLE, "height: "+listHeight+"; width: " + calculateWithForDiv(sourceListWidth, 2));
final List<Element> selectItems = ComponentUtil.getSelectItems(source.getChildNodes());
@@ -581,11 +595,14 @@
if (ComponentUtil.isBlank(this.sourceListWidth)) {
this.sourceListWidth = DEFAULT_LIST_WIDTH;
}
- this.sourceListHeight = source.getAttribute("");
+ this.sourceListHeight = source.getAttribute("listHeight");
+
this.sourceWidth = source.getAttribute("width");
if (ComponentUtil.isBlank(this.sourceWidth)) {
this.sourceWidth = DEFAULT_LIST_WIDTH;
+ }else if(ComponentUtil.isNotBlank(this.sourceWidth) && (this.sourceListWidth == DEFAULT_LIST_WIDTH)){
+ this.sourceListWidth = this.sourceWidth;
}
this.sourceDefaultLabel = ComponentUtil.getAttribute(source, "defaultLabel");
@@ -605,6 +622,8 @@
this.sourceListClass = ComponentUtil.getAttribute(source, "listClass");
this.sourceListStyle = ComponentUtil.getAttribute(source, "listStyle");
this.sourceItemClass = ComponentUtil.getAttribute(source, "itemClass");
+
+ this.sourceButtonIcon = ComponentUtil.getAttribute(source, "buttonIcon");
}
16 years, 5 months
JBoss Tools SVN: r9267 - in trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph: src/org/jboss/tools/flow/jpdl4/graph/editor and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2008-07-24 09:31:06 -0400 (Thu, 24 Jul 2008)
New Revision: 9267
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/build.properties
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/plugin.xml
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/editor/JpdlPaletteFactory.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/editpart/EndStateEditPart.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/editpart/JpdlEditPartFactory.java
Log:
add End State
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/build.properties
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/build.properties 2008-07-24 12:59:42 UTC (rev 9266)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/build.properties 2008-07-24 13:31:06 UTC (rev 9267)
@@ -1,4 +1,5 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
- .
+ .,\
+ plugin.xml
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/plugin.xml
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/plugin.xml 2008-07-24 12:59:42 UTC (rev 9266)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/plugin.xml 2008-07-24 13:31:06 UTC (rev 9267)
@@ -4,10 +4,10 @@
<extension point="org.eclipse.ui.editors">
<editor
- name="RuleFlow Editor"
+ name="jPDL4 Editor"
extensions="jpdl4"
- icon="icons/processH.gif"
- contributorClass="org.jboss.tools.process.editor.GenericActionBarContributor"
+ icon="icons/process.gif"
+ contributorClass="org.jboss.tools.flow.editor.GenericActionBarContributor"
class="org.jboss.tools.flow.jpdl4.graph.editor.JpdlEditor"
id="org.jboss.tools.process.jpdl4.graph.editor.JpdlEditor">
</editor>
@@ -24,7 +24,7 @@
toolbarPath="Process"
icon="icons/processV.gif"
tooltip="Auto layout the process (vertical)"
- class="org.jboss.tools.process.editor.action.VerticalAutoLayoutAction"
+ class="org.jboss.tools.flow.editor.action.VerticalAutoLayoutAction"
/>
</editorContribution>
<editorContribution
@@ -36,7 +36,7 @@
toolbarPath="Process"
icon="icons/processH.gif"
tooltip="Auto layout the process (horizontal)"
- class="org.jboss.tools.process.editor.action.HorizontalAutoLayoutAction"
+ class="org.jboss.tools.flow.editor.action.HorizontalAutoLayoutAction"
/>
</editorContribution>
</extension>
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/editor/JpdlPaletteFactory.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/editor/JpdlPaletteFactory.java 2008-07-24 12:59:42 UTC (rev 9266)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/editor/JpdlPaletteFactory.java 2008-07-24 13:31:06 UTC (rev 9267)
@@ -9,6 +9,7 @@
import org.eclipse.jface.resource.ImageDescriptor;
import org.jboss.tools.flow.editor.PaletteFactory;
import org.jboss.tools.flow.jpdl4.graph.Activator;
+import org.jboss.tools.flow.jpdl4.graph.wrapper.EndStateWrapper;
import org.jboss.tools.flow.jpdl4.graph.wrapper.StartStateWrapper;
import org.jboss.tools.flow.jpdl4.graph.wrapper.StateWrapper;
import org.jboss.tools.flow.jpdl4.graph.wrapper.TransitionWrapperFactory;
@@ -33,15 +34,25 @@
entries.add(combined);
combined = new CombinedTemplateCreationEntry(
- "State",
- "Create a new State",
- StateWrapper.class,
- new SimpleFactory(StateWrapper.class),
- ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/state.gif")),
- ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/state.gif"))
- );
+ "State",
+ "Create a new State",
+ StateWrapper.class,
+ new SimpleFactory(StateWrapper.class),
+ ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/state.gif")),
+ ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/state.gif"))
+ );
entries.add(combined);
-
+
+ combined = new CombinedTemplateCreationEntry(
+ "End",
+ "Create a new End State",
+ EndStateWrapper.class,
+ new SimpleFactory(EndStateWrapper.class),
+ ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/end.gif")),
+ ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/end.gif"))
+ );
+ entries.add(combined);
+
return entries;
}
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/editpart/EndStateEditPart.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/editpart/EndStateEditPart.java 2008-07-24 12:59:42 UTC (rev 9266)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/editpart/EndStateEditPart.java 2008-07-24 13:31:06 UTC (rev 9267)
@@ -10,7 +10,7 @@
public class EndStateEditPart extends ElementEditPart {
private static final Image ICON = ImageDescriptor.createFromURL(
- Activator.getDefault().getBundle().getEntry("icons/start.gif")).createImage();
+ Activator.getDefault().getBundle().getEntry("icons/end.gif")).createImage();
protected IFigure createFigure() {
RectangleElementFigure figure = new RectangleElementFigure();
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/editpart/JpdlEditPartFactory.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/editpart/JpdlEditPartFactory.java 2008-07-24 12:59:42 UTC (rev 9266)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/editpart/JpdlEditPartFactory.java 2008-07-24 13:31:06 UTC (rev 9267)
@@ -3,6 +3,7 @@
import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPartFactory;
import org.jboss.tools.flow.editor.editpart.RootEditPart;
+import org.jboss.tools.flow.jpdl4.graph.wrapper.EndStateWrapper;
import org.jboss.tools.flow.jpdl4.graph.wrapper.ProcessWrapper;
import org.jboss.tools.flow.jpdl4.graph.wrapper.StartStateWrapper;
import org.jboss.tools.flow.jpdl4.graph.wrapper.StateWrapper;
@@ -18,6 +19,8 @@
result = new StartStateEditPart();
} else if (model instanceof StateWrapper) {
result = new StateEditPart();
+ } else if (model instanceof EndStateWrapper) {
+ result = new EndStateEditPart();
} else if (model instanceof TransitionWrapper) {
result = new TransitionEditPart();
} else {
16 years, 5 months
JBoss Tools SVN: r9266 - trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/core.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2008-07-24 08:59:42 -0400 (Thu, 24 Jul 2008)
New Revision: 9266
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/core/Process.java
Log:
only one start state per process
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/core/Process.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/core/Process.java 2008-07-24 12:54:41 UTC (rev 9265)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.core/src/org/jboss/tools/flow/jpdl4/core/Process.java 2008-07-24 12:59:42 UTC (rev 9266)
@@ -2,6 +2,7 @@
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
public class Process {
@@ -39,5 +40,15 @@
node.setNodeContainer(null);
nodes.remove(node);
}
+
+ public StartState getStartState() {
+ for (Iterator<Node> iterator = nodes.iterator(); iterator.hasNext(); ) {
+ Node node = iterator.next();
+ if (node instanceof StartState) {
+ return (StartState)node;
+ }
+ }
+ return null;
+ }
}
16 years, 5 months
JBoss Tools SVN: r9265 - trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2008-07-24 08:54:41 -0400 (Thu, 24 Jul 2008)
New Revision: 9265
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/BaseNodeWrapper.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/EndStateWrapper.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/ProcessWrapper.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/StartStateWrapper.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/StateWrapper.java
Log:
only one start state per process
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/BaseNodeWrapper.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/BaseNodeWrapper.java 2008-07-24 12:53:35 UTC (rev 9264)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/BaseNodeWrapper.java 2008-07-24 12:54:41 UTC (rev 9265)
@@ -3,61 +3,58 @@
import org.eclipse.draw2d.geometry.Rectangle;
import org.jboss.tools.flow.editor.core.AbstractConnectionWrapper;
import org.jboss.tools.flow.editor.core.AbstractNodeWrapper;
+import org.jboss.tools.flow.editor.core.NodeWrapper;
import org.jboss.tools.flow.jpdl4.core.Node;
public abstract class BaseNodeWrapper extends AbstractNodeWrapper {
-
- public void setNode(Node node) {
- setElement(node);
- }
-
- public Node getNode() {
- return (Node) getElement();
- }
-
- public String getId() {
- long id = getNode().getId();
- return id == -1 ? null : getNode().getId() + "";
- }
- public String getName() {
- return getNode().getName();
- }
+ public void setNode(Node node) {
+ setElement(node);
+ }
- public void internalSetName(String name) {
- getNode().setName(name);
- notifyListeners(CHANGE_VISUAL);
- }
-
- protected void internalSetConstraint(Rectangle constraint) {
- Node node = getNode();
- node.setMetaData("x", constraint.x);
- node.setMetaData("y", constraint.y);
- node.setMetaData("width", constraint.width);
- node.setMetaData("height", constraint.height);
- }
-
- public Rectangle internalGetConstraint() {
- Node node = getNode();
- Integer x = (Integer) node.getMetaData("x");
- Integer y = (Integer) node.getMetaData("y");
- Integer width = (Integer) node.getMetaData("width");
- Integer height = (Integer) node.getMetaData("height");
- return new Rectangle(
- x == null ? 0 : x,
- y == null ? 0 : y,
- width == null ? -1 : width,
- height == null ? -1 : height);
- }
+ public Node getNode() {
+ return (Node) getElement();
+ }
- public boolean acceptsIncomingConnection(AbstractConnectionWrapper connection, BaseNodeWrapper source) {
- return source == null
- || ((BaseNodeWrapper) source).getNode().getNodeContainer() == getNode().getNodeContainer();
- }
+ public String getId() {
+ long id = getNode().getId();
+ return id == -1 ? null : getNode().getId() + "";
+ }
- public boolean acceptsOutgoingConnection(AbstractConnectionWrapper connection, BaseNodeWrapper target) {
- return target == null
- || ((BaseNodeWrapper) target).getNode().getNodeContainer() == getNode().getNodeContainer();
- }
-
+ public String getName() {
+ return getNode().getName();
+ }
+
+ public void internalSetName(String name) {
+ getNode().setName(name);
+ notifyListeners(CHANGE_VISUAL);
+ }
+
+ protected void internalSetConstraint(Rectangle constraint) {
+ Node node = getNode();
+ node.setMetaData("x", constraint.x);
+ node.setMetaData("y", constraint.y);
+ node.setMetaData("width", constraint.width);
+ node.setMetaData("height", constraint.height);
+ }
+
+ public Rectangle internalGetConstraint() {
+ Node node = getNode();
+ Integer x = (Integer) node.getMetaData("x");
+ Integer y = (Integer) node.getMetaData("y");
+ Integer width = (Integer) node.getMetaData("width");
+ Integer height = (Integer) node.getMetaData("height");
+ return new Rectangle(x == null ? 0 : x, y == null ? 0 : y,
+ width == null ? -1 : width, height == null ? -1 : height);
+ }
+
+ public boolean acceptsIncomingConnection(
+ AbstractConnectionWrapper connection, NodeWrapper source) {
+ return true;
+ }
+
+ public boolean acceptsOutgoingConnection(
+ AbstractConnectionWrapper connection, NodeWrapper target) {
+ return true;
+ }
}
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/EndStateWrapper.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/EndStateWrapper.java 2008-07-24 12:53:35 UTC (rev 9264)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/EndStateWrapper.java 2008-07-24 12:54:41 UTC (rev 9265)
@@ -15,11 +15,6 @@
return (EndState) getElement();
}
- public boolean acceptsIncomingConnection(AbstractConnectionWrapper connection, NodeWrapper source) {
- return super.acceptsIncomingConnection(connection, (BaseNodeWrapper)source)
- && getIncomingConnections().isEmpty();
- }
-
public boolean acceptsOutgoingConnection(AbstractConnectionWrapper connection, NodeWrapper target) {
return false;
}
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/ProcessWrapper.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/ProcessWrapper.java 2008-07-24 12:53:35 UTC (rev 9264)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/ProcessWrapper.java 2008-07-24 12:54:41 UTC (rev 9265)
@@ -4,6 +4,7 @@
import org.jboss.tools.flow.editor.core.NodeWrapper;
import org.jboss.tools.flow.jpdl4.core.Node;
import org.jboss.tools.flow.jpdl4.core.Process;
+import org.jboss.tools.flow.jpdl4.core.StartState;
public class ProcessWrapper extends AbstractRootWrapper {
@@ -53,4 +54,11 @@
getProcess().removeNode(((BaseNodeWrapper) element).getNode());
}
+ public boolean acceptsElement(NodeWrapper element) {
+ if (element.getElement() instanceof StartState) {
+ return getProcess().getStartState() == null;
+ }
+ return super.acceptsElement(element);
+ }
+
}
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/StartStateWrapper.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/StartStateWrapper.java 2008-07-24 12:53:35 UTC (rev 9264)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/StartStateWrapper.java 2008-07-24 12:54:41 UTC (rev 9265)
@@ -21,8 +21,4 @@
return false;
}
- public boolean acceptsOutgoingConnection(AbstractConnectionWrapper connection, NodeWrapper target) {
- return super.acceptsOutgoingConnection(connection, (BaseNodeWrapper)target)
- && getOutgoingConnections().isEmpty();
- }
}
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/StateWrapper.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/StateWrapper.java 2008-07-24 12:53:35 UTC (rev 9264)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4.graph/src/org/jboss/tools/flow/jpdl4/graph/wrapper/StateWrapper.java 2008-07-24 12:54:41 UTC (rev 9265)
@@ -1,7 +1,5 @@
package org.jboss.tools.flow.jpdl4.graph.wrapper;
-import org.jboss.tools.flow.editor.core.AbstractConnectionWrapper;
-import org.jboss.tools.flow.editor.core.NodeWrapper;
import org.jboss.tools.flow.jpdl4.core.State;
public class StateWrapper extends BaseNodeWrapper {
@@ -15,14 +13,5 @@
return (State) getElement();
}
- public boolean acceptsIncomingConnection(AbstractConnectionWrapper connection, NodeWrapper source) {
- return super.acceptsIncomingConnection(connection, (BaseNodeWrapper)source)
- && getIncomingConnections().isEmpty();
- }
-
- public boolean acceptsOutgoingConnection(AbstractConnectionWrapper connection, NodeWrapper target) {
- return super.acceptsOutgoingConnection(connection, (BaseNodeWrapper)target)
- && getOutgoingConnections().isEmpty();
- }
}
16 years, 5 months
JBoss Tools SVN: r9264 - trunk/flow/plugins/org.jboss.tools.flow.common.graph/src/main/java/org/jboss/tools/flow/editor/command.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2008-07-24 08:53:35 -0400 (Thu, 24 Jul 2008)
New Revision: 9264
Modified:
trunk/flow/plugins/org.jboss.tools.flow.common.graph/src/main/java/org/jboss/tools/flow/editor/command/SplitConnectionCommand.java
Log:
add support to overrule node add when not appropriate
Modified: trunk/flow/plugins/org.jboss.tools.flow.common.graph/src/main/java/org/jboss/tools/flow/editor/command/SplitConnectionCommand.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common.graph/src/main/java/org/jboss/tools/flow/editor/command/SplitConnectionCommand.java 2008-07-24 12:52:32 UTC (rev 9263)
+++ trunk/flow/plugins/org.jboss.tools.flow.common.graph/src/main/java/org/jboss/tools/flow/editor/command/SplitConnectionCommand.java 2008-07-24 12:53:35 UTC (rev 9264)
@@ -84,5 +84,11 @@
newElement.setParent(null);
oldConnection.connect(oldSource, oldTarget);
}
+
+ public boolean canExecute() {
+ return parent.acceptsElement(newElement) &&
+ newElement.acceptsIncomingConnection(oldConnection, oldSource) &&
+ newElement.acceptsOutgoingConnection(secondConnection, oldTarget);
+ }
}
16 years, 5 months
JBoss Tools SVN: r9263 - in trunk/flow/plugins/org.jboss.tools.flow.common.graph/src/main/java/org/jboss/tools/flow/editor: core and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2008-07-24 08:52:32 -0400 (Thu, 24 Jul 2008)
New Revision: 9263
Modified:
trunk/flow/plugins/org.jboss.tools.flow.common.graph/src/main/java/org/jboss/tools/flow/editor/command/AddElementCommand.java
trunk/flow/plugins/org.jboss.tools.flow.common.graph/src/main/java/org/jboss/tools/flow/editor/core/AbstractRootWrapper.java
trunk/flow/plugins/org.jboss.tools.flow.common.graph/src/main/java/org/jboss/tools/flow/editor/core/ContainerWrapper.java
Log:
add support to overrule node add
Modified: trunk/flow/plugins/org.jboss.tools.flow.common.graph/src/main/java/org/jboss/tools/flow/editor/command/AddElementCommand.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common.graph/src/main/java/org/jboss/tools/flow/editor/command/AddElementCommand.java 2008-07-24 09:14:15 UTC (rev 9262)
+++ trunk/flow/plugins/org.jboss.tools.flow.common.graph/src/main/java/org/jboss/tools/flow/editor/command/AddElementCommand.java 2008-07-24 12:52:32 UTC (rev 9263)
@@ -55,5 +55,9 @@
parent.removeElement(child);
child.setParent(null);
}
+
+ public boolean canExecute() {
+ return parent.acceptsElement(child);
+ }
}
Modified: trunk/flow/plugins/org.jboss.tools.flow.common.graph/src/main/java/org/jboss/tools/flow/editor/core/AbstractRootWrapper.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common.graph/src/main/java/org/jboss/tools/flow/editor/core/AbstractRootWrapper.java 2008-07-24 09:14:15 UTC (rev 9262)
+++ trunk/flow/plugins/org.jboss.tools.flow.common.graph/src/main/java/org/jboss/tools/flow/editor/core/AbstractRootWrapper.java 2008-07-24 12:52:32 UTC (rev 9263)
@@ -59,6 +59,7 @@
}
public void addElement(NodeWrapper element) {
+ if (!acceptsElement(element)) return;
internalAddElement(element);
localAddElement(element);
notifyListeners(CHANGE_ELEMENTS);
@@ -68,6 +69,10 @@
elements.put(element.getId(), element);
}
+ public boolean acceptsElement(NodeWrapper element) {
+ return true;
+ }
+
protected abstract void internalAddElement(NodeWrapper element);
public void removeElement(NodeWrapper element) {
Modified: trunk/flow/plugins/org.jboss.tools.flow.common.graph/src/main/java/org/jboss/tools/flow/editor/core/ContainerWrapper.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common.graph/src/main/java/org/jboss/tools/flow/editor/core/ContainerWrapper.java 2008-07-24 09:14:15 UTC (rev 9262)
+++ trunk/flow/plugins/org.jboss.tools.flow.common.graph/src/main/java/org/jboss/tools/flow/editor/core/ContainerWrapper.java 2008-07-24 12:52:32 UTC (rev 9263)
@@ -29,5 +29,7 @@
List<NodeWrapper> getElements();
AbstractRootWrapper getProcessWrapper();
+
+ boolean acceptsElement(NodeWrapper element);
}
16 years, 5 months
JBoss Tools SVN: r9262 - in trunk/drools/plugins/org.jboss.tools.flow.ruleflow: .settings and 14 other directories.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2008-07-24 05:14:15 -0400 (Thu, 24 Jul 2008)
New Revision: 9262
Added:
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/.classpath
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/.project
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/.settings/
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/.settings/org.eclipse.jdt.core.prefs
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/META-INF/
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/icons/
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/icons/process.gif
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/icons/processV.gif
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/icons/start.gif
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/lib/
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/lib/drools-core.jar
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/plugin.xml
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/Activator.java
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/
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/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/core/BaseNodeWrapper.java
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/core/ConnectionWrapper.java
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/core/ConnectionWrapperFactory.java
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/core/ProcessWrapper.java
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/core/StartNodeWrapper.java
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/core/SubProcessWrapper.java
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/editpart/
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/editpart/ConnectionWrapperEditPart.java
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/editpart/RuleFlowEditPartFactory.java
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/editpart/StartNodeEditPart.java
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/editpart/SubProcessEditPart.java
Modified:
trunk/drools/plugins/org.jboss.tools.flow.ruleflow/
Log:
initial upload
Property changes on: trunk/drools/plugins/org.jboss.tools.flow.ruleflow
___________________________________________________________________
Name: svn:ignore
+ target
Added: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/.classpath
===================================================================
--- trunk/drools/plugins/org.jboss.tools.flow.ruleflow/.classpath (rev 0)
+++ trunk/drools/plugins/org.jboss.tools.flow.ruleflow/.classpath 2008-07-24 09:14:15 UTC (rev 9262)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <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="output" path="target/classes"/>
+</classpath>
Added: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/.project
===================================================================
--- trunk/drools/plugins/org.jboss.tools.flow.ruleflow/.project (rev 0)
+++ trunk/drools/plugins/org.jboss.tools.flow.ruleflow/.project 2008-07-24 09:14:15 UTC (rev 9262)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.flow.ruleflow</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: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/drools/plugins/org.jboss.tools.flow.ruleflow/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/drools/plugins/org.jboss.tools.flow.ruleflow/.settings/org.eclipse.jdt.core.prefs 2008-07-24 09:14:15 UTC (rev 9262)
@@ -0,0 +1,7 @@
+#Tue Jul 15 11:45:52 CEST 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: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/META-INF/MANIFEST.MF
===================================================================
--- trunk/drools/plugins/org.jboss.tools.flow.ruleflow/META-INF/MANIFEST.MF (rev 0)
+++ trunk/drools/plugins/org.jboss.tools.flow.ruleflow/META-INF/MANIFEST.MF 2008-07-24 09:14:15 UTC (rev 9262)
@@ -0,0 +1,18 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: JBoss Tools Ruleflow Plug-in
+Bundle-SymbolicName: org.jboss.tools.flow.ruleflow;singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Activator: org.jboss.tools.process.ruleflow.Activator
+Bundle-Vendor: JBoss
+Require-Bundle:
+ org.eclipse.core.resources,
+ org.eclipse.core.runtime,
+ org.eclipse.gef,
+ org.eclipse.ui,
+ org.eclipse.ui.ide,
+ org.jboss.tools.flow.common.graph
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: .,
+ lib/drools-core.jar
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
Added: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/build.properties
===================================================================
--- trunk/drools/plugins/org.jboss.tools.flow.ruleflow/build.properties (rev 0)
+++ trunk/drools/plugins/org.jboss.tools.flow.ruleflow/build.properties 2008-07-24 09:14:15 UTC (rev 9262)
@@ -0,0 +1,6 @@
+source.. = src/main/java/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ lib/drools-core.jar
Added: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/icons/process.gif
===================================================================
(Binary files differ)
Property changes on: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/icons/process.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/icons/processV.gif
===================================================================
(Binary files differ)
Property changes on: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/icons/processV.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/icons/start.gif
===================================================================
(Binary files differ)
Property changes on: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/icons/start.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/lib/drools-core.jar
===================================================================
(Binary files differ)
Property changes on: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/lib/drools-core.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/plugin.xml
===================================================================
--- trunk/drools/plugins/org.jboss.tools.flow.ruleflow/plugin.xml (rev 0)
+++ trunk/drools/plugins/org.jboss.tools.flow.ruleflow/plugin.xml 2008-07-24 09:14:15 UTC (rev 9262)
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+
+ <extension point="org.eclipse.ui.editors">
+ <editor
+ name="RuleFlow Editor"
+ extensions="rf"
+ icon="icons/process.gif"
+ contributorClass="org.jboss.tools.process.editor.GenericActionBarContributor"
+ class="org.jboss.tools.process.ruleflow.editor.RuleFlowEditor"
+ id="org.jboss.tools.process.ruleflow.editor.RuleFlowModelEditor">
+ </editor>
+ </extension>
+
+ <extension
+ point = "org.eclipse.ui.editorActions">
+ <editorContribution
+ id="org.jboss.tools.process.editor.action.VerticalAutoLayoutAction"
+ targetID="org.jboss.tools.process.ruleflow.editor.RuleFlowModelEditor">
+ <action
+ id="org.jboss.tools.process.editor.action.VerticalAutoLayoutAction"
+ label="Auto Layout (Vertical)"
+ toolbarPath="Process"
+ icon="icons/processV.gif"
+ tooltip="Auto layout the process (vertical)"
+ class="org.jboss.tools.process.editor.action.VerticalAutoLayoutAction"
+ />
+ </editorContribution>
+ <editorContribution
+ id="org.jboss.tools.process.editor.action.HorizontalAutoLayoutAction"
+ targetID="org.jboss.tools.process.ruleflow.editor.RuleFlowModelEditor">
+ <action
+ id="org.jboss.tools.process.editor.action.HorizontalAutoLayoutAction"
+ label="Auto Layout (Horizontal)"
+ toolbarPath="Process"
+ icon="icons/process.gif"
+ tooltip="Auto layout the process (horizontal)"
+ class="org.jboss.tools.process.editor.action.HorizontalAutoLayoutAction"
+ />
+ </editorContribution>
+ </extension>
+
+</plugin>
Added: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/Activator.java
===================================================================
--- trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/Activator.java (rev 0)
+++ trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/Activator.java 2008-07-24 09:14:15 UTC (rev 9262)
@@ -0,0 +1,45 @@
+package org.jboss.tools.process.ruleflow;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+public class Activator extends AbstractUIPlugin {
+
+ public static final String PLUGIN_ID = "org.jboss.tools.process.ruleflow";
+
+ private static Activator plugin;
+
+ public Activator() {
+ }
+
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
Added: 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 (rev 0)
+++ trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/RuleFlowEditor.java 2008-07-24 09:14:15 UTC (rev 9262)
@@ -0,0 +1,71 @@
+package org.jboss.tools.process.ruleflow.editor;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+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.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;
+
+/**
+ * Graphical editor for a RuleFlow.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+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;
+ }
+
+ public ProcessWrapper getRuleFlowModel() {
+ return (ProcessWrapper) getModel();
+ }
+
+ protected void writeModel(OutputStream os) throws IOException {
+ // TODO
+ }
+
+ protected void createModel(InputStream is) {
+ // TODO
+ setModel(createModel());
+ }
+}
Added: 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 (rev 0)
+++ trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/RuleFlowPaletteFactory.java 2008-07-24 09:14:15 UTC (rev 9262)
@@ -0,0 +1,69 @@
+package org.jboss.tools.process.ruleflow.editor;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gef.palette.CombinedTemplateCreationEntry;
+import org.eclipse.gef.palette.PaletteEntry;
+import org.eclipse.gef.requests.SimpleFactory;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.jboss.tools.flow.editor.PaletteFactory;
+import org.jboss.tools.process.ruleflow.Activator;
+import org.jboss.tools.process.ruleflow.editor.core.ConnectionWrapperFactory;
+import org.jboss.tools.process.ruleflow.editor.core.StartNodeWrapper;
+import org.jboss.tools.process.ruleflow.editor.core.SubProcessWrapper;
+
+/**
+ * Factory for creating a RuleFlow palette.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public class RuleFlowPaletteFactory extends PaletteFactory {
+
+ public RuleFlowPaletteFactory() {
+ super(new ConnectionWrapperFactory());
+ }
+
+ protected List<PaletteEntry> createComponentEntries() {
+ List<PaletteEntry> entries = new ArrayList<PaletteEntry>();
+
+ CombinedTemplateCreationEntry combined = new CombinedTemplateCreationEntry(
+ "Start",
+ "Create a new Start",
+ StartNodeWrapper.class,
+ new SimpleFactory(StartNodeWrapper.class),
+ ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/start.gif")),
+ ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/start.gif"))
+ );
+ entries.add(combined);
+
+ combined = new CombinedTemplateCreationEntry(
+ "SubProcess",
+ "Create a new sub-process",
+ SubProcessWrapper.class,
+ new SimpleFactory(SubProcessWrapper.class),
+ 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/core/BaseNodeWrapper.java
===================================================================
--- trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/core/BaseNodeWrapper.java (rev 0)
+++ trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/core/BaseNodeWrapper.java 2008-07-24 09:14:15 UTC (rev 9262)
@@ -0,0 +1,85 @@
+package org.jboss.tools.process.ruleflow.editor.core;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.drools.workflow.core.Node;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.jboss.tools.flow.editor.core.AbstractConnectionWrapper;
+import org.jboss.tools.flow.editor.core.AbstractNodeWrapper;
+import org.jboss.tools.flow.editor.core.NodeWrapper;
+
+/**
+ * Wrapper for a node.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public abstract class BaseNodeWrapper extends AbstractNodeWrapper {
+
+ public void setNode(Node node) {
+ setElement(node);
+ }
+
+ public Node getNode() {
+ return (Node) getElement();
+ }
+
+ public String getId() {
+ long id = getNode().getId();
+ return id == -1 ? null : getNode().getId() + "";
+ }
+
+ public String getName() {
+ return getNode().getName();
+ }
+
+ public void internalSetName(String name) {
+ getNode().setName(name);
+ notifyListeners(CHANGE_VISUAL);
+ }
+
+ protected void internalSetConstraint(Rectangle constraint) {
+ Node node = getNode();
+ node.setMetaData("x", constraint.x);
+ node.setMetaData("y", constraint.y);
+ node.setMetaData("width", constraint.width);
+ node.setMetaData("height", constraint.height);
+ }
+
+ public Rectangle internalGetConstraint() {
+ Node node = getNode();
+ Integer x = (Integer) node.getMetaData("x");
+ Integer y = (Integer) node.getMetaData("y");
+ Integer width = (Integer) node.getMetaData("width");
+ Integer height = (Integer) node.getMetaData("height");
+ return new Rectangle(
+ x == null ? 0 : x,
+ y == null ? 0 : y,
+ width == null ? -1 : width,
+ height == null ? -1 : height);
+ }
+
+ public boolean acceptsIncomingConnection(AbstractConnectionWrapper connection, NodeWrapper source) {
+ return source == null
+ || ((BaseNodeWrapper) source).getNode().getNodeContainer() == getNode().getNodeContainer();
+ }
+
+ public boolean acceptsOutgoingConnection(AbstractConnectionWrapper connection, NodeWrapper target) {
+ return target == null
+ || ((BaseNodeWrapper) target).getNode().getNodeContainer() == getNode().getNodeContainer();
+ }
+
+}
Added: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/core/ConnectionWrapper.java
===================================================================
--- trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/core/ConnectionWrapper.java (rev 0)
+++ trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/core/ConnectionWrapper.java 2008-07-24 09:14:15 UTC (rev 9262)
@@ -0,0 +1,100 @@
+package org.jboss.tools.process.ruleflow.editor.core;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.drools.workflow.core.Connection;
+import org.drools.workflow.core.Node;
+import org.drools.workflow.core.impl.ConnectionImpl;
+import org.eclipse.draw2d.geometry.Point;
+import org.jboss.tools.flow.editor.core.AbstractConnectionWrapper;
+import org.jboss.tools.flow.editor.core.NodeWrapper;
+
+/**
+ * Wrapper for a connection.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public class ConnectionWrapper extends AbstractConnectionWrapper {
+
+ private static final long serialVersionUID = 400L;
+
+ private Connection connection;
+
+ public ConnectionWrapper() {
+ }
+
+ public Connection getConnection() {
+ return connection;
+ }
+
+ public void localSetConnection(Connection connection) {
+ this.connection = (ConnectionImpl) connection;
+ }
+
+ public void disconnect() {
+ super.disconnect();
+ ((ConnectionImpl) connection).terminate();
+ connection = null;
+ }
+
+ public void connect(NodeWrapper source, NodeWrapper target) {
+ super.connect(source, target);
+ Node from = ((BaseNodeWrapper) getSource()).getNode();
+ Node to = ((BaseNodeWrapper) getTarget()).getNode();
+ connection = new ConnectionImpl(from, Node.CONNECTION_DEFAULT_TYPE, to, Node.CONNECTION_DEFAULT_TYPE);
+ }
+
+ protected List<Point> internalGetBendpoints() {
+ return (List<Point>) stringToBendpoints((String) connection.getMetaData("bendpoints"));
+ }
+
+ protected void internalSetBendpoints(List<Point> bendpoints) {
+ connection.setMetaData("bendpoints", bendpointsToString(bendpoints));
+ }
+
+ private String bendpointsToString(List<Point> bendpoints) {
+ if (bendpoints == null) {
+ return null;
+ }
+ String result = "[";
+ for (Iterator<Point> iterator = bendpoints.iterator(); iterator.hasNext(); ) {
+ Point point = iterator.next();
+ result += point.x + "," + point.y + (iterator.hasNext() ? ";" : "");
+ }
+ result += "]";
+ return result;
+ }
+
+ private List<Point> stringToBendpoints(String s) {
+ List<Point> result = new ArrayList<Point>();
+ if (s == null) {
+ return result;
+ }
+ s = s.substring(1, s.length() - 1);
+ String[] bendpoints = s.split(";");
+ for (String bendpoint: bendpoints) {
+ String[] xy = bendpoint.split(",");
+ result.add(new Point(new Integer(xy[0]), new Integer(xy[1])));
+ }
+ return result;
+ }
+
+}
Added: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/core/ConnectionWrapperFactory.java
===================================================================
--- trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/core/ConnectionWrapperFactory.java (rev 0)
+++ trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/core/ConnectionWrapperFactory.java 2008-07-24 09:14:15 UTC (rev 9262)
@@ -0,0 +1,33 @@
+package org.jboss.tools.process.ruleflow.editor.core;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.jboss.tools.flow.editor.core.AbstractConnectionWrapper;
+import org.jboss.tools.flow.editor.core.ConnectionFactory;
+
+/**
+ * Factory for creating a connection wrapper.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public class ConnectionWrapperFactory implements ConnectionFactory {
+
+ public AbstractConnectionWrapper createElementConnection() {
+ return new ConnectionWrapper();
+ }
+
+}
Added: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/core/ProcessWrapper.java
===================================================================
--- trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/core/ProcessWrapper.java (rev 0)
+++ trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/core/ProcessWrapper.java 2008-07-24 09:14:15 UTC (rev 9262)
@@ -0,0 +1,77 @@
+package org.jboss.tools.process.ruleflow.editor.core;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.drools.ruleflow.core.RuleFlowProcess;
+import org.drools.workflow.core.Node;
+import org.jboss.tools.flow.editor.core.AbstractRootWrapper;
+import org.jboss.tools.flow.editor.core.NodeWrapper;
+
+/**
+ * Wrapper for a RuleFlow process.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public class ProcessWrapper extends AbstractRootWrapper {
+
+ private static final long serialVersionUID = 400L;
+
+ public ProcessWrapper() {
+ setElement(new RuleFlowProcess());
+ }
+
+ public RuleFlowProcess getRuleFlowProcess() {
+ return (RuleFlowProcess) getElement();
+ }
+
+ public String getName() {
+ return getRuleFlowProcess().getName();
+ }
+
+ public void setName(String name) {
+ getRuleFlowProcess().setName(name);
+ }
+
+ public Integer getRouterLayout() {
+ Integer routerLayout = (Integer) getRuleFlowProcess().getMetaData("routerLayout");
+ if (routerLayout == null) {
+ return ROUTER_LAYOUT_MANUAL;
+ }
+ return routerLayout;
+ }
+
+ public void internalSetRouterLayout(Integer routerLayout) {
+ getRuleFlowProcess().setMetaData("routerLayout", routerLayout);
+ }
+
+ protected void internalAddElement(NodeWrapper element) {
+ Node node = ((BaseNodeWrapper) element).getNode();
+ long id = 0;
+ for (Node n: getRuleFlowProcess().getNodes()) {
+ if (n.getId() > id) {
+ id = n.getId();
+ }
+ }
+ node.setId(++id);
+ getRuleFlowProcess().addNode(node);
+ }
+
+ protected void internalRemoveElement(NodeWrapper element) {
+ getRuleFlowProcess().removeNode(((BaseNodeWrapper) element).getNode());
+ }
+
+}
Added: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/core/StartNodeWrapper.java
===================================================================
--- trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/core/StartNodeWrapper.java (rev 0)
+++ trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/core/StartNodeWrapper.java 2008-07-24 09:14:15 UTC (rev 9262)
@@ -0,0 +1,49 @@
+package org.jboss.tools.process.ruleflow.editor.core;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.drools.workflow.core.node.StartNode;
+import org.jboss.tools.flow.editor.core.AbstractConnectionWrapper;
+import org.jboss.tools.flow.editor.core.NodeWrapper;
+
+/**
+ * Wrapper for a start node.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public class StartNodeWrapper extends BaseNodeWrapper {
+
+ private static final long serialVersionUID = 1L;
+
+ public StartNodeWrapper() {
+ setNode(new StartNode());
+ setName("Start");
+ }
+
+ public StartNode getStartNode() {
+ return (StartNode) getNode();
+ }
+
+ public boolean acceptsIncomingConnection(AbstractConnectionWrapper connection, NodeWrapper source) {
+ return false;
+ }
+
+ public boolean acceptsOutgoingConnection(AbstractConnectionWrapper connection, NodeWrapper target) {
+ return super.acceptsOutgoingConnection(connection, target)
+ && getOutgoingConnections().isEmpty();
+ }
+}
Added: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/core/SubProcessWrapper.java
===================================================================
--- trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/core/SubProcessWrapper.java (rev 0)
+++ trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/core/SubProcessWrapper.java 2008-07-24 09:14:15 UTC (rev 9262)
@@ -0,0 +1,51 @@
+package org.jboss.tools.process.ruleflow.editor.core;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.drools.workflow.core.node.SubProcessNode;
+import org.jboss.tools.flow.editor.core.AbstractConnectionWrapper;
+import org.jboss.tools.flow.editor.core.NodeWrapper;
+
+/**
+ * Wrapper for a SubProcess node.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public class SubProcessWrapper extends BaseNodeWrapper {
+
+ private static final long serialVersionUID = 1L;
+
+ public SubProcessWrapper() {
+ setNode(new SubProcessNode());
+ getSubProcessNode().setName("SubProcess");
+ }
+
+ public SubProcessNode getSubProcessNode() {
+ return (SubProcessNode) getNode();
+ }
+
+ public boolean acceptsIncomingConnection(AbstractConnectionWrapper connection, NodeWrapper source) {
+ return super.acceptsIncomingConnection(connection, source)
+ && getIncomingConnections().isEmpty();
+ }
+
+ public boolean acceptsOutgoingConnection(AbstractConnectionWrapper connection, NodeWrapper target) {
+ return super.acceptsOutgoingConnection(connection, target)
+ && getOutgoingConnections().isEmpty();
+ }
+
+}
Added: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/editpart/ConnectionWrapperEditPart.java
===================================================================
--- trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/editpart/ConnectionWrapperEditPart.java (rev 0)
+++ trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/editpart/ConnectionWrapperEditPart.java 2008-07-24 09:14:15 UTC (rev 9262)
@@ -0,0 +1,29 @@
+package org.jboss.tools.process.ruleflow.editor.editpart;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.jboss.tools.flow.editor.core.ConnectionFactory;
+import org.jboss.tools.flow.editor.editpart.ConnectionEditPart;
+import org.jboss.tools.process.ruleflow.editor.core.ConnectionWrapperFactory;
+
+public class ConnectionWrapperEditPart extends ConnectionEditPart {
+
+ protected ConnectionFactory getElementConnectionFactory() {
+ return new ConnectionWrapperFactory();
+ }
+
+}
Added: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/editpart/RuleFlowEditPartFactory.java
===================================================================
--- trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/editpart/RuleFlowEditPartFactory.java (rev 0)
+++ trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/editpart/RuleFlowEditPartFactory.java 2008-07-24 09:14:15 UTC (rev 9262)
@@ -0,0 +1,52 @@
+package org.jboss.tools.process.ruleflow.editor.editpart;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartFactory;
+import org.jboss.tools.flow.editor.editpart.RootEditPart;
+import org.jboss.tools.process.ruleflow.editor.core.ConnectionWrapper;
+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.core.SubProcessWrapper;
+
+/**
+ * Factory for RuleFlow EditParts.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public class RuleFlowEditPartFactory implements EditPartFactory {
+
+ public EditPart createEditPart(EditPart context, Object model) {
+ EditPart result = null;
+ if (model instanceof ProcessWrapper) {
+ result = new RootEditPart();
+ } else if (model instanceof StartNodeWrapper) {
+ result = new StartNodeEditPart();
+ } else if (model instanceof SubProcessWrapper) {
+ result = new SubProcessEditPart();
+ } else if (model instanceof ConnectionWrapper) {
+ result = new ConnectionWrapperEditPart();
+ } else {
+ throw new IllegalArgumentException(
+ "Unknown model object " + model);
+ }
+ result.setModel(model);
+ return result;
+ }
+
+}
Added: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/editpart/StartNodeEditPart.java
===================================================================
--- trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/editpart/StartNodeEditPart.java (rev 0)
+++ trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/editpart/StartNodeEditPart.java 2008-07-24 09:14:15 UTC (rev 9262)
@@ -0,0 +1,42 @@
+package org.jboss.tools.process.ruleflow.editor.editpart;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+import org.jboss.tools.flow.editor.editpart.ElementEditPart;
+import org.jboss.tools.flow.editor.figure.RectangleElementFigure;
+import org.jboss.tools.process.ruleflow.Activator;
+
+/**
+ * EditPart for a start node.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public class StartNodeEditPart extends ElementEditPart {
+
+ private static final Image ICON = ImageDescriptor.createFromURL(
+ Activator.getDefault().getBundle().getEntry("icons/start.gif")).createImage();
+
+ protected IFigure createFigure() {
+ RectangleElementFigure figure = new RectangleElementFigure();
+ figure.setIcon(ICON);
+ return figure;
+ }
+
+}
Added: trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/editpart/SubProcessEditPart.java
===================================================================
--- trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/editpart/SubProcessEditPart.java (rev 0)
+++ trunk/drools/plugins/org.jboss.tools.flow.ruleflow/src/main/java/org/jboss/tools/process/ruleflow/editor/editpart/SubProcessEditPart.java 2008-07-24 09:14:15 UTC (rev 9262)
@@ -0,0 +1,47 @@
+package org.jboss.tools.process.ruleflow.editor.editpart;
+
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.eclipse.draw2d.IFigure;
+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.editor.editpart.ElementEditPart;
+import org.jboss.tools.flow.editor.figure.RoundedRectangleElementFigure;
+import org.jboss.tools.process.ruleflow.Activator;
+
+/**
+ * EditPart for a SubFlow node.
+ *
+ * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
+ */
+public class SubProcessEditPart extends ElementEditPart {
+
+ private static final Image ICON = ImageDescriptor.createFromURL(
+ Activator.getDefault().getBundle().getEntry("icons/process.gif")).createImage();
+ // TODO dispose color when no longer needed
+ private static final Color COLOR = new Color(Display.getCurrent(), 255, 250, 205);
+
+ protected IFigure createFigure() {
+ RoundedRectangleElementFigure figure = new RoundedRectangleElementFigure();
+ figure.setIcon(ICON);
+ figure.setColor(COLOR);
+ return figure;
+ }
+
+}
16 years, 5 months
JBoss Tools SVN: r9260 - trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2008-07-23 21:24:13 -0400 (Wed, 23 Jul 2008)
New Revision: 9260
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileAnyImpl.java
Log:
fix PMD violations
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileAnyImpl.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileAnyImpl.java 2008-07-24 01:23:07 UTC (rev 9259)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileAnyImpl.java 2008-07-24 01:24:13 UTC (rev 9260)
@@ -11,6 +11,7 @@
package org.jboss.tools.common.model.filesystems.impl;
import java.io.File;
+import java.io.IOException;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.*;
@@ -217,7 +218,7 @@
if(f.isFile()) {
try {
return f.getCanonicalPath().replace('\\', '/');
- } catch (Exception e) {
+ } catch (IOException e) {
//ignore - if file does not exist, do replacements in other way
}
}
16 years, 5 months
JBoss Tools SVN: r9259 - trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2008-07-23 21:23:07 -0400 (Wed, 23 Jul 2008)
New Revision: 9259
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsLoader.java
Log:
fix PMD violations
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsLoader.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsLoader.java 2008-07-24 00:54:46 UTC (rev 9258)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsLoader.java 2008-07-24 01:23:07 UTC (rev 9259)
@@ -11,6 +11,7 @@
package org.jboss.tools.common.model.filesystems.impl;
import java.io.File;
+import java.io.IOException;
import java.util.*;
import org.eclipse.core.resources.IFile;
@@ -167,9 +168,11 @@
newPaths = EclipseResourceUtil.getClassPath(project.getProject());
List<String> jre = EclipseResourceUtil.getJREClassPath(project.getProject());
if(jre != null) newPaths.removeAll(jre);
- } catch (Exception e) {
+ } catch (CoreException e) {
//TODO
ModelPlugin.getDefault().logError(e);
+ } catch (IOException e) {
+ ModelPlugin.getDefault().logError(e);
}
if(paths == null && newPaths == null) return;
if((newPaths == null || paths == null) || (paths.size() != newPaths.size())) {
16 years, 5 months