Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Gather element lines when loading a resource (without extending XMLHandler)
Gather element lines when loading a resource (without extending XMLHandler) [message #1837561] Tue, 02 February 2021 12:00 Go to next message
Alfonso de la Vega is currently offline Alfonso de la VegaFriend
Messages: 13
Registered: January 2016
Junior Member
Hi,

I am trying to capture the lines of the original model file that correspond to each object being loaded from an EMF Resource.

I have seen that it is possible to do this by creating a specific XMIResourceImpl, along with an XMLLoad and an XMLHandler. Then, I can gather these lines from the Locator element of the handler during element parsing.

However, using a custom resource loading implementation loses any modifications that might be necessary when loading specific resources (e.g. Sirius ones), which might have their own special XMLLoad and XMLHandler implementations. This can translate into performance problems as well as losing some metadata information.

I have also tried to decorate these classes to wrap their functionality, but unfortunately Java does not allow to decorate protected methods (which are overridden in several places, for instance the createXMLLoad( ) of an XMIResourceImpl, or the makeDefaultHandler( ) of an XMLLoadImpl object).

Is there any other way to get the original file lines of the objects of a loading (or already loaded) Resource that I am missing?

Many thanks,
Alfonso
Re: Gather element lines when loading a resource (without extending XMLHandler) [message #1837566 is a reply to message #1837561] Tue, 02 February 2021 14:10 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 31848
Registered: July 2009
Senior Member
I don't think there is a feasible, general way to do this external to an existing specialized resource implementation.

Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Gather element lines when loading a resource (without extending XMLHandler) [message #1837567 is a reply to message #1837561] Tue, 02 February 2021 14:11 Go to previous message
Alfonso de la Vega is currently offline Alfonso de la VegaFriend
Messages: 13
Registered: January 2016
Junior Member
Currently checking if registering an XMLParserPoolImpl as loading option and decorating the XMLHandler there could be an option.
Previous Topic:Resolve an EClass that is a Proxy
Next Topic:Simple EMF model persistence to database?
Goto Forum:
  


Current Time: Thu Apr 22 12:26:51 GMT 2021

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

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

Back to the top