git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Robin Rosenberg <robin.rosenberg@dewire.com>,
	Marek Zawirski <marek.zawirski@gmail.com>
Cc: git@vger.kernel.org
Subject: [EGIT PATCH 2/5] Don't crash the decorator update loop when resources are deleted
Date: Tue,  5 Aug 2008 20:09:37 -0700	[thread overview]
Message-ID: <1217992180-5697-3-git-send-email-spearce@spearce.org> (raw)
In-Reply-To: <1217992180-5697-2-git-send-email-spearce@spearce.org>

If a resource is deleted from the workspace we don't need to clear
its GITFOLDERDIRTYSTATEPROPERTY from the item because it is gone.
There won't be anyone else to query for that flag, so the flag is
not relevant anymore.  Further trying to call accept() on those
resources throws an exception because Eclipse won't let you touch
a deleted resource.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 .../internal/decorators/GitResourceDecorator.java  |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 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 6d2f88e..84ad949 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
@@ -126,6 +126,14 @@ public class GitResourceDecorator extends LabelProvider implements
 						Iterator<IResource> i = resources.iterator();
 						m = i.next();
 						i.remove();
+
+						while (!m.isAccessible()) {
+							if (!i.hasNext())
+								return Status.OK_STATUS;
+							m = i.next();
+							i.remove();
+						}
+
 						if (resources.size() > 0)
 							schedule();
 					}
@@ -188,8 +196,7 @@ public class GitResourceDecorator extends LabelProvider implements
 	} // End ResCL
 
 	void clearDecorationState(IResource r) throws CoreException {
-		if (r.isAccessible())
-			r.setSessionProperty(GITFOLDERDIRTYSTATEPROPERTY, null);
+		r.setSessionProperty(GITFOLDERDIRTYSTATEPROPERTY, null);
 		fireLabelProviderChanged(new LabelProviderChangedEvent(this, r));
 	}
 
-- 
1.6.0.rc1.250.g9b5e2

  reply	other threads:[~2008-08-06  3:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-06  3:09 [EGIT PATCH 0/5] Support linked resources in repositories Shawn O. Pearce
2008-08-06  3:09 ` [EGIT PATCH 1/5] Remove the pointless GitProjectData resource change listener Shawn O. Pearce
2008-08-06  3:09   ` Shawn O. Pearce [this message]
2008-08-06  3:09     ` [EGIT PATCH 3/5] Fix RepositoryMapping.getRepoRelativePath to honor linked resources Shawn O. Pearce
2008-08-06  3:09       ` [EGIT PATCH 4/5] Change GitProjectData.getRepositoryMapping to work on " Shawn O. Pearce
2008-08-06  3:09         ` [EGIT PATCH 5/5] Correct getRepositoryMapping callers to use any IResource 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=1217992180-5697-3-git-send-email-spearce@spearce.org \
    --to=spearce@spearce.org \
    --cc=git@vger.kernel.org \
    --cc=marek.zawirski@gmail.com \
    --cc=robin.rosenberg@dewire.com \
    /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).