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
Ryan Mising name is currently offline Ryan Mising nameFriend
Messages: 9
Registered: July 2009
Junior Member
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
Prakash G.R. is currently offline Prakash G.R.Friend
Messages: 621
Registered: July 2009
Senior Member
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
Ryan Mising name is currently offline Ryan Mising nameFriend
Messages: 9
Registered: July 2009
Junior Member
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
Prakash G.R. is currently offline Prakash G.R.Friend
Messages: 621
Registered: July 2009
Senior Member
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: Sat Aug 17 00:35:57 GMT 2024

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

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

Back to the top