merge fix for '132188 - Bindings from a message variable to a function are lost' from trunk
1.1 --- a/bpel.mapper/src/org/netbeans/modules/bpel/mapper/model/BpelMapperModel.java Mon Apr 07 17:57:43 2008 +0400
1.2 +++ b/bpel.mapper/src/org/netbeans/modules/bpel/mapper/model/BpelMapperModel.java Mon Apr 07 19:00:14 2008 +0400
1.3 @@ -83,7 +83,8 @@
1.4 //
1.5 mConnectionConstraints = new ConnectionConstraint[] {
1.6 ConnectionConstraint.Access.getGeneralConstraint(this),
1.7 - ConnectionConstraint.Access.getPlConstraint()
1.8 + ConnectionConstraint.Access.getPlConstraint(),
1.9 + ConnectionConstraint.Access.getMVarConstraint()
1.10 };
1.11 }
1.12
2.1 --- a/bpel.mapper/src/org/netbeans/modules/bpel/mapper/model/ConnectionConstraint.java Mon Apr 07 17:57:43 2008 +0400
2.2 +++ b/bpel.mapper/src/org/netbeans/modules/bpel/mapper/model/ConnectionConstraint.java Mon Apr 07 19:00:14 2008 +0400
2.3 @@ -22,6 +22,7 @@
2.4 import org.netbeans.modules.bpel.mapper.tree.MapperSwingTreeModel;
2.5 import org.netbeans.modules.bpel.mapper.tree.MapperTreeNode;
2.6 import org.netbeans.modules.bpel.model.api.PartnerLink;
2.7 +import org.netbeans.modules.bpel.model.api.Variable;
2.8 import org.netbeans.modules.bpel.model.api.support.Roles;
2.9 import org.netbeans.modules.soa.mappercore.model.Graph;
2.10 import org.netbeans.modules.soa.mappercore.model.Link;
2.11 @@ -53,6 +54,10 @@
2.12 public static ConnectionConstraint getPlConstraint() {
2.13 return new PlConstraint();
2.14 }
2.15 +
2.16 + public static ConnectionConstraint getMVarConstraint() {
2.17 + return new MVarConstraint();
2.18 + }
2.19 }
2.20
2.21 class GeneralConstraint implements ConnectionConstraint {
2.22 @@ -172,4 +177,34 @@
2.23 return true;
2.24 }
2.25 }
2.26 +
2.27 + class MVarConstraint implements ConnectionConstraint {
2.28 +
2.29 + public boolean canConnect(TreePath treePath, SourcePin source,
2.30 + TargetPin target, TreePath oldTreePath,
2.31 + Link oldLink)
2.32 + {
2.33 + if (target instanceof VertexItem) {
2.34 + if (source instanceof TreeSourcePin) {
2.35 + TreePath tPath = ((TreeSourcePin)source).getTreePath();
2.36 + Object node = tPath.getLastPathComponent();
2.37 + if (node instanceof MapperTreeNode) {
2.38 + Object dataObj = ((MapperTreeNode)node).getDataObject();
2.39 + if (isMessageVariable(dataObj)) {
2.40 + return false;
2.41 + }
2.42 + }
2.43 + }
2.44 + }
2.45 + return true;
2.46 + }
2.47 +
2.48 + private boolean isMessageVariable(Object obj) {
2.49 + if (! (obj instanceof Variable)) {
2.50 + return false;
2.51 + }
2.52 + Variable var = (Variable)obj;
2.53 + return var.getMessageType() != null;
2.54 + }
2.55 + }
2.56 }