private static CombinedDiffEdge buildDiffEdge(
      final CombinedGraph diffGraph,
      final SuperViewEdge<? extends SuperViewNode> rawSuperJump,
      final SuperDiffEdge superDiffEdge)
      throws GraphLayoutException {
    @SuppressWarnings("unchecked")
    final RawCombinedJump<RawCombinedBasicBlock> rawCombinedJump =
        (RawCombinedJump<RawCombinedBasicBlock>) rawSuperJump.getCombinedEdge();

    final ZyLabelContent combinedEdgeContent = new ZyLabelContent(null);
    final CombinedEdgeRealizer combinedEdgeRealizer =
        new CombinedEdgeRealizer(combinedEdgeContent, null, diffGraph.getSettings());

    final CombinedDiffNode srcCombinedDiffNode = diffGraph.getNode(rawCombinedJump.getSource());
    final CombinedDiffNode tarCombinedDiffNode = diffGraph.getNode(rawCombinedJump.getTarget());

    final Node srcCombinedYNode = srcCombinedDiffNode.getNode();
    final Node tarCombinedYNode = tarCombinedDiffNode.getNode();

    final boolean srcVisible = srcCombinedDiffNode.getRawNode().isVisible();
    final boolean tarVisible = tarCombinedDiffNode.getRawNode().isVisible();
    srcCombinedDiffNode.getRawNode().setVisible(true);
    tarCombinedDiffNode.getRawNode().setVisible(true);

    Edge yCombinedEdge = diffGraph.getGraph().createEdge(srcCombinedYNode, tarCombinedYNode);

    final CombinedDiffEdge combinedDiffEdge =
        new CombinedDiffEdge(
            srcCombinedDiffNode,
            tarCombinedDiffNode,
            yCombinedEdge,
            combinedEdgeRealizer,
            rawCombinedJump,
            superDiffEdge);
    CombinedDiffNode.link(srcCombinedDiffNode, tarCombinedDiffNode);
    combinedEdgeRealizer.setUserData(new ZyEdgeData<>(combinedDiffEdge));

    srcCombinedDiffNode.getRawNode().setVisible(srcVisible);
    tarCombinedDiffNode.getRawNode().setVisible(tarVisible);

    diffGraph.addEdgeToMappings(combinedDiffEdge);

    if (!srcVisible || !tarVisible) {
      final BinDiffGraph<?, ?> graph = diffGraph;
      @SuppressWarnings("unchecked")
      final BinDiffGraph<ZyGraphNode<?>, ?> castedGraph = (BinDiffGraph<ZyGraphNode<?>, ?>) graph;

      final boolean autoLayout = LayoutCommandHelper.deactivateAutoLayout(castedGraph);
      try {
        ProximityBrowserUnhideNode.executeStatic(
            castedGraph,
            srcVisible
                ? (ZyGraphNode<?>) srcCombinedDiffNode
                : (ZyGraphNode<?>) tarCombinedDiffNode);
      } finally {
        LayoutCommandHelper.activateAutoLayout(castedGraph, autoLayout);
      }
    }

    return combinedDiffEdge;
  }
Utility class to remove basic block matches from BinDiff graphs.
java/ui/src/main/java/com/google/security/zynamics/bindiff/graph/helpers/BasicBlockMatchRemover.java