Skip to main content



      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 07:00 Go to next message
Eclipse UserFriend
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 09:10 Go to previous messageGo to next message
Eclipse UserFriend
I don't think there is a feasible, general way to do this external to an existing specialized resource implementation.
Re: Gather element lines when loading a resource (without extending XMLHandler) [message #1837567 is a reply to message #1837561] Tue, 02 February 2021 09:11 Go to previous message
Eclipse UserFriend
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 May 15 10:14:04 EDT 2025

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

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

Back to the top