Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-team-dev] IFile.exists() always returns false


Donald,

This mailing list is for discussions related to the developement of the Team component of Eclipse. A better place to ask this question would be the eclipse-platform newsgroup.

If I was to guess, I would say that the most likely cause of your problem is that the path you are providing (absolutePathToFile) is not relative to your container. Try adding this line before your exists chack and see what the result is:

        System.out.println(toFile.getLocationURI().toString())

Michael



"Donald E. Stinchfield" <des@xxxxxxxx>
Sent by: platform-team-dev-bounces@xxxxxxxxxxx

16/01/2007 11:28 PM

Please respond to
Generic team support framework <platform-team-dev@xxxxxxxxxxx>

To
<platform-team-dev@xxxxxxxxxxx>
cc
Subject
[platform-team-dev] IFile.exists() always returns false





From my plugin code I have created a new file in my workspace and am adding it to my project using the following code:
 
                    IPath workspaceIPath = new Path(absolutePathToFile);
                    IFile toFile = toContainer.getFile(workspaceIPath);
 
I don’t bother calling toFile.create() since the file is already there, plus from the navigator I see my new file in the project.  All looks good so far.
 
The problem is I want to set a property value on the file as soon as I add it to the workspace.  I’m using the following updated code
 
                    IPath workspaceIPath = new Path(absolutePathToFile);
                    IFile toFile = toContainer.getFile(workspaceIPath);
                    toFile.refreshLocal(IResource.DEPTH_INFINITE, null);
                    if (toFile.exists())
                        toFile.setPersistentProperty(MY_KEY,  “Some string”);
 
toFile.exists() always returns false.  I thought refreshLocal() would take care of it, but it doesn’t.  I’ve tried a bunch of things and have searched through the bug list and mailing lists.  I haven’t come up with anything.  Any thoughts?
 
Regards,
Don
 
 
 
 
 _______________________________________________
platform-team-dev mailing list
platform-team-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-team-dev


Back to the top