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 1/5] Remove the pointless GitProjectData resource change listener
Date: Tue,  5 Aug 2008 20:09:36 -0700	[thread overview]
Message-ID: <1217992180-5697-2-git-send-email-spearce@spearce.org> (raw)
In-Reply-To: <1217992180-5697-1-git-send-email-spearce@spearce.org>

Apparently on any IResourceChangeEvent.POST_CHANGE we just burn some
CPU time and generate some garbage for the GC to clean out later.  I
cannot see a reason why this code is still here.  My memory says we
did this in the past to notify the resource decorator that it needs
to update, or we used it for our cache tree invalidation.

Since this code has no side effect other than to waste time we can
safely remove it, and cut our project down a little bit.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 .../spearce/egit/core/project/GitProjectData.java  |   64 --------------------
 1 files changed, 0 insertions(+), 64 deletions(-)

diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/project/GitProjectData.java b/org.spearce.egit.core/src/org/spearce/egit/core/project/GitProjectData.java
index 8754bd1..3d5424c 100644
--- a/org.spearce.egit.core/src/org/spearce/egit/core/project/GitProjectData.java
+++ b/org.spearce.egit.core/src/org/spearce/egit/core/project/GitProjectData.java
@@ -29,8 +29,6 @@ import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.resources.IResourceChangeEvent;
 import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.IResourceDeltaVisitor;
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.Preferences;
@@ -61,10 +59,6 @@ public class GitProjectData {
 		@SuppressWarnings("synthetic-access")
 		public void resourceChanged(final IResourceChangeEvent event) {
 			switch (event.getType()) {
-			case IResourceChangeEvent.POST_CHANGE:
-				projectsChanged(event.getDelta().getAffectedChildren(
-						IResourceDelta.CHANGED));
-				break;
 			case IResourceChangeEvent.PRE_CLOSE:
 				uncache((IProject) event.getResource());
 				break;
@@ -182,16 +176,6 @@ public class GitProjectData {
 		Activator.trace("(GitProjectData) " + m);
 	}
 
-	private static void projectsChanged(final IResourceDelta[] projDeltas) {
-		for (int k = 0; k < projDeltas.length; k++) {
-			final IResource r = projDeltas[k].getResource();
-			final GitProjectData d = get((IProject) r);
-			if (d != null) {
-				d.notifyChanged(projDeltas[k]);
-			}
-		}
-	}
-
 	private synchronized static void cache(final IProject p,
 			final GitProjectData d) {
 		projectDataCache.put(p, d);
@@ -380,54 +364,6 @@ public class GitProjectData {
 		}
 	}
 
-	private void notifyChanged(final IResourceDelta projDelta) {
-//		final Set affectedMappings = new HashSet();
-		try {
-			projDelta.accept(new IResourceDeltaVisitor() {
-				public boolean visit(final IResourceDelta d)
-						throws CoreException {
-					final int f = d.getFlags();
-					IResource res = d.getResource();
-					IResource r = res;
-					if ((f & IResourceDelta.CONTENT) != 0
-							|| (f & IResourceDelta.ENCODING) != 0
-							|| r instanceof IContainer) {
-						String s = null;
-						RepositoryMapping m = null;
-
-						while (r != null) {
-							m = getRepositoryMapping(r);
-							if (m != null) {
-								break;
-							}
-
-							if (s != null) {
-								s = r.getName() + "/" + s;
-							} else {
-								s = r.getName();
-							}
-
-							r = r.getParent();
-						}
-
-						if (m == null) {
-							return false;
-						} else if (s == null) {
-							return true;
-						}
-					}
-					return false;
-				}
-			});
-		} catch (CoreException ce) {
-			// We are in deep trouble. This should NOT have happend. Detach
-			// our listeners and forget it ever did.
-			//
-			detachFromWorkspace();
-			Activator.logError(CoreText.GitProjectData_notifyChangedFailed, ce);
-		}
-	}
-
 	private File propertyFile() {
 		return new File(getProject()
 				.getWorkingLocation(Activator.getPluginId()).toFile(),
-- 
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 ` Shawn O. Pearce [this message]
2008-08-06  3:09   ` [EGIT PATCH 2/5] Don't crash the decorator update loop when resources are deleted Shawn O. Pearce
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-2-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).