Skip to main content



      Home
Home » Modeling » TMF (Xtext) » How could I create a new Xtext project from existing ecore model then there is no brackets in xtext?(How could I create a new Xtext project from existing ecore model then there is no brackets in xtext?)
How could I create a new Xtext project from existing ecore model then there is no brackets in xtext? [message #1840740] Fri, 23 April 2021 03:30 Go to next message
Eclipse UserFriend
Hi, I am trying to create a new xtext project from an existing ecore model, however I found there are a lot of brackets such as '{', '}' in my xtext file, I don't need them, how can I remove them automatically? I mean when I generate a xtext project from an existing ecore, then there is no '{' and '}' in my xtext file.
Re: How could I create a new Xtext project from existing ecore model then there is no brackets in xt [message #1840756 is a reply to message #1840740] Fri, 23 April 2021 08:38 Go to previous messageGo to next message
Eclipse UserFriend
there is no customization for the wizard so you would either to remove it yourself manually
or write a patched version of the wizard / Ecore2XtextGenerator
Re: How could I create a new Xtext project from existing ecore model then there is no brackets in xt [message #1840757 is a reply to message #1840756] Fri, 23 April 2021 08:45 Go to previous messageGo to next message
Eclipse UserFriend
Okay, Thank you Christian, so I seem to have to write a generator by my own.
Re: How could I create a new Xtext project from existing ecore model then there is no brackets in xt [message #1840760 is a reply to message #1840757] Fri, 23 April 2021 08:54 Go to previous messageGo to next message
Eclipse UserFriend
you can simply edit the xtext file
Re: How could I create a new Xtext project from existing ecore model then there is no brackets in xt [message #1840762 is a reply to message #1840760] Fri, 23 April 2021 08:57 Go to previous messageGo to next message
Eclipse UserFriend
Yes, I can edit the xtext file manually, but I still want to know if there is a way for me to remove all the brackets automatically.
Re: How could I create a new Xtext project from existing ecore model then there is no brackets in xt [message #1840763 is a reply to message #1840762] Fri, 23 April 2021 08:59 Go to previous messageGo to next message
Eclipse UserFriend
i assume a find and replace would do the job.
the more interesting question would be if the grammar is still unambiguous then
Re: How could I create a new Xtext project from existing ecore model then there is no brackets in xt [message #1840764 is a reply to message #1840763] Fri, 23 April 2021 09:10 Go to previous messageGo to next message
Eclipse UserFriend
Hi

The Ecore2Xtext generator is a very helpful starter, but it is only a starter since it cannot know what your aesthetic preferences are for the use of e.g. many keywords/quoted strings/special punctuation and for how to nest constructs. It therefore just takes a relatively simple and reliable approach that gives you something much more user friendly than XML but probably not that much different from HUTN. You need to use your expertise to tailor the grammar to something much more aesthetically pleasing.

Regards

Ed Willink
Re: How could I create a new Xtext project from existing ecore model then there is no brackets in xt [message #1840765 is a reply to message #1840763] Fri, 23 April 2021 09:12 Go to previous messageGo to next message
Eclipse UserFriend
yes, if the purpose was only to remove all the brackets, then a find and a replace would do the job, but my next job could be for example to move a specific attribute (for example 'shortName') to another place, or some other more complicated intention, in that case, I assume only find and replace won't be enough for me.
Re: How could I create a new Xtext project from existing ecore model then there is no brackets in xt [message #1840766 is a reply to message #1840764] Fri, 23 April 2021 09:27 Go to previous messageGo to next message
Eclipse UserFriend
Okay, Thank you Ed, Thank you for your reply. Could ask you a further question: where could I find Ecore2Xtext generator, is it a plugin that I need download and install?

Best regards,
Weixing
Re: How could I create a new Xtext project from existing ecore model then there is no brackets in xt [message #1840767 is a reply to message #1840766] Fri, 23 April 2021 09:31 Go to previous messageGo to next message
Eclipse UserFriend
no class name is org.eclipse.xtext.xtext.wizard.ecore2xtext.Ecore2XtextGrammarCreator
and its part of the org.eclipse.xtext.xtext.wizard plugin
https://github.com/eclipse/xtext-core/tree/master/org.eclipse.xtext.xtext.wizard/src/org/eclipse/xtext/xtext/wizard/ecore2xtext

[Updated on: Fri, 23 April 2021 09:33] by Moderator

Re: How could I create a new Xtext project from existing ecore model then there is no brackets in xt [message #1840772 is a reply to message #1840767] Fri, 23 April 2021 10:00 Go to previous messageGo to next message
Eclipse UserFriend
Okay, thank you so much Christian, so I need to install org.eclipse.xtext.xtext.wizard plugin, right?

Best regards,
Weixing
Re: How could I create a new Xtext project from existing ecore model then there is no brackets in xt [message #1840775 is a reply to message #1840772] Fri, 23 April 2021 10:05 Go to previous messageGo to next message
Eclipse UserFriend
it is already installed
Re: How could I create a new Xtext project from existing ecore model then there is no brackets in xt [message #1840777 is a reply to message #1840775] Fri, 23 April 2021 10:20 Go to previous messageGo to next message
Eclipse UserFriend
Okay, Thank you Christian, but maybe I am a little fool, I can't find it in my eclipse projects. In my current understanding, I should find the org.eclipse.xtext.xtext.wizard.ecore2xtext.Ecore2XtextGrammarCreator which is part of org.eclipse.xtext.xtext.wizard plugin, then I modify it to achieve my purpose, right?

Best regards,
Weixing
Re: How could I create a new Xtext project from existing ecore model then there is no brackets in xt [message #1840784 is a reply to message #1840777] Fri, 23 April 2021 12:11 Go to previous messageGo to next message
Eclipse UserFriend
You need to add it to manifest
Re: How could I create a new Xtext project from existing ecore model then there is no brackets in xt [message #1840785 is a reply to message #1840784] Fri, 23 April 2021 12:14 Go to previous messageGo to next message
Eclipse UserFriend
Okay, got it, thank you so much!!

Best regards,
Weixing
Re: How could I create a new Xtext project from existing ecore model then there is no brackets in xt [message #1840791 is a reply to message #1840785] Fri, 23 April 2021 13:54 Go to previous messageGo to next message
Eclipse UserFriend
Hi

The standard *.genmodel has a variety of Model/Edit sections for each EClassifier/EStructuralFeature. It would be technically possible for the *.genmodel to also have a Grammar section to select and parameterize a parsing/formatting idiom for each EClassifier/EStructuralFeature.

However while the *.genmodel is regularly used to regenerate the model implementation and edit ItemProviders, it is difficult to see any users choosing to treat the *.ecore as the master with the *.xtext a regularly re-auto-generated slave. So with the Ecore2Xtext conversion a one-off throwaway for only a small number of users in the first place,, it is hard to see how anyone will be motivated enough to provide the enhanced wizard.

Regards

Ed Willink
Re: How could I create a new Xtext project from existing ecore model then there is no brackets in xt [message #1840792 is a reply to message #1840791] Fri, 23 April 2021 14:19 Go to previous messageGo to next message
Eclipse UserFriend
Okay, thank you Ed, I see, that's why it's so hard for me to find an answer from google, your interpretation makes sense very much!

Best regards,
Weixing
Re: How could I create a new Xtext project from existing ecore model then there is no brackets in xt [message #1840886 is a reply to message #1840784] Wed, 28 April 2021 03:32 Go to previous messageGo to next message
Eclipse UserFriend
Dear Christian,

The code of Ecore2Xtext looks wonderful, and I have imported into MENIFEST, but how do I use it? Because the detailed process of generation of Xtext usually is implicit or backstage, how can I use Ecore2Xtext plugin to instead of the default process?

Best regards,
Weixing
Re: How could I create a new Xtext project from existing ecore model then there is no brackets in xt [message #1840901 is a reply to message #1840886] Wed, 28 April 2021 09:05 Go to previous message
Eclipse UserFriend
you may import the plugin to your codebase, patch it, start a runtime workspace and use the wizard in that.
you sure can somehow script it, but therefore you needs to look what the wizard does.
Previous Topic:On-the-fly declaration in cross-reference
Next Topic:Nested class and visibility of members
Goto Forum:
  


Current Time: Mon May 12 16:01:10 EDT 2025

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

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

Back to the top