public <E extends IModelElement> Set<E> getConnectedTo(Class<? extends E> typeToFilterOn,Class<? extends E> connectorType){ HashSet<E> result = new HashSet<E>(); Map<IDiagramElement,E> edges = this.getEdges(connectorType); for(IDiagramElement di:edges.keySet()){ IEdge edge = (IEdge) di; //check in source if (isAssignableTo(edge.getSource().getClass(), typeToFilterOn)){ result.add((E) edge.getSource().getModelElement()); } //check in target if (isAssignableTo(edge.getTarget().getClass(), typeToFilterOn)){ result.add((E) edge.getTarget().getModelElement()); } } return result; }
if (isAssignableTo(edge.getModelElement().getClass(), type)){ result.put(edge,(E) edge.getModelElement()); if (isAssignableTo(edge.getModelElement().getClass(), type)){ result.put(edge,(E) edge.getModelElement());
IConnectorPoint nextPoint = connector.getConnectorEndPoint(); if (edge.getWayPoints().size()>2){ Iterator<IPoint> it = edge.getWayPoints().iterator(); for(int i=1;i<edge.getWayPoints().size()-1;i++){ IDiagramElementView sourceElement = diagramView.getUIElementById(edge.getSource().getModelElement().getId()); IDiagramElementView targetElement = diagramView.getUIElementById(edge.getTarget().getModelElement().getId()); throw new IllegalStateException("Couldn't find sourceElement with id:"+edge.getSource().getId()+" for edge with id: "+edge.getId()); throw new IllegalStateException("Couldn't find targetElement with id:"+edge.getSource().getId()+" for edge with id: "+edge.getId());
assoc.setSource((IBaseElementBean) edge.getSource().getModelElement()); assoc.setTarget((IBaseElementBean) edge.getTarget().getModelElement()); if (edge.getSource().getModelElement() instanceof IParticipantBean && edge.getTarget().getModelElement() instanceof IMessageBean){ IParticipantBean sourceParticipant = (IParticipantBean) edge.getSource().getModelElement(); IMessageBean targetMessage = (IMessageBean) edge.getTarget().getModelElement(); ChoreographyTaskBean choreoTask = (ChoreographyTaskBean) edge.getSource().getOwningElement().getModelElement();
@Override public ParticipantBean getSyntaxModel() { ParticipantBean participant = (ParticipantBean) getMainDiagramElement().getModelElement(); //clean participants process first participant.getProcess().getLanes().clear(); participant.getProcess().clearFlowElements(); participant.getProcess().clearIOSpec(); //add all lanes (recursively) into participants process HashSet<LaneBean> lanes = (HashSet<LaneBean>) this.getAll(LaneBean.class, true); for(LaneBean lane:lanes){ participant.getProcess().addLane(lane); } //grab all sequence flows HashMap<IDiagramElement,SequenceFlowBean> sequenceFlows = (HashMap<IDiagramElement, SequenceFlowBean>) this.getEdges(SequenceFlowBean.class); for(IDiagramElement di:sequenceFlows.keySet()){ SequenceFlowBean s = sequenceFlows.get(di); s.setSourceNode((IFlowElementBean) ((IEdge)di).getSource().getModelElement()); s.setTargetNode((IFlowElementBean) ((IEdge)di).getTarget().getModelElement()); participant.getProcess().addSequenceFlow(s); } return participant; }
s.setSourceNode((IFlowElementBean) ((IEdge)di).getSource().getModelElement()); s.setTargetNode((IFlowElementBean) ((IEdge)di).getTarget().getModelElement()); if (edge.getTarget().getModelElement() instanceof IItemAwareElementBean && edge.getSource().getModelElement() instanceof WithDataOutputAssociationBean){ IItemAwareElementBean data = (IItemAwareElementBean) edge.getTarget().getModelElement(); IFlowNodeBean source = (IFlowNodeBean) edge.getSource().getModelElement(); }else if (edge.getSource().getModelElement() instanceof IItemAwareElementBean && edge.getTarget().getModelElement() instanceof IFlowNodeBean){ IItemAwareElementBean data = (IItemAwareElementBean) edge.getSource().getModelElement(); IFlowNodeBean target = (IFlowNodeBean) edge.getTarget().getModelElement(); for(IDiagramElement di : messageFlows.keySet()){ MessageFlowBean mf = messageFlows.get(di); mf.setSource((IInteractionNodeBean) ((IEdge)di).getSource().getModelElement()); mf.setTarget((IInteractionNodeBean) ((IEdge)di).getTarget().getModelElement()); collaboration.addMessageFlow(mf); IEdge edge = (IEdge) el; AssociationBean assoc = associations.get(el); assoc.setSource((IBaseElementBean) edge.getSource().getModelElement()); assoc.setTarget((IBaseElementBean) edge.getTarget().getModelElement());