private static int getInitialY(EsbConnector connector, LinkedList<EsbNode> nodeList) { int y = 10; EObject eContainer = connector.eContainer(); if (eContainer != null) { // FIXME : Remove hard-coded values if (eContainer instanceof ProxyService || eContainer instanceof APIResource) { y = 95; // Initial y of proxy, api resource output connector } else if (eContainer instanceof Sequences) { y = 146; // Initial y of sequence output connector } else { return y; } if (nodeList.size() > 0) { EditPart editpart = getEditpart(nodeList.getFirst()); if (editpart != null) { if (!(editpart instanceof complexFiguredAbstractMediator)) { GraphicalEditPart gEditpart = (GraphicalEditPart) editpart; y = y - (gEditpart.getFigure().getPreferredSize().height / 2); } } } } return y; }
/** * Deserialize a sequence * * @param mediatorFlow * @param sequence * @param connector * @param reversed * @throws DeserializerException */ protected void deserializeSequence( IGraphicalEditPart part, SequenceMediator sequenceMediator, EsbConnector connector, boolean reversed) throws DeserializerException { LinkedList<EsbNode> nodeList = new LinkedList<>(); LinkedList<CommentMediator> commentMediatorList = new LinkedList<>(); SequenceMediator sequence = EditorUtils.stripUnsupportedMediators(sequenceMediator); TransactionalEditingDomain domain = part.getEditingDomain(); if (connector instanceof OutputConnector) { int mediatorsCount = sequence.getList().size(); boolean lastMediator = false; for (int i = 0; i < mediatorsCount; ++i) { AbstractMediator mediator = (AbstractMediator) sequence.getList().get(i); if (mediatorsCount == (i + 1)) { lastMediator = true; } if (reversedNodes.contains(connector.eContainer())) { executeMediatorDeserializer( part, nodeList, domain, mediator, true, commentMediatorList, lastMediator); reversedNodes.addAll(nodeList); } else { executeMediatorDeserializer( part, nodeList, domain, mediator, reversed, commentMediatorList, lastMediator); if (reversed) { reversedNodes.addAll(nodeList); } } } connectionFlowMap.put(connector, nodeList); } else if (connector instanceof InputConnector) { int mediatorsCount = sequence.getList().size(); boolean lastMediator = false; for (int i = mediatorsCount - 1; i >= 0; --i) { if (i == 0) { lastMediator = true; } AbstractMediator mediator = (AbstractMediator) sequence.getList().get(i); executeMediatorDeserializer( part, nodeList, domain, mediator, true, commentMediatorList, lastMediator); } connectionFlowMap.put(connector, nodeList); reversedNodes.addAll(nodeList); } }