Paul - First I want to apologize for taking so long to respond... I'm working on addressing these questions more regulary
There may be an issue here, but I first want to understand your scenario... Because you are using the ArtifactEditModel.getResource api, we use our own internal "module:" protocol when constructing the uri. The resourceset has a URIConverter that knows how to normalize this uri using the projects component model. The projects "root folder" is used to determine the offset, and I'm guessing this project uses the "src" folder. Have you tried using the uri "META-INF/persistence.xml"? Most of our uri's are static, so we don't need to calculate the offset into the "deployed" path. But if you have an IFile instance of your resource you can use: IVirtualComponent component = ComponentCore.createComponent(project); List folderList = Arrays.asList (component.getRootFolder().getUnderlyingFolders()); // All the folders that contribute to the root deployment path IPath path = WorkbenchResourceHelperBase.getPathFromContainers(list, anIFile.getFullPath()); // Will find the first match(folder) that contains your IFile Hope this helps... Chuck Rational Java EE Tooling Team Lead IBM Software Lab - Research Triangle Park, NC Email: [EMAIL PROTECTED] Phone: 919-254-1848 (T/L: 444) Paul Fullbright <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED] 08/27/2007 03:37 PM Please respond to "General discussion of project-wide or architectural issues." <[email protected]> To "General discussion of project-wide or architectural issues." <[email protected]> cc Subject [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 [EMAIL PROTECTED] _______________________________________________ wtp-dev mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/wtp-dev
_______________________________________________ wtp-dev mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/wtp-dev
