private boolean hasMultipleOutgoingSequenceFlow(IDiagramElementView view){ IConnectableElement connectable = (IConnectableElement) view; int i = 0; for(IConnector c:connectable.getOutgoingConnectors()){ if (c instanceof SequenceFlow){ i++; }else{ return false; } } if (i>1){ return true; } return false; }
private boolean hasOneOutgoingSequenceFlow(IDiagramElementView view){ IConnectableElement connectable = (IConnectableElement) view; int i = 0; for(IConnector c:connectable.getOutgoingConnectors()){ if (c instanceof SequenceFlow){ i++; }else{ return false; } } if (i==1){ return true; } return false; }
private HashSet<IConnector> getOutgoingSequenceFlows(IConnectableElement connectable){ HashSet<IConnector> result = new HashSet<IConnector>(); for(IConnector connector:connectable.getOutgoingConnectors()){ if (connector instanceof SequenceFlow){ result.add(connector); } } return result; }
@Override public void onDisplay(DisplayEvent event) { IHasLookupProxy lookupProxy = (IHasLookupProxy) activityEditorModel; IConnectableElement activity = (IConnectableElement) lookupProxy.lookup(CoreBPMNElement.class); ArrayList<ISequenceFlowBean> seqFlows = new ArrayList<ISequenceFlowBean>(); for(IConnector connector:activity.getOutgoingConnectors()){ if (connector instanceof SequenceFlow){ SequenceFlow sf = (SequenceFlow) connector; seqFlows.add((ISequenceFlowBean)sf.getDiagramElement().getModelElement()); } } list.setOptions(seqFlows); }
if (connectable.getOutgoingConnectors().size()==0) return true;//A rule should check if we have outgoing connectors for(IConnector c:connectable.getOutgoingConnectors()){ if (found==connectable.getOutgoingConnectors().size()-1){ return true;
}else if (connectable.getOutgoingConnectors().contains(cp.getConnector())){ connectable.getOutgoingConnectors().remove(cp.getConnector());
for(IConnector outgoingC:connectable.getOutgoingConnectors()){ if (connector.getSource()!=null) connector.getSource().getOutgoingConnectors().remove(connector);
@Override public void onStart(IDragStartEvent event) { this.getConnector().refresh(); //if current point is already attached => detach it if (this.getConnectedToMagnet()!=null){ this.getConnectedToMagnet().removeConnectorPoint(this); //remove incoming or outgoing connector this.getConnectedToMagnet().getConnectableElement().getIncommingConnectors().remove(this.getConnector()); this.getConnectedToMagnet().getConnectableElement().getOutgoingConnectors().remove(this.getConnector()); this.setConnectedToMagnet(null); if (this instanceof IConnectorStart){ this.getConnector().setSource(null); }else if (this instanceof IConnectorEnd){ this.getConnector().setTarget(null); } } }
connectableElement.getOutgoingConnectors().add(cp.getConnector()); cp.getConnector().setSource(connectableElement);