|
Re: How can i change loaded resource uri ? [message #1222412 is a reply to message #1222326] |
Fri, 20 December 2013 10:44 |
Ed Merks Messages: 33107 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/
|
|
|
|
Powered by
FUDForum. Page generated in 0.01649 seconds