Java 类com.intellij.util.Ticket 实例源码

项目:intellij-ce-playground    文件:AbstractRefreshablePanel.java   
protected AbstractRefreshablePanel(final Project project, final String loadingTitle, final BackgroundTaskQueue queue) {
  myQueue = queue;
  myTicket = new Ticket();
  myDetailsPanel = new DetailsPanel();
  myDetailsPanel.loading();
  myDetailsPanel.layout();

  myDetailsLoader = new GenericDetailsLoader<Ticket, T>(new Consumer<Ticket>() {
    @Override
    public void consume(Ticket ticket) {
      final Loader loader = new Loader(project, loadingTitle, myTicket.copy());
      loader.runSteadily(new Consumer<Task.Backgroundable>() {
        @Override
        public void consume(Task.Backgroundable backgroundable) {
          myQueue.run(backgroundable);
        }
      });
    }
  }, new PairConsumer<Ticket, T>() {
    @Override
    public void consume(Ticket ticket, T t) {
      acceptData(t);
    }
  });
}
项目:tools-idea    文件:AbstractRefreshablePanel.java   
protected AbstractRefreshablePanel(final Project project, final String loadingTitle, final BackgroundTaskQueue queue) {
  myQueue = queue;
  myTicket = new Ticket();
  myDetailsPanel = new DetailsPanel();
  myDetailsPanel.loading();
  myDetailsPanel.layout();

  myDetailsLoader = new GenericDetailsLoader<Ticket, T>(new Consumer<Ticket>() {
    @Override
    public void consume(Ticket ticket) {
      final Loader loader = new Loader(project, loadingTitle, myTicket.copy());
      loader.runSteadily(new Consumer<Task.Backgroundable>() {
        @Override
        public void consume(Task.Backgroundable backgroundable) {
          myQueue.run(backgroundable);
        }
      });
    }
  }, new PairConsumer<Ticket, T>() {
    @Override
    public void consume(Ticket ticket, T t) {
      acceptData(t);
    }
  });
}
项目:tools-idea    文件:ByRootLoader.java   
public ByRootLoader(Project project,
                    LoaderAndRefresherImpl.MyRootHolder rootHolder,
                    Mediator mediator,
                    DetailsCache detailsCache,
                    Ticket ticket, UsersIndex usersIndex, GitLogFilters gitLogFilters, final Collection<String> startingPoints) {
  super("Initial checks", Where.POOLED);
  myProject = project;
  myRootHolder = rootHolder;
  myUsersIndex = usersIndex;
  myStartingPoints = startingPoints;
  myLowLevelAccess = new LowLevelAccessImpl(myProject, myRootHolder.getRoot());
  myMediator = mediator;
  myDetailsCache = detailsCache;
  myTicket = ticket;
  myGitLogFilters = gitLogFilters;
}
项目:tools-idea    文件:MediatorImpl.java   
@CalledInBackground
@Override
public void reportSymbolicRefs(final Ticket ticket, final VirtualFile root, final CachedRefs symbolicRefs) {
  Runnable runnable = new Runnable() {
    @Override
    public void run() {
      if (!myTicket.equals(ticket)) return;
      myDetailsLoader.reportRefs(root, symbolicRefs);
      myUIRefresh.reportSymbolicRefs(root, symbolicRefs);
    }
  };
  if (ApplicationManager.getApplication().isDispatchThread()) {
    runnable.run();
  } else {
    SwingUtilities.invokeLater(runnable);
  }
}
项目:consulo    文件:AbstractRefreshablePanel.java   
protected AbstractRefreshablePanel(final Project project, final String loadingTitle, final BackgroundTaskQueue queue) {
  myQueue = queue;
  myTicket = new Ticket();
  myDetailsPanel = new DetailsPanel();
  myDetailsPanel.loading();
  myDetailsPanel.layout();

  myDetailsLoader = new GenericDetailsLoader<Ticket, T>(new Consumer<Ticket>() {
    @Override
    public void consume(Ticket ticket) {
      final Loader loader = new Loader(project, loadingTitle, myTicket.copy());
      loader.runSteadily(new Consumer<Task.Backgroundable>() {
        @Override
        public void consume(Task.Backgroundable backgroundable) {
          myQueue.run(backgroundable);
        }
      });
    }
  }, new PairConsumer<Ticket, T>() {
    @Override
    public void consume(Ticket ticket, T t) {
      acceptData(t);
    }
  });
}
项目:intellij-ce-playground    文件:AbstractRefreshablePanel.java   
@CalledInAwt
@Override
public void refresh() {
  ApplicationManager.getApplication().assertIsDispatchThread();

  if (! Comparing.equal(myDetailsLoader.getCurrentlySelected(), myTicket)) {
    final Ticket copy = myTicket.copy();
    myDetailsLoader.updateSelection(copy, false);
    myDetailsPanel.loading();
    myDetailsPanel.layout();
  } else {
    refreshPresentation();
  }
}
项目:tools-idea    文件:AbstractRefreshablePanel.java   
@CalledInAwt
@Override
public void refresh() {
  ApplicationManager.getApplication().assertIsDispatchThread();

  if (! Comparing.equal(myDetailsLoader.getCurrentlySelected(), myTicket)) {
    final Ticket copy = myTicket.copy();
    myDetailsLoader.updateSelection(copy, false);
    myDetailsPanel.loading();
    myDetailsPanel.layout();
  } else {
    refreshPresentation();
  }
}
项目:tools-idea    文件:MediatorImpl.java   
public MediatorImpl(final Project project, GitCommitsSequentially gitCommitsSequentially) {
  myProject = project;
  myGitCommitsSequentially = gitCommitsSequentially;
  myTicket = new Ticket();
  myController = new LoadGrowthController();
  mySequenceBuffers = new HashMap<VirtualFile, SequenceSupportBuffer>();
  myHaveRestrictingFilters = false;
}
项目:tools-idea    文件:MediatorImpl.java   
@CalledInBackground
@Override
public StepType appendResult(final Ticket ticket,
                             final List<CommitI> result,
                             final @Nullable List<List<AbstractHash>> parents,
                             VirtualFile root, boolean checkForSequential) {
  if (! myTicket.equals(ticket)) {
    return StepType.STOP;
  }

  if (! result.isEmpty()) {
    /*if (mySequenceBuffers != null && checkForSequential) {
      try {
        mySequenceBuffers.get(root).appendResult(ticket, result, parents);
      }
      catch (VcsException e) {
        // todo
        myUIRefresh.acceptException(e);
        myTableWrapper.forceStop();
        return StepType.STOP;
      }
    } else {*/
      myTableWrapper.appendResult(ticket, result, parents);
    //}
  }
  if (myTableWrapper.isSuspend()) {
    return StepType.PAUSE;
  }
  return StepType.CONTINUE;
}
项目:tools-idea    文件:MediatorImpl.java   
@CalledInBackground
public void appendResult(final Ticket ticket, final List<CommitI> result,
                         final @Nullable List<List<AbstractHash>> parents) {
  final Runnable runnable = new Runnable() {
    @Override
    public void run() {
      if (! myTicket.equals(ticket)) return;
      // todo check for continuation right here
      myTableModel.appendData(result, parents);
      if (myController.isEmpty()) {
        myTableModel.restore();
        mySuspend = false;
      } else if (! myForcedStop) {
        int nextCut = nextCut();
        if ((nextCut + 1) < myTableModel.getTrueCount()) {
          if (nextCut > myRecentCut) {
            mySuspend = true;
            myRecentCut = nextCut;
            myTableModel.cutAt(myRecentCut);
          }
        }
      }
      myUIRefresh.linesReloaded(mySuspend);
      if (myController.isEmpty()) {
        myUIRefresh.finished();
      }
    }
  };
  if (ApplicationManager.getApplication().isDispatchThread()) {
    runnable.run();
  } else {
    SwingUtilities.invokeLater(runnable);
  }
}
项目:consulo    文件:AbstractRefreshablePanel.java   
@RequiredDispatchThread
@Override
public void refresh() {
  ApplicationManager.getApplication().assertIsDispatchThread();

  if (! Comparing.equal(myDetailsLoader.getCurrentlySelected(), myTicket)) {
    final Ticket copy = myTicket.copy();
    myDetailsLoader.updateSelection(copy, false);
    myDetailsPanel.loading();
    myDetailsPanel.layout();
  } else {
    refreshPresentation();
  }
}
项目:intellij-ce-playground    文件:AbstractRefreshablePanel.java   
private Loader(@Nullable Project project, @NotNull String title, final Ticket ticketCopy) {
  super(project, title, false, BackgroundFromStartOption.getInstance());
  myTicketCopy = ticketCopy;
}
项目:tools-idea    文件:AbstractRefreshablePanel.java   
private Loader(@Nullable Project project, @NotNull String title, final Ticket ticketCopy) {
  super(project, title, false, BackgroundFromStartOption.getInstance());
  myTicketCopy = ticketCopy;
}
项目:tools-idea    文件:LoadController.java   
@CalledInAwt
@Override
public void loadSkeleton(final Ticket ticket,
                         final RootsHolder rootsHolder,
                         final Collection<String> startingPoints,
                         final GitLogFilters gitLogFilters,
                         final LoadGrowthController loadGrowthController, final boolean topoOrder) {
  if (myPreviousAlgorithm != null) {
    myPreviousAlgorithm.stop();
  }
  final List<LoaderAndRefresher<CommitHashPlusParents>> list = new ArrayList<LoaderAndRefresher<CommitHashPlusParents>>();
  final List<ByRootLoader> shortLoaders = new ArrayList<ByRootLoader>();
  final List<VirtualFile> roots = rootsHolder.getRoots();
  int i = 0;
  for (VirtualFile root : roots) {
    final LoaderAndRefresherImpl.MyRootHolder rootHolder = roots.size() == 1 ?
      new LoaderAndRefresherImpl.OneRootHolder(root) :
      new LoaderAndRefresherImpl.ManyCaseHolder(i, rootsHolder);

    if (! gitLogFilters.isUseOnlyHashes()) {
      final boolean haveStructureFilter = gitLogFilters.haveStructureFilter();
      // check if no files under root are selected
      if (haveStructureFilter && ! gitLogFilters.haveStructuresForRoot(root)) {
        ++ i;
        continue;
      }
      gitLogFilters.callConsumer(new Consumer<List<ChangesFilter.Filter>>() {
        @Override
        public void consume(final List<ChangesFilter.Filter> filters) {
          final LoaderAndRefresherImpl loaderAndRefresher =
            new LoaderAndRefresherImpl(ticket, filters, myMediator, startingPoints, myDetailsCache, myProject, rootHolder, myUsersIndex,
                                       loadGrowthController.getId(), haveStructureFilter, topoOrder, gitLogFilters.haveDisordering());
          list.add(loaderAndRefresher);
        }
      }, true, root);
    }

    shortLoaders.add(new ByRootLoader(myProject, rootHolder, myMediator, myDetailsCache, ticket, myUsersIndex, gitLogFilters, startingPoints));
    ++ i;
  }

  myUsersComponent.acceptUpdate(myUsersIndex.getKeys());

  if (myPreviousAlgorithm != null) {
    final Continuation oldContinuation = myPreviousAlgorithm.getContinuation();
    oldContinuation.cancelCurrent();
    oldContinuation.clearQueue();
  }

  final RepositoriesSorter sorter = new RepositoriesSorter(list, shortLoaders); // this will set previous algorithm for stop

  final Runnable runnable = new Runnable() {
    @Override
    public void run() {
      final Continuation continuation = Continuation.createForCurrentProgress(myProject, true, "Load git log data");
      sorter.setContinuation(continuation);
      continuation.add(Arrays.<TaskDescriptor>asList(sorter));
      continuation.resume();
    }
  };
  loadUnderProgress(runnable);
}
项目:tools-idea    文件:Mediator.java   
/**
 * @return false -> ticket already changed
 */
StepType appendResult(final Ticket ticket,
                      final List<CommitI> result,
                      @Nullable final List<List<AbstractHash>> parents, VirtualFile root, boolean checkForSequential);
项目:tools-idea    文件:MediatorImpl.java   
@Override
public void acceptStashHead(Ticket ticket, VirtualFile root, Pair<AbstractHash, AbstractHash> hash) {
  if (! myTicket.equals(ticket)) return;
  myUIRefresh.reportStash(root, hash);
}
项目:tools-idea    文件:MediatorImpl.java   
public void appendResult(final Ticket ticket, final List<CommitI> result,
                             final @Nullable List<List<AbstractHash>> parents) throws VcsException {
  assert result.size() == parents.size();
  result.addAll(myCommits);
  parents.addAll(myParents);

  final SortListsByFirst sortListsByFirst = new SortListsByFirst(result, CommitIComparator.getInstance());
  sortListsByFirst.sortAnyOther(parents);

  final long commitTime = myTail == null ? result.get(0).getTime() : myTail.getTime();
  final Ref<Integer> cnt = new Ref<Integer>(myTail == null ? 0 : -1);
  myCommitsSequentially.iterateDescending(myRoot, commitTime, new Processor<Pair<AbstractHash, Long>>() {
    boolean startFound = false;

    @Override
    public boolean process(Pair<AbstractHash, Long> pair) {
      if (cnt.get() == -1) {
        if (! pair.getFirst().getString().startsWith(myTail.getHash().getString())) {
          System.out.println("!!!!!!!!! (1) pair: " + pair.getFirst().getString() + " commit (" + cnt.get() + "): " + myTail.getHash().getString());
          return (! startFound) ? pair.getSecond() == commitTime : false;
        } else {
          cnt.set(0);
          startFound = true;
          return true;
        }
      }
      if (! pair.getFirst().getString().startsWith(result.get(cnt.get()).getHash().getString())) {
        System.out.println("(2) pair: " + pair.getFirst().getString() + " commit (" + cnt.get() + "): " + result.get(cnt.get()).getHash().getString());
        return (! startFound) ? pair.getSecond() == commitTime : false;
      }
      cnt.set(cnt.get() + 1);
      startFound = true;
      return cnt.get() < result.size();
    }
  });

  myCommits = new ArrayList<CommitI>(result.subList(cnt.get(), result.size()));
  myParents = new ArrayList<List<AbstractHash>>(parents.subList(cnt.get(), parents.size()));

  if (cnt.get() > 0) {
    myTableWrapper.appendResult(ticket, result.subList(0, cnt.get()), parents.subList(0, cnt.get()));
    myTail = result.get(cnt.get() - 1);
  }
}
项目:tools-idea    文件:Loader.java   
void loadSkeleton(Ticket ticket,
RootsHolder rootsHolder,
final Collection<String> startingPoints,
final GitLogFilters filters, LoadGrowthController loadGrowthController, final boolean topoOrder);
项目:tools-idea    文件:LoaderAndRefresherImpl.java   
public LoaderAndRefresherImpl(final Ticket ticket,
                              Collection<ChangesFilter.Filter> filters,
                              Mediator mediator,
                              Collection<String> startingPoints,
                              DetailsCache detailsCache,
                              Project project,
                              MyRootHolder rootHolder,
                              final UsersIndex usersIndex,
                              final LoadGrowthController.ID id, boolean haveStructureFilter, boolean topoOrder, boolean haveDisordering) {
  myRootHolder = rootHolder;
  myUsersIndex = usersIndex;
  myId = id;
  myHaveStructureFilter = haveStructureFilter;
  myTopoOrder = topoOrder;
  myLoadParents = ! haveDisordering;
  myTicket = ticket;
  myFilters = filters;
  myMediator = mediator;
  myStartingPoints = startingPoints;
  myDetailsCache = detailsCache;
  myStepType = StepType.CONTINUE;
  myProject = project;
  myProgressAnalog = new Getter<Boolean>() {
    @Override
    public Boolean get() {
      return isInterrupted();
    }
  };
  myLowLevelAccess = new LowLevelAccessImpl(myProject, myRootHolder.getRoot());

  myRealConsumer = new Consumer<List<CommitHashPlusParents>>() {
    @Override
    public void consume(final List<CommitHashPlusParents> list) {
      if (isInterrupted()) return;
      final List<CommitI> buffer = new ArrayList<CommitI>();
      final List<List<AbstractHash>> parents = myLoadParents ? new ArrayList<List<AbstractHash>>() : null;
      for (CommitHashPlusParents commitHashPlusParents : list) {
        CommitI commit = new Commit(commitHashPlusParents.getHash(), commitHashPlusParents.getTime(),
                                    myUsersIndex.put(commitHashPlusParents.getAuthorName()));
        commit = myRootHolder.decorateByRoot(commit);
        buffer.add(commit);
        if (myLoadParents) {
          parents.add(commitHashPlusParents.getParents());
        }
      }

      StepType stepType = myMediator.appendResult(myTicket, buffer, parents, myRootHolder.getRoot(), true);
      if (! StepType.FINISHED.equals(myStepType)) {
        myStepType = stepType;
      }
    }
  };
  myBufferConsumer = new BufferedListConsumer<CommitHashPlusParents>(15, myRealConsumer, 400);
  myRepeatingLoadConsumer = new RepeatingLoadConsumer<CommitHashPlusParents>(myProject, myBufferConsumer.asConsumer());
}
项目:consulo    文件:AbstractRefreshablePanel.java   
private Loader(@Nullable Project project, @Nonnull String title, final Ticket ticketCopy) {
  super(project, title, false, BackgroundFromStartOption.getInstance());
  myTicketCopy = ticketCopy;
}
项目:tools-idea    文件:Mediator.java   
void reportSymbolicRefs(final Ticket ticket, VirtualFile root, final CachedRefs symbolicRefs);
项目:tools-idea    文件:Mediator.java   
void acceptStashHead(final Ticket ticket, VirtualFile root, Pair<AbstractHash, AbstractHash> hash);