public static String getViewName(final GraphsContainer graphs) {
    final Diff diff = graphs.getDiff();

    final IAddress priFunctionAddr = graphs.getPrimaryGraph().getFunctionAddress();
    final IAddress secFunctionAddr = graphs.getSecondaryGraph().getFunctionAddress();

    String priName = diff.getMetadata().getDisplayName(ESide.PRIMARY);
    if (priFunctionAddr != null) {
      final RawFunction function = diff.getFunction(priFunctionAddr, ESide.PRIMARY);
      if (function != null) {
        priName = function.getName();
      }
    } else if (secFunctionAddr != null) {
      priName = null;
    }

    String secName = diff.getMetadata().getDisplayName(ESide.SECONDARY);
    if (secFunctionAddr != null) {
      final RawFunction function = diff.getFunction(secFunctionAddr, ESide.SECONDARY);
      if (function != null) {
        secName = function.getName();
      }
    } else if (priFunctionAddr != null) {
      secName = null;
    }

    if (priName == null) {
      return secName;
    }

    if (secName == null) {
      return priName;
    }

    return String.format("%s vs %s", priName, secName);
  }
Base class for storing view related metadata.
java/ui/src/main/java/com/google/security/zynamics/bindiff/project/userview/ViewData.java