ChangeListManager.getAllChanges() to easily get all changes in all changelists.
authorKirill Likhodedov <kirill.likhodedov@jetbrains.com>
Fri, 6 May 2011 15:38:37 +0000 (19:38 +0400)
committerKirill Likhodedov <kirill.likhodedov@jetbrains.com>
Fri, 6 May 2011 16:00:29 +0000 (20:00 +0400)
platform/vcs-api/src/com/intellij/openapi/vcs/changes/ChangeListManager.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListWorker.java

index 62e9afdb9f4bf5ece8a1e6e61435531ae8e38310..a97b46581e8887ed35bf53418f898dc32c64a5af 100644 (file)
@@ -56,6 +56,12 @@ public abstract class ChangeListManager implements ChangeListModification {
   public abstract List<VirtualFile> getAffectedFiles();
   public abstract boolean isFileAffected(final VirtualFile file);
 
+  /**
+   * @return all changes in all changelists.
+   */
+  @NotNull
+  public abstract Collection<Change> getAllChanges();
+
   @Nullable
   public abstract LocalChangeList findChangeList(final String name);
   @Nullable
index 5e73e2795f4ae023d5e753b22059f765de19eb43..dbae845457f1fe6f9a9e7cb021a2f9522e7acc1c 100644 (file)
@@ -587,6 +587,13 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
     }
   }
 
+  @NotNull
+  public Collection<Change> getAllChanges() {
+    synchronized (myDataLock) {
+      return myWorker.getAllChanges();
+    }
+  }
+
   public List<VirtualFile> getUnversionedFiles() {
     synchronized (myDataLock) {
       return myComposite.getVFHolder(FileHolder.HolderType.UNVERSIONED).getFiles();
index 10f9b4893c29519b57d2475606794d79f0e55806..49eb8b4f69744f6ddba300d0a29d237357b5c541 100644 (file)
@@ -537,6 +537,14 @@ public class ChangeListWorker implements ChangeListsWriteOperations {
     mySwitchedHolder.notifyVcsStarted(vcs);
   }
 
+  public Collection<Change> getAllChanges() {
+    final Collection<Change> changes = new HashSet<Change>();
+    for (LocalChangeList list : myMap.values()) {
+      changes.addAll(list.getChanges());
+    }
+    return changes;
+  }
+
   private abstract class ExternalVsInternalChangesIntersection {
     protected final Collection<Change> myInChanges;
     protected final Map<Pair<String, String>, LocalChangeList> myInternalMap;