Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[wtp-dev] Getting an EMF resource from an ArtifactEditModel, given an IFile and not a deploy location

I'm trying to load an EMF resource from a project's (a jst.utility project in this case, but this should work for any jst.* project) edit model. I have the actual file, therefore also its full path or project relative path, which in this case is "src/META-INF/persistence.xml".

When I call:
artifactEditModel.getResource(fileURI) (where fileURI is the URI for the project relative path above, "src/META-INF/persistence.xml") the edit model normalizes the path to "src/src/META-INF/persistence.xml", assuming that what I've given it is the *deployment* path for the resource. It assumes, that since it can't find the virtual file for "src/META-INF/persistence.xml", that it doesn't exist, but that if it did exist, it would be at the same relative location in the first source folder for the project. This seems wrong, because I'd expect that it would first see if there's an *actual* resource at the given location before trying to make such an assumption, but maybe there's a reason for doing this that I don't understand. So the end result is that the edit model tries to give me a resource for the project relative location "src/src/META-INF/persistence.xml" (which doesn't exist) instead of the project relative location "src/META-INF/persistence.xml" (which does exist).

Is there a way to either:
- easily find the deployment path for a source path? (If I give the actual deployment path for the file "META-INF/persistence.xml", then the normalized path calculated will be correct.)
or
- better specify the URI of my file resource so that the edit model can find my EMF resource?

Thanks,

Paul Fullbright
Oracle Corp.
Eclipse Dali/Java Persistence Tools Development
paul.fullbright@xxxxxxxxxx




Back to the top