Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Programmatically locate file in Project?
Programmatically locate file in Project? [message #330502] Wed, 30 July 2008 15:06 Go to next message
Eclipse UserFriend
Given an IProject A and a file name B, is there any facility available
that can be used to determine whether file B is contained in project A?
My goal is to be able to determine whether a file belongs to a project
without doing a file search. Thanks.

- Ryan
Re: Programmatically locate file in Project? [message #330506 is a reply to message #330502] Wed, 30 July 2008 16:08 Go to previous messageGo to next message
Eclipse UserFriend
You can use a IResourceVisitor to browse thru the files in the project
and determine whether its available or not.

- Prakash

www.eclipse-tips.com



Ryan wrote:
> Given an IProject A and a file name B, is there any facility available
> that can be used to determine whether file B is contained in project A?
> My goal is to be able to determine whether a file belongs to a project
> without doing a file search. Thanks.
>
> - Ryan
>
Re: Programmatically locate file in Project? [message #330511 is a reply to message #330506] Wed, 30 July 2008 18:40 Go to previous messageGo to next message
Eclipse UserFriend
Thanks for the reply...this can work if all I have is a filename, like
"test.h", and not a full path, like "/this/is/the/actual/location/test.h"?

- Ryan
Re: Programmatically locate file in Project? [message #330520 is a reply to message #330511] Thu, 31 July 2008 04:51 Go to previous message
Eclipse UserFriend
Yes. You should call project.accept(resourceVisitor); It will call the
visit method for every resource (assuming you have returning true for
its parent) Just check the java docs. It should help a lot


- Prakash

www.eclipse-tips.com



Ryan wrote:
> Thanks for the reply...this can work if all I have is a filename, like
> "test.h", and not a full path, like "/this/is/the/actual/location/test.h"?
>
> - Ryan
>
Previous Topic:Building Update Site with platform specific fragments
Next Topic:Progress bar in wizard
Goto Forum:
  


Current Time: Mon Feb 10 20:54:25 GMT 2025

Powered by FUDForum. Page generated in 0.03627 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top