Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » File URI or Platfrom URI(strange behavior of the URI)
File URI or Platfrom URI [message #677361] Wed, 08 June 2011 09:45 Go to next message
No real name is currently offline No real nameFriend
Messages: 18
Registered: October 2009
Location: denmark
Junior Member
Hi,

I have made a GMF editor, which can load some model elements from other files.
All the files are located in the same workspace.

Take a given model, referencing to many model elements.
I found a very strange behavior about the element URIs.
some model element gives a file uri like:
"file:/C:/Users/xx/runtime-EclipseApplication/.."

some model element gives a platform uri like:
"platform:/resource/.."
or
"../../.." without platform:/resource prefix.

Can anyone explain me the reason, and point me to a unified approach that can get an IFile based on the different uris.

Thank you.

Wei


Re: File URI or Platfrom URI [message #687165 is a reply to message #677361] Wed, 08 June 2011 15:44 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 30452
Registered: July 2009
Senior Member
Comments below.

forums-noreply@eclipse.org wrote:
> Hi,
>
> I have made a GMF editor, which can load some model elements from
> other files.
> All the files are located in the same workspace.
>
> Take a given model, referencing to many model elements.
> I found a very strange behavior about the element URIs.
> some model element gives a file uri like:
> "file:/C:/Users/xx/runtime-EclipseApplication/.."
>
> some model element gives a platform uri like:
> "platform:/resource/.."
> or
> "../../.." without platform:/resource prefix.
>
> Can anyone explain me the reason, and point me to a unified approach
> that can get an IFile based on the different uris.
The URIs used in the serialization will be based on exactly the URIs on
the resources at the time they are saved. Whenever possible, EMF's
serializer will try to produce a relative URI, so if all resources have
URIs of the form platform:/resource/<project>/<path>/<file> then all
URIs will be relative of the form ../../..../<project>/<path>/<file> (or
similarly if all have the form file:/<drive>/<path>/<file>). If it's
mix and match, then you'll see what you're seeing; note that EMF doesn't
determine the URIs of the resources, the application must be doing that.
>
> Thank you.
>
> Wei
>
>
>
Re: File URI or Platfrom URI [message #687418 is a reply to message #677361] Wed, 08 June 2011 15:44 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 30452
Registered: July 2009
Senior Member
Comments below.

forums-noreply@eclipse.org wrote:
> Hi,
>
> I have made a GMF editor, which can load some model elements from
> other files.
> All the files are located in the same workspace.
>
> Take a given model, referencing to many model elements.
> I found a very strange behavior about the element URIs.
> some model element gives a file uri like:
> "file:/C:/Users/xx/runtime-EclipseApplication/.."
>
> some model element gives a platform uri like:
> "platform:/resource/.."
> or
> "../../.." without platform:/resource prefix.
>
> Can anyone explain me the reason, and point me to a unified approach
> that can get an IFile based on the different uris.
The URIs used in the serialization will be based on exactly the URIs on
the resources at the time they are saved. Whenever possible, EMF's
serializer will try to produce a relative URI, so if all resources have
URIs of the form platform:/resource/<project>/<path>/<file> then all
URIs will be relative of the form ../../..../<project>/<path>/<file> (or
similarly if all have the form file:/<drive>/<path>/<file>). If it's
mix and match, then you'll see what you're seeing; note that EMF doesn't
determine the URIs of the resources, the application must be doing that.
>
> Thank you.
>
> Wei
>
>
>
Previous Topic:(no subject)
Next Topic:EMF Javadocs
Goto Forum:
  


Current Time: Thu Sep 19 21:48:13 GMT 2019

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

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

Back to the top