Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » How can i change loaded resource uri ?
How can i change loaded resource uri ? [message #1222326] Fri, 20 December 2013 06:52 Go to next message
serhat gezgin is currently offline serhat gezginFriend
Messages: 243
Registered: January 2013
Location: Izmir
Senior Member
Hi all,

I want to ask, how can i change loaded resource uri ?

when i load resource and used it on file,

loaded as;
<types href="../../../plugin/com.mdd4cca.msf.content/model/Types.xmi#/"/>


but i need to store uri as absolute path cause when i move file its failing can i change this behavior?

Regards
Re: How can i change loaded resource uri ? [message #1222412 is a reply to message #1222326] Fri, 20 December 2013 10:44 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
You could use org.eclipse.emf.ecore.xmi.XMLResource.OPTION_URI_HANDLER.
You could use an instance of
org.eclipse.emf.ecore.xmi.impl.URIHandlerImpl.PlatformSchemeAware as the
value to avoid relative paths between platform:/resource and
platform:/plugin URIs, e.g., like we do for *.ecore resources:

public class EcoreResourceFactoryImpl extends ResourceFactoryImpl
{
/**
* Constructor for EcoreResourceFactoryImpl.
*/
public EcoreResourceFactoryImpl()
{
super();
}

@Override
public Resource createResource(URI uri)
{
XMLResource result =
new XMIResourceImpl(uri)
{
@Override
protected boolean useIDs()
{
return eObjectToIDMap != null || idToEObjectMap != null;
}
};
result.setEncoding("UTF-8");

result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE,
Boolean.TRUE);
result.getDefaultSaveOptions().put(XMLResource.OPTION_LINE_WIDTH, 80);
result.getDefaultSaveOptions().put(XMLResource.OPTION_URI_HANDLER, new
URIHandlerImpl.PlatformSchemeAware());
return result;
}
}


On 20/12/2013 7:52 AM, serhat gezgin wrote:
> Hi all,
>
> I want to ask, how can i change loaded resource uri ?
>
> when i load resource and used it on file,
> loaded as;
>
> <types href="../../../plugin/com.mdd4cca.msf.content/model/Types.xmi#/"/>
>
>
> but i need to store uri as absolute path cause when i move file its
> failing can i change this behavior?
>
> Regards


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: How can i change loaded resource uri ? [message #1222563 is a reply to message #1222412] Fri, 20 December 2013 19:26 Go to previous message
serhat gezgin is currently offline serhat gezginFriend
Messages: 243
Registered: January 2013
Location: Izmir
Senior Member
Thanks Ed,

your suggestion solved my problem

Regards
Previous Topic:[EMFStore] dirty state notifications
Next Topic:[EMFStore] file transfer API
Goto Forum:
  


Current Time: Thu Apr 25 16:58:58 GMT 2024

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

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

Back to the top