git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[EGIT PATCH v2 10/12] Don't decorate every single resource on repository change

From
Tor Arne Vestbø <torarnv@gmail.com>
Date
Feb 11, 2009, 18:40 UTC
Message-ID
<1234377614-23798-11-git-send-email-torarnv@gmail.com>
In-Reply-To
<1234377614-23798-10-git-send-email-torarnv@gmail.com>

Not all resources have corresponding labels that are visible, so by using LabelProviderChangedEvent() we ensure that only the visible labels are refreshed.

The downside is that we lose project precition, so all projects are included, but only visible labels in those projects are re-decorated, so it is OK for now.

Signed-off-by: Tor Arne Vestbø <torarnv@gmail.com>
---
 .../decorators/GitLightweightDecorator.java        |   28 +++-----------------
 1 files changed, 4 insertions(+), 24 deletions(-)
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitLightweightDecorator.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitLightweightDecorator.java
index c23ce24..1e95369 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitLightweightDecorator.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitLightweightDecorator.java
@@ -14,11 +14,9 @@
 package org.spearce.egit.ui.internal.decorators;
 
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
@@ -28,7 +26,6 @@
 import org.eclipse.core.resources.IResourceChangeListener;
 import org.eclipse.core.resources.IResourceDelta;
 import org.eclipse.core.resources.IResourceDeltaVisitor;
-import org.eclipse.core.resources.IResourceVisitor;
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.resources.mapping.ResourceMapping;
 import org.eclipse.core.runtime.CoreException;
@@ -697,7 +694,7 @@ public void propertyChange(PropertyChangeEvent event) {
 		if (prop.equals(TeamUI.GLOBAL_IGNORES_CHANGED)
 				|| prop.equals(TeamUI.GLOBAL_FILE_TYPES_CHANGED)
 				|| prop.equals(Activator.DECORATORS_CHANGED)) {
-			postLabelEvent(new LabelProviderChangedEvent(this, null /* all */));
+			postLabelEvent(new LabelProviderChangedEvent(this));
 		}
 	}
 
@@ -824,29 +821,12 @@ public void refsChanged(RefsChangedEvent e) {
 	 * Callback for RepositoryChangeListener events, as well as
 	 * RepositoryListener events via repositoryChanged()
 	 * 
-	 * We resolve the project and schedule a refresh of each resource in the
-	 * project.
-	 * 
 	 * @see org.spearce.egit.core.project.RepositoryChangeListener#repositoryChanged(org.spearce.egit.core.project.RepositoryMapping)
 	 */
 	public void repositoryChanged(RepositoryMapping mapping) {
-		final IProject project = mapping.getContainer().getProject();
-		if (project == null)
-			return;
-
-		final List<IResource> resources = new ArrayList<IResource>();
-		try {
-			project.accept(new IResourceVisitor() {
-				public boolean visit(IResource resource) {
-					resources.add(resource);
-					return true;
-				}
-			});
-			postLabelEvent(new LabelProviderChangedEvent(this, resources
-					.toArray()));
-		} catch (final CoreException e) {
-			handleException(project, e);
-		}
+		// Until we find a way to refresh visible labels within a project
+		// we have to use this blanket refresh that includes all projects.
+		postLabelEvent(new LabelProviderChangedEvent(this));
 	}
 
 	// -------- Helper methods --------
-- 
1.6.1.2.309.g2ea3
Previous: Tor Arne VestbøNext: Tor Arne Vestbø
Message 11 of 21 in “Support customizable label decorations”
  1. 00/12 Support customizable label decorationsTor Arne Vestbø, Feb 11, 2009
  2. 01/12 Add support code to handle plugin property changesTor Arne Vestbø, Feb 11, 2009
  3. 02/12 Use Set instead of array to keep track of change listenersTor Arne Vestbø, Feb 11, 2009
  4. 03/12 Add a specialized team exception for GitTor Arne Vestbø, Feb 11, 2009
  5. 04/12 Add new class ExceptionCollector for grouping exceptionsTor Arne Vestbø, Feb 11, 2009
  6. 05/12 Add new class SWTUtils with helper-methods for creating controlsTor Arne Vestbø, Feb 11, 2009
  7. 06/12 Implement basic customizable label decorations with preferencesTor Arne Vestbø, Feb 11, 2009
  8. 07/12 Add binding for name of the current branchTor Arne Vestbø, Feb 11, 2009
  9. 08/12 Add icon decoration for tracked and untracked resourcesTor Arne Vestbø, Feb 11, 2009
  10. 09/12 Implement icon and text decorations of various resource statesTor Arne Vestbø, Feb 11, 2009
  11. 10/12 Don't decorate every single resource on repository changeTor Arne Vestbø, Feb 11, 2009
  12. 11/12 Expose the underlying resource entries in ContainerTreeIteratorTor Arne Vestbø, Feb 11, 2009
  13. 12/12 Implement label decorations for folders and projectsTor Arne Vestbø, Feb 11, 2009
  14. Robin RosenbergFeb 12, 2009
  15. Robin RosenbergFeb 11, 2009
  16. 08/12 Add icon decoration for tracked and untracked resourcesTor Arne Vestbø, Feb 11, 2009
  17. Robin RosenbergFeb 16, 2009
  18. Tor Arne VestbøFeb 16, 2009
  19. Robin RosenbergFeb 17, 2009
  20. 13/12 Add new file tree iterator that can adapt into a ContainerTreeIteratorTor Arne Vestbø, Feb 17, 2009
  21. 14/12 Allow project decorations regardless of repository root locationTor Arne Vestbø, Feb 17, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.