Home » Modeling » GMF (Graphical Modeling Framework) » Keeping platform:/ URIs absolute in hrefs
Keeping platform:/ URIs absolute in hrefs [message #520107] |
Thu, 11 March 2010 03:22 |
Jevon Messages: 164 Registered: July 2009 |
Senior Member |
|
|
Hi all,
In my GMF-based project, I wanted to have a model element with a
reference to another element that was part of my development environment.
This was possible, but I was having a problem with the 'href' attribute
automatically turning relative, rather than an absolute
'platform:/plugin/xyz/...', which it should have been.
Eventually, I found out that the solution for GMF was to modify
XXXDiagramEditorUtil.getSaveOptions(), and add the line:
saveOptions.put(XMLResource.OPTION_URI_HANDLER, new
URIHandlerImpl.PlatformSchemeAware());
Perhaps this could be added as an option to .gmfgen? I've implemented
this as a dynamic template for my project [1], but I think it is a
fairly common request, and the dynamic template is fairly fragile.
Hope this helps someone else :)
Cheers
Jevon
[1]:
http://www.jevon.org/wiki/Using_Platform_Resources_as_ERefer ences_in_GMF
|
|
|
Re: Keeping platform:/ URIs absolute in hrefs [message #520194 is a reply to message #520107] |
Thu, 11 March 2010 14:28 |
Ed Merks Messages: 33142 Registered: July 2009 |
Senior Member |
|
|
Jevon,
Why do you feel is "should" be absolute? It actually works fine to be
relative...
Jevon Wright wrote:
> Hi all,
>
> In my GMF-based project, I wanted to have a model element with a
> reference to another element that was part of my development environment.
>
> This was possible, but I was having a problem with the 'href'
> attribute automatically turning relative, rather than an absolute
> 'platform:/plugin/xyz/...', which it should have been.
>
> Eventually, I found out that the solution for GMF was to modify
> XXXDiagramEditorUtil.getSaveOptions(), and add the line:
>
> saveOptions.put(XMLResource.OPTION_URI_HANDLER, new
> URIHandlerImpl.PlatformSchemeAware());
>
> Perhaps this could be added as an option to .gmfgen? I've implemented
> this as a dynamic template for my project [1], but I think it is a
> fairly common request, and the dynamic template is fairly fragile.
>
> Hope this helps someone else :)
>
> Cheers
> Jevon
>
> [1]:
> http://www.jevon.org/wiki/Using_Platform_Resources_as_ERefer ences_in_GMF
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: Keeping platform:/ URIs absolute in hrefs [message #521880 is a reply to message #520194] |
Fri, 19 March 2010 01:16 |
Jevon Messages: 164 Registered: July 2009 |
Senior Member |
|
|
Hi Ed,
The problem was that platform URIs were converting into relative URIs
like so:
<type
href=" ../../../../plugin/org.openiaml.model/model/datatypes.xsd#// foo "/>
Thus, if the runtime model instances were moved into a parent or child
directory, the URIs would have become invalid. Yes, it worked fine, but
if the model instance was moved to a different project or folder, I
think things would start falling apart.
Cheers
Jevon
Ed Merks wrote:
> Jevon,
>
> Why do you feel is "should" be absolute? It actually works fine to be
> relative...
>
>
> Jevon Wright wrote:
>> Hi all,
>>
>> In my GMF-based project, I wanted to have a model element with a
>> reference to another element that was part of my development environment.
>>
>> This was possible, but I was having a problem with the 'href'
>> attribute automatically turning relative, rather than an absolute
>> 'platform:/plugin/xyz/...', which it should have been.
>>
>> Eventually, I found out that the solution for GMF was to modify
>> XXXDiagramEditorUtil.getSaveOptions(), and add the line:
>>
>> saveOptions.put(XMLResource.OPTION_URI_HANDLER, new
>> URIHandlerImpl.PlatformSchemeAware());
>>
>> Perhaps this could be added as an option to .gmfgen? I've implemented
>> this as a dynamic template for my project [1], but I think it is a
>> fairly common request, and the dynamic template is fairly fragile.
>>
>> Hope this helps someone else :)
>>
>> Cheers
>> Jevon
>>
>> [1]:
>> http://www.jevon.org/wiki/Using_Platform_Resources_as_ERefer ences_in_GMF
|
|
|
Goto Forum:
Current Time: Fri Apr 26 18:31:42 GMT 2024
Powered by FUDForum. Page generated in 0.03243 seconds
|