diff --git a/AlgebraicDataflowArchitectureModel/src/graphicalrefactor/editor/Editor.java b/AlgebraicDataflowArchitectureModel/src/graphicalrefactor/editor/Editor.java index ca28124..8715432 100644 --- a/AlgebraicDataflowArchitectureModel/src/graphicalrefactor/editor/Editor.java +++ b/AlgebraicDataflowArchitectureModel/src/graphicalrefactor/editor/Editor.java @@ -226,9 +226,6 @@ } } } - - graph.setAllowDanglingEdges(false); - graph.setCellsDisconnectable(false); } finally { graph.getModel().endUpdate(); } @@ -261,4 +258,24 @@ graph.getModel().endUpdate(); } } + + public boolean connectEdge(mxCell src, mxCell dst) { + ChannelGenerator srcCh = model.getChannelGenerator((String) src.getValue()); + if (srcCh == null) { + srcCh = model.getIOChannelGenerator((String) src.getValue()); + if (srcCh == null) { + IdentifierTemplate srcRes = model.getIdentifierTemplate((String) src.getValue()); + ChannelGenerator dstCh = model.getChannelGenerator((String) dst.getValue()); + if (srcRes == null || dstCh == null) return false; + ChannelMember srcCm = new ChannelMember(srcRes); + ((DataflowChannelGenerator ) dstCh).addChannelMemberAsInput(srcCm); + return true; + } + } + IdentifierTemplate dstRes = model.getIdentifierTemplate((String) dst.getValue()); + if (dstRes == null) return false; + ChannelMember dstCm = new ChannelMember(dstRes); + ((DataflowChannelGenerator) srcCh).addChannelMemberAsOutput(dstCm); + return true; + } }