|
Re: findPackageFragment path issues [message #240994 is a reply to message #240943] |
Thu, 22 February 2007 10:20 |
Eclipse User |
|
|
|
Originally posted by: mehmet.sbox.tugraz.at
IJavaProject myJavaProject = ...
IPath filePath = Path.fromPortableString("com/noanswers/Perforator.java");
IJavaElement element = myJavaProject.findElement(filePath);
// when com.noanswers is the package name
if(element == null){ // file not in my project
} else{ // file in my project
}
hope helps.
Larry Edelstein schrieb:
> Hi all -
>
> I've got an absolute file system path like
> C:/Projects/bigthing/src/java/com/nowanswers/Perforator.java
>
> and I have a Java project, and I want to find either the IJavaElement
> corresponding to the file, or, failing that, the IPackageFragment
> containing it.
>
> I've had a lot of trouble with getting everything to work correctly
> w/r/t to paths.
>
> What's the canonical way to find the model elements I've described,
> within a specific project, given an OS full path?
>
> Larry Edelstein
> Chris Richardson Consulting
> San Francisco, CA
|
|
|
Powered by
FUDForum. Page generated in 0.02911 seconds