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

[EGIT PATCH] Circument situations where Eclipse tries to decorate resources that do not exist

From
Robin Rosenberg <robin.rosenberg@dewire.com>
Date
Mar 9, 2008, 23:33 UTC
Message-ID
<200803100033.53905.robin.rosenberg@dewire.com>

This happens when the workspace has not been refreshed properly, e.g. when switching branches behind Eclipse's back.

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
 .../internal/decorators/GitResourceDecorator.java  |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

This one seems hard to replicate though I think it shouldn't. Maybe Eclipse refereshes on demand sometime and sometimes not. This stacktrace suggests this is the right thing to do.

java.lang.RuntimeException: Resource decorator failed to load tree contents on demand.
        at org.spearce.egit.ui.internal.decorators.GitResourceDecorator.decorate(GitResourceDecorator.java:347)
        at org.eclipse.ui.internal.decorators.LightweightDecoratorDefinition.decorate(LightweightDecoratorDefinition.java:253)
        at org.eclipse.ui.internal.decorators.LightweightDecoratorManager$LightweightRunnable.run(LightweightDecoratorManager.java:71)
        at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
        at org.eclipse.core.runtime.Platform.run(Platform.java:857)
        at org.eclipse.ui.internal.decorators.LightweightDecoratorManager.decorate(LightweightDecoratorManager.java:336)
        at org.eclipse.ui.internal.decorators.LightweightDecoratorManager.getDecorations(LightweightDecoratorManager.java:322)
        at org.eclipse.ui.internal.decorators.DecorationScheduler$1.ensureResultCached(DecorationScheduler.java:369)
        at org.eclipse.ui.internal.decorators.DecorationScheduler$1.run(DecorationScheduler.java:329)
        at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: org.eclipse.core.internal.resources.ResourceException: Resource '/org.spearce.jgit/src/org/spearce/jgit/stgit' does not exist.
        at org.eclipse.core.internal.resources.Resource.checkExists(Resource.java:310)
        at org.eclipse.core.internal.resources.Resource.checkAccessible(Resource.java:193)
        at org.eclipse.core.internal.resources.Resource.getSessionProperty(Resource.java:1079)
        at org.spearce.egit.ui.internal.decorators.GitResourceDecorator.decorate(GitResourceDecorator.java:246)
        ... 9 more
-- robin
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 7eb008b..d0f9864 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
@@ -225,6 +225,13 @@ public class GitResourceDecorator extends LabelProvider implements
 		if (rsrc == null)
 			return;
 
+		// If the workspace has not been refreshed properly a resource might
+		// not actually exist, so we ignore these and do not decorate them
+		if (!rsrc.exists() && !rsrc.isPhantom()) {
+			Activator.trace("Tried to decorate non-existent resource "+rsrc);
+			return;
+		}
+
 		RepositoryMapping mapped = RepositoryMapping.getMapping(rsrc);
 
 		Activator.trace("decorate: " + element);
-- 
1.5.4.3
Next: Shawn O. Pearce
Message 1 of 2 in “Circument situations where Eclipse tries to decorate resources that do not exist”
  1. Circument situations where Eclipse tries to decorate resources that do not existRobin Rosenberg, Mar 9, 2008
  2. Shawn O. PearceMar 10, 2008

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.