From: Robin Rosenberg Date: Thu, 10 Jul 2008 22:40:45 GMT Subject: [EGIT PATCH 3/9] Connect the history page to the refs update subscription mechanism Message-ID: <1215729651-26781-4-git-send-email-robin.rosenberg@dewire.com> In-Reply-To: <1215729651-26781-3-git-send-email-robin.rosenberg@dewire.com> Now the history page can get updated automatically without polling. Signed-off-by: Robin Rosenberg --- .../egit/ui/internal/history/GitHistoryPage.java | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/history/GitHistoryPage.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/history/GitHistoryPage.java index 7e2f726..418f3b6 100644 --- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/history/GitHistoryPage.java +++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/history/GitHistoryPage.java @@ -168,6 +168,9 @@ public class GitHistoryPage extends HistoryPage implements RepositoryListener { /** Last HEAD */ private AnyObjectId currentHeadId; + /** We need to remember the current repository */ + private Repository db; + /** * Highlight flag that can be applied to commits to make them stand out. *

@@ -536,6 +539,9 @@ public class GitHistoryPage extends HistoryPage implements RepositoryListener { revObjectSelectionProvider.setActiveRepository(null); cancelRefreshJob(); + if (db != null) + db.removeRepositoryChangedListener(this); + if (graph == null) return false; @@ -543,7 +549,8 @@ public class GitHistoryPage extends HistoryPage implements RepositoryListener { if (in == null || in.length == 0) return false; - Repository db = null; + db = null; + final ArrayList paths = new ArrayList(in.length); for (final IResource r : in) { final RepositoryMapping map = RepositoryMapping.getMapping(r); @@ -563,6 +570,8 @@ public class GitHistoryPage extends HistoryPage implements RepositoryListener { if (db == null) return false; + db.addRepositoryChangedListener(this); + final AnyObjectId headId; try { headId = db.resolve("HEAD"); -- 1.5.6.2.220.g44701