From: Robin Rosenberg <robin.rosenberg@dewire.com>
To: "Shawn O. Pearce" <spearce@spearce.org>
Cc: git@vger.kernel.org, Marek Zawirski <marek.zawirski@gmail.com>,
Robin Rosenberg <robin.rosenberg@dewire.com>
Subject: [EGIT PATCH 9/9] Attach the resource decorator to the repository change event mechanism
Date: Fri, 11 Jul 2008 00:40:51 +0200 [thread overview]
Message-ID: <1215729651-26781-10-git-send-email-robin.rosenberg@dewire.com> (raw)
In-Reply-To: <1215729651-26781-9-git-send-email-robin.rosenberg@dewire.com>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
.../internal/decorators/GitResourceDecorator.java | 29 +++++++++++++++++++-
1 files changed, 28 insertions(+), 1 deletions(-)
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitResourceDecorator.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitResourceDecorator.java
index 0308f6a..dcb87b7 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitResourceDecorator.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitResourceDecorator.java
@@ -10,6 +10,8 @@
package org.spearce.egit.ui.internal.decorators;
import java.io.IOException;
+import java.util.HashSet;
+import java.util.Set;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
@@ -38,7 +40,11 @@ import org.spearce.egit.ui.Activator;
import org.spearce.egit.ui.UIIcons;
import org.spearce.egit.ui.UIText;
import org.spearce.jgit.lib.GitIndex;
+import org.spearce.jgit.lib.IndexChangedEvent;
+import org.spearce.jgit.lib.RefsChangedEvent;
import org.spearce.jgit.lib.Repository;
+import org.spearce.jgit.lib.RepositoryChangedEvent;
+import org.spearce.jgit.lib.RepositoryListener;
import org.spearce.jgit.lib.RepositoryState;
import org.spearce.jgit.lib.Tree;
import org.spearce.jgit.lib.TreeEntry;
@@ -61,7 +67,7 @@ public class GitResourceDecorator extends LabelProvider implements
private static final RCL myrcl = new RCL();
- static class RCL implements RepositoryChangeListener, Runnable {
+ static class RCL implements RepositoryChangeListener, RepositoryListener, Runnable {
private boolean requested;
public synchronized void run() {
@@ -70,6 +76,26 @@ public class GitResourceDecorator extends LabelProvider implements
GitResourceDecorator.class.getName());
}
+ public void refsChanged(RefsChangedEvent e) {
+ repositoryChanged(e);
+ }
+
+ public void indexChanged(IndexChangedEvent e) {
+ repositoryChanged(e);
+ }
+
+ private void repositoryChanged(RepositoryChangedEvent e) {
+ Set<RepositoryMapping> ms = new HashSet<RepositoryMapping>();
+ for (IProject p : ResourcesPlugin.getWorkspace().getRoot().getProjects()) {
+ RepositoryMapping mapping = RepositoryMapping.getMapping(p);
+ if (mapping != null && mapping.getRepository() == e.getRepository())
+ ms.add(mapping);
+ }
+ for (RepositoryMapping m : ms) {
+ repositoryChanged(m);
+ }
+ }
+
public void repositoryChanged(final RepositoryMapping which) {
try {
which.getContainer().accept(new IResourceVisitor() {
@@ -139,6 +165,7 @@ public class GitResourceDecorator extends LabelProvider implements
static ResCL myrescl = new ResCL();
static {
+ Repository.addAnyRepositoryChangedListener(myrcl);
GitProjectData.addRepositoryChangeListener(myrcl);
ResourcesPlugin.getWorkspace().addResourceChangeListener(myrescl,
IResourceChangeEvent.POST_CHANGE);
--
1.5.6.2.220.g44701
next prev parent reply other threads:[~2008-07-10 22:47 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-10 22:40 [EGIT PATCH 0/9] Repository change listeners Robin Rosenberg
2008-07-10 22:40 ` [EGIT PATCH 1/9] Create a listener structure for changes to refs and index Robin Rosenberg
2008-07-10 22:40 ` [EGIT PATCH 2/9] Cached modification times for symbolic refs too Robin Rosenberg
2008-07-10 22:40 ` [EGIT PATCH 3/9] Connect the history page to the refs update subscription mechanism Robin Rosenberg
2008-07-10 22:40 ` [EGIT PATCH 4/9] Add a method to listen to changes in any repository Robin Rosenberg
2008-07-10 22:40 ` [EGIT PATCH 5/9] Add a job to periodically scan for repository changes Robin Rosenberg
2008-07-10 22:40 ` [EGIT PATCH 6/9] Change GitHistoryPage to listen on any repository Robin Rosenberg
2008-07-10 22:40 ` [EGIT PATCH 7/9] Add a job to refresh projects when the index changes Robin Rosenberg
2008-07-10 22:40 ` [EGIT PATCH 8/9] Make git dectected changes depend on the automatic refresh setting Robin Rosenberg
2008-07-10 22:40 ` Robin Rosenberg [this message]
2008-07-11 4:33 ` [EGIT PATCH 7/9] Add a job to refresh projects when the index changes Shawn O. Pearce
2008-07-11 9:32 ` [PATCH 7/7] " Robin Rosenberg
2008-07-11 4:28 ` [EGIT PATCH 4/9] Add a method to listen to changes in any repository Shawn O. Pearce
2008-07-11 9:48 ` [PATCH 4/4] " Robin Rosenberg
2008-07-11 12:24 ` jgit (was: [PATCH 4/4] Add a method...) Andreas Ericsson
2008-07-11 12:24 ` Robin Rosenberg
2008-07-11 4:22 ` [EGIT PATCH 1/9] Create a listener structure for changes to refs and index Shawn O. Pearce
2008-07-11 9:27 ` [PATCH] " Robin Rosenberg
2008-07-11 5:26 ` [EGIT PATCH 0/9] Repository change listeners Shawn O. Pearce
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1215729651-26781-10-git-send-email-robin.rosenberg@dewire.com \
--to=robin.rosenberg@dewire.com \
--cc=git@vger.kernel.org \
--cc=marek.zawirski@gmail.com \
--cc=spearce@spearce.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).