Skip to content

Commit

Permalink
[2069] FunctionalChain internal arrow to a port without exchanges must
Browse files Browse the repository at this point in the history
not be displayed

Bug 2069

Change-Id: I57aeeff3c5eadd9113d4f36fc0178226a3713b82
Signed-off-by: Ali Akar <ali.akar82@gmail.com>
  • Loading branch information
aliakar82 committed Jul 8, 2018
1 parent 58120bb commit 38d41f0
Showing 1 changed file with 22 additions and 3 deletions.
Expand Up @@ -21,6 +21,7 @@
import java.util.Map.Entry;
import java.util.Set;

import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.sirius.diagram.AbstractDNode;
import org.eclipse.sirius.diagram.BorderedStyle;
Expand Down Expand Up @@ -444,12 +445,22 @@ && isValidInternalLinkEdge(fc, currentTargetNode, edge.getSourceNode())) {
* @return
*/
public boolean isValidInternalLinkEdge(FunctionalChain chain, EdgeTarget currentSourceNode, EdgeTarget currentTargetNode) {
if (currentSourceNode == null) {
if (currentSourceNode == null || currentSourceNode.getIncomingEdges().isEmpty()) {
return false;
}
if (currentTargetNode == null) {
if (currentTargetNode == null || currentTargetNode.getOutgoingEdges().isEmpty()) {
return false;
}

// At least one incoming edge should be visible
if(!hasVisibleEdge(currentSourceNode.getIncomingEdges())){
return false;
}

// At least one outgoing edge should be visible
if(!hasVisibleEdge(currentTargetNode.getOutgoingEdges())){
return false;
}

EObject sourceParent = currentSourceNode.eContainer();
EObject targetParent = currentTargetNode.eContainer();
Expand All @@ -460,7 +471,15 @@ public boolean isValidInternalLinkEdge(FunctionalChain chain, EdgeTarget current
return false;
}

/**
private boolean hasVisibleEdge(EList<DEdge> edges) {
for(DEdge edge : edges){
if(edge.isVisible()){
return true;
}
}
return false;
}
/**
* Create or return an internal link between both nodes.
*/
protected DEdge retrieveInternalLink(EdgeTarget sourceNode, EdgeTarget targetNode, FunctionalChain fc, RGBValues color) {
Expand Down

0 comments on commit 38d41f0

Please sign in to comment.