{"thread":{"id":"12610","subject":"[EGIT PATCH] Circument situations where Eclipse tries to decorate resources that do not exist","startedAt":"2008-03-09T23:33:53Z","lastAt":"2008-03-10T23:40:28Z","messageCount":2,"participants":["Robin Rosenberg","Shawn O. Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"71541","messageId":"200803100033.53905.robin.rosenberg@dewire.com","threadId":"12610","inReplyTo":null,"subject":"[EGIT PATCH] Circument situations where Eclipse tries to decorate resources that do not exist","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg@dewire.com","sentAt":"2008-03-09T23:33:53Z","receivedAt":"2008-03-09T23:33:53Z","isPatch":true,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"This happens when the workspace has not been refreshed properly, e.g.\nwhen switching branches behind Eclipse's back.\n\nSigned-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>\n---\n .../internal/decorators/GitResourceDecorator.java  |    7 +++++++\n 1 files changed, 7 insertions(+), 0 deletions(-)\n\nThis one seems hard to replicate though I think it shouldn't. Maybe Eclipse refereshes on demand\nsometime and sometimes not.  This stacktrace suggests this is the right thing to do.\n\njava.lang.RuntimeException: Resource decorator failed to load tree contents on demand.\n        at org.spearce.egit.ui.internal.decorators.GitResourceDecorator.decorate(GitResourceDecorator.java:347)\n        at org.eclipse.ui.internal.decorators.LightweightDecoratorDefinition.decorate(LightweightDecoratorDefinition.java:253)\n        at org.eclipse.ui.internal.decorators.LightweightDecoratorManager$LightweightRunnable.run(LightweightDecoratorManager.java:71)\n        at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)\n        at org.eclipse.core.runtime.Platform.run(Platform.java:857)\n        at org.eclipse.ui.internal.decorators.LightweightDecoratorManager.decorate(LightweightDecoratorManager.java:336)\n        at org.eclipse.ui.internal.decorators.LightweightDecoratorManager.getDecorations(LightweightDecoratorManager.java:322)\n        at org.eclipse.ui.internal.decorators.DecorationScheduler$1.ensureResultCached(DecorationScheduler.java:369)\n        at org.eclipse.ui.internal.decorators.DecorationScheduler$1.run(DecorationScheduler.java:329)\n        at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)\nCaused by: org.eclipse.core.internal.resources.ResourceException: Resource '/org.spearce.jgit/src/org/spearce/jgit/stgit' does not exist.\n        at org.eclipse.core.internal.resources.Resource.checkExists(Resource.java:310)\n        at org.eclipse.core.internal.resources.Resource.checkAccessible(Resource.java:193)\n        at org.eclipse.core.internal.resources.Resource.getSessionProperty(Resource.java:1079)\n        at org.spearce.egit.ui.internal.decorators.GitResourceDecorator.decorate(GitResourceDecorator.java:246)\n        ... 9 more\n\n-- robin\n\ndiff --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\nindex 7eb008b..d0f9864 100644\n--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitResourceDecorator.java\n+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitResourceDecorator.java\n@@ -225,6 +225,13 @@ public class GitResourceDecorator extends LabelProvider implements\n \t\tif (rsrc == null)\n \t\t\treturn;\n \n+\t\t// If the workspace has not been refreshed properly a resource might\n+\t\t// not actually exist, so we ignore these and do not decorate them\n+\t\tif (!rsrc.exists() && !rsrc.isPhantom()) {\n+\t\t\tActivator.trace(\"Tried to decorate non-existent resource \"+rsrc);\n+\t\t\treturn;\n+\t\t}\n+\n \t\tRepositoryMapping mapped = RepositoryMapping.getMapping(rsrc);\n \n \t\tActivator.trace(\"decorate: \" + element);\n-- \n1.5.4.3\n"},{"id":"71627","messageId":"20080310234028.GI8410@spearce.org","threadId":"12610","inReplyTo":"200803100033.53905.robin.rosenberg@dewire.com","subject":"Re: [EGIT PATCH] Circument situations where Eclipse tries to decorate resources that do not exist","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-03-10T23:40:28Z","receivedAt":"2008-03-10T23:40:28Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Robin Rosenberg <robin.rosenberg@dewire.com> wrote:\n> This happens when the workspace has not been refreshed properly, e.g.\n> when switching branches behind Eclipse's back.\n> \n> Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>\n> ---\n>  .../internal/decorators/GitResourceDecorator.java  |    7 +++++++\n>  1 files changed, 7 insertions(+), 0 deletions(-)\n> \n> This one seems hard to replicate though I think it shouldn't. Maybe Eclipse refereshes on demand\n> sometime and sometimes not.\n\nYup.  Earlier versions used to do a periodic refresh more often,\nwhich really screwed up my Ant based build when Eclipse started\nto _also_ build the same project to the same class folder at the\nsame time.\n\n3.3.1.1 seems to not do this as often to me, and tends to wait for\na user-demanded refresh.  But then every once in a while it just\nstarts building all of a sudden, which makes me think they still\nare doing a periodic refresh.  I don't know what is up with Eclipse.\n\nAnd SWT is all about \"we need access to the host native drawing APIs\nto get good performance\" but then Eclipse's resource system does\nnot appear to have filesystem monitors like inotify implemented for\nthe major OSes that Eclipse runs on.  Yet another aspect I don't get.\n\nYea, yea, if it bothers me, write the patch and submit it to Eclipse.\nI'm too busy working on Git support.  I'll wait for someone else\nto write it and submit it for me.  They may be waiting for me to\nfinish Git support first.  ;-)\n\n> This stacktrace suggests this is the right thing to do.\n\nYea, I think so too.  Sucks.\n \n-- \nShawn.\n"}]}