Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Alternative TextResource(Factory) for EMF model(How to integrate an alternative textfile (un)parser alternatively to the standard xmi serialization)
Alternative TextResource(Factory) for EMF model [message #885720] Wed, 13 June 2012 13:32 Go to next message
Uwe Ritzmann is currently offline Uwe RitzmannFriend
Messages: 26
Registered: July 2009
Junior Member
Hi folks,

I have a very simple ecore metamodel representing text files.

Then I implemented an equally simple TextResourceFactory and TextResource to parse/unparse textfiles into/from model instances.

I made my TextResourceFactory known via extension point org.eclipse.emf.ecore.content_parser and I introduced a new content_type via extension point org.eclipse.core.contenttype.contentTypes using base-type="org.eclipse.core.runtime.text".

Trying to open text files with the generated ecore editor fails with:
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: org.xml.sax.SAXParseException: Content is not allowed in prolog.

Then - in the runtime eclipse - I registerd an extension against my new content type.
Still opening such a file with the generated ecore editor fails (same message).

Which further extension points - maybe in the edit or editor plugin - do I have to carefully invent in order to be able to open any text file, have it parsed into
an ecore model and edited in the generated ecore editor?

I tried to find comprehensive infos on the delicate content_type system of eclipse but without success.

Thanks in advance for any hints or pointers,

Uwe
Re: Alternative TextResource(Factory) for EMF model [message #885790 is a reply to message #885720] Wed, 13 June 2012 15:38 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33139
Registered: July 2009
Senior Member
Uwe,

Comments below.

On 13/06/2012 3:32 PM, Uwe Ritzmann wrote:
> Hi folks,
>
> I have a very simple ecore metamodel representing text files.
>
> Then I implemented an equally simple TextResourceFactory and
> TextResource to parse/unparse textfiles into/from model instances.
>
> I made my TextResourceFactory known via extension point
> org.eclipse.emf.ecore.content_parser and I introduced a new
> content_type via extension point
> org.eclipse.core.contenttype.contentTypes using
> base-type="org.eclipse.core.runtime.text".
>
> Trying to open text files with the generated ecore editor fails with:
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException:
> org.xml.sax.SAXParseException: Content is not allowed in prolog.
The default implementation for EMF content parsers of these will look
for namespaces in the XML. You'd have to write your own. I expect
basing this just on the extension would be better/easier...
>
> Then - in the runtime eclipse - I registerd an extension against my
> new content type.
> Still opening such a file with the generated ecore editor fails (same
> message).
>
> Which further extension points - maybe in the edit or editor plugin -
> do I have to carefully invent in order to be able to open any text
> file, have it parsed into
> an ecore model and edited in the generated ecore editor?
No, you have write something like what we did for the XML-based content
types...
>
> I tried to find comprehensive infos on the delicate content_type
> system of eclipse but without success.
>
> Thanks in advance for any hints or pointers,
Why isn't just using a unique extension sufficient?
>
> Uwe


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Alternative TextResource(Factory) for EMF model [message #886298 is a reply to message #885790] Thu, 14 June 2012 17:03 Go to previous message
Uwe Ritzmann is currently offline Uwe RitzmannFriend
Messages: 26
Registered: July 2009
Junior Member
Ed, thank you very much for your answer.

I did not succeed fully with my approach but an additional contentTypeBinding in extension point org.eclipse.ui.editors helped and allows the user via Preferences to register needed extensions against that content type which can then be edited by the EMF editor as text files and not XMI formatted.

Uwe
Previous Topic:[Net4j.util 4.0.0] Set driver type in cdo-server.xml throws ClassCastException
Next Topic:Re: [ATL] Invoking an ATL transformation on a part of a model, not on a whole model
Goto Forum:
  


Current Time: Tue Apr 23 06:45:29 GMT 2024

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

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

Back to the top