Exemplo n.º 1
0
  @NotNull
  public static DataPack build(
      @NotNull List<? extends VcsCommit> commits,
      @NotNull Collection<VcsRef> allRefs,
      @NotNull ProgressIndicator indicator) {
    indicator.setText("Building graph...");

    MutableGraph graph = GraphBuilder.build(commits, allRefs);

    GraphModel graphModel = new GraphModelImpl(graph, allRefs);

    final GraphPrintCellModel printCellModel = new GraphPrintCellModelImpl(graphModel.getGraph());
    graphModel.addUpdateListener(
        new Consumer<UpdateRequest>() {
          @Override
          public void consume(UpdateRequest key) {
            printCellModel.recalculate(key);
          }
        });

    final RefsModel refsModel = new RefsModel(allRefs);
    graphModel
        .getFragmentManager()
        .setUnconcealedNodeFunction(
            new Function<Node, Boolean>() {
              @NotNull
              @Override
              public Boolean fun(@NotNull Node key) {
                if (key.getDownEdges().isEmpty()
                    || key.getUpEdges().isEmpty()
                    || refsModel.isBranchRef(key.getCommitHash())) {
                  return true;
                } else {
                  return false;
                }
              }
            });
    return new DataPack(graphModel, refsModel, printCellModel);
  }
Exemplo n.º 2
0
 public void appendCommits(@NotNull List<? extends VcsCommit> commitParentsList) {
   myGraphModel.appendCommitsToGraph(commitParentsList);
 }