@Override protected void setInitialSelection( List<? extends ChangeList> changeLists, List<Change> changes, ChangeList initialListSelection) { myAllChanges = new ArrayList<Change>(); mySelectedChangeList = initialListSelection; for (ChangeList list : changeLists) { if (list instanceof LocalChangeList) { myAllChanges.addAll(list.getChanges()); if (initialListSelection == null) { for (Change c : list.getChanges()) { if (changes.contains(c)) { mySelectedChangeList = list; break; } } } } } if (mySelectedChangeList == null) { for (ChangeList list : changeLists) { if (list instanceof LocalChangeList && ((LocalChangeList) list).isDefault()) { mySelectedChangeList = list; break; } } if (mySelectedChangeList == null && !changeLists.isEmpty()) { mySelectedChangeList = changeLists.get(0); } } }
@NotNull public Collection<Change> getChangesIn(final FilePath dirPath) { List<Change> changes = new ArrayList<Change>(); for (ChangeList list : myMap.values()) { for (Change change : list.getChanges()) { final ContentRevision afterRevision = change.getAfterRevision(); if (afterRevision != null && afterRevision.getFile().isUnder(dirPath, false)) { changes.add(change); continue; } final ContentRevision beforeRevision = change.getBeforeRevision(); if (beforeRevision != null && beforeRevision.getFile().isUnder(dirPath, false)) { changes.add(change); } } } return changes; }
@NotNull public List<Change> getCurrentDisplayedChanges() { return mySelectedChangeList != null ? ContainerUtil.newArrayList(mySelectedChangeList.getChanges()) : Collections.emptyList(); }