Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » how to use createPlatformResourceURI
how to use createPlatformResourceURI [message #410831] Tue, 10 July 2007 12:57 Go to next message
Alexandre Jaquet is currently offline Alexandre JaquetFriend
Messages: 38
Registered: July 2009
Member
Hi,

I'm looking for the way to use createPlatformResourceURI I've tryed

path =
" W:\\ofs-designer\\ofs_plugins_editors\\page-ui\\src\\main\\r esources\\page-designer.transformmodel ";
URI fileURI2 = URI.createPlatformResourceURI(path);

but I got :

Exception in thread "main"
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1$Diagno sticWrappedException:
java.io.IOException: The path
'/W:/ofs-designer/ofs_plugins_editors/page-ui/src/main/resou rces/page-designer.transformmodel'
is unmapped


Thanks
Re: how to use createPlatformResourceURI [message #410832 is a reply to message #410831] Tue, 10 July 2007 13:14 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Alexandre,

You'd use createFileURI if you're starting with a file system path as
you've shown below. You'd use
URI.createPlatformResourcURI(iFile.getFullPath().toString(), true) to
create a platform resource URI for a given IFile.


Alexandre Jaquet wrote:
> Hi,
>
> I'm looking for the way to use createPlatformResourceURI I've tryed
>
> path =
> " W:\\ofs-designer\\ofs_plugins_editors\\page-ui\\src\\main\\r esources\\page-designer.transformmodel ";
>
> URI fileURI2 = URI.createPlatformResourceURI(path);
>
> but I got :
>
> Exception in thread "main"
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1$Diagno sticWrappedException:
> java.io.IOException: The path
> '/W:/ofs-designer/ofs_plugins_editors/page-ui/src/main/resou rces/page-designer.transformmodel'
> is unmapped
>
>
> Thanks


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: how to use createPlatformResourceURI [message #410833 is a reply to message #410832] Tue, 10 July 2007 13:29 Go to previous messageGo to next message
Alexandre Jaquet is currently offline Alexandre JaquetFriend
Messages: 38
Registered: July 2009
Member
Thanks for responding but how can I create a IFile ?
Re: how to use createPlatformResourceURI [message #410834 is a reply to message #410833] Tue, 10 July 2007 13:47 Go to previous messageGo to next message
Alexandre Jaquet is currently offline Alexandre JaquetFriend
Messages: 38
Registered: July 2009
Member
Alexandre Jaquet a écrit :
> Thanks for responding but how can I create a IFile ?

I've tryed

IFile file = new
File(" W:\\advisor\\OFS\\1.40.0\\ofs-designer\\ofs_plugins_editors\ \page-ui\\src\\main\\resources\\page-designer.transformmodel ");
loadGuiToXGuiTransformation(file)

public void loadGuiToXGuiTransformation(IFile file)
URI fileURI2 = URI.createPlatformResourceURI(file.getFullPath(),true);

but I'm getting an error with file.getFullPath

The type org.eclipse.core.runtime.IPath cannot be resolved

I've imported the lib org.eclipse.core.runtime but I doesn't understand
why I'm getting this error.

Any idea ?

Thanks
Re: how to use createPlatformResourceURI [message #410835 is a reply to message #410834] Tue, 10 July 2007 13:53 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Alexandre,

ResourcePlugin.getWorkspace().getRoot().findFilesForLocation can be used.


Alexandre Jaquet wrote:
> Alexandre Jaquet a écrit :
>> Thanks for responding but how can I create a IFile ?
>
> I've tryed
>
> IFile file = new
> File(" W:\\advisor\\OFS\\1.40.0\\ofs-designer\\ofs_plugins_editors\ \page-ui\\src\\main\\resources\\page-designer.transformmodel ");
>
> loadGuiToXGuiTransformation(file)
>
> public void loadGuiToXGuiTransformation(IFile file)
> URI fileURI2 = URI.createPlatformResourceURI(file.getFullPath(),true);
>
> but I'm getting an error with file.getFullPath
>
> The type org.eclipse.core.runtime.IPath cannot be resolved
>
> I've imported the lib org.eclipse.core.runtime but I doesn't
> understand why I'm getting this error.
>
> Any idea ?
>
> Thanks


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: how to use createPlatformResourceURI [message #410837 is a reply to message #410835] Tue, 10 July 2007 15:27 Go to previous messageGo to next message
Alexandre Jaquet is currently offline Alexandre JaquetFriend
Messages: 38
Registered: July 2009
Member
Hi Ed,

Thanks for your response, I used it but I get an
java.lang.IllegalStateException exception : Exception in thread "main"
Workspace is closed.

I'm working on a standalone application where I need to load an emf
model who contain reference to others models.

Regards
Re: how to use createPlatformResourceURI [message #410839 is a reply to message #410837] Tue, 10 July 2007 15:30 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Alexandre,

Then it sounds like you aren't really running Eclipse, either headless,
RCP, or the IDE. In that case there is no workspace and you should
probably just use URI.createFileURI to access the file system directly.


Alexandre Jaquet wrote:
> Hi Ed,
>
> Thanks for your response, I used it but I get an
> java.lang.IllegalStateException exception : Exception in thread "main"
> Workspace is closed.
>
> I'm working on a standalone application where I need to load an emf
> model who contain reference to others models.
>
> Regards


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Eclipse refactoring APIs Java
Next Topic:Serialization of cross references
Goto Forum:
  


Current Time: Fri Apr 26 17:51:25 GMT 2024

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

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

Back to the top