Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Ecore to Emfatic conversion standalone application(Questions regarding standalone application of Ecore to Emfatic conversion)
Ecore to Emfatic conversion standalone application [message #1778967] Tue, 26 December 2017 21:48 Go to next message
Eclipse UserFriend
Dear Eclipse Community,

My team and I are currently working on a simple standalone application that converts all Ecore files (.ecore) in a folder to Emfatic source files (.emf) (https://www.eclipse.org/emfatic/). The conversion is already possible with tools such as Epsilon (https://www.eclipse.org/epsilon/) where you can right-click on an Ecore file and select "Generate Emfatic Source" to generate the Emfatic source files. This conversion is exactly what we want but we would like this to be programmable and not via the Eclipse IDE GUI. The Emfatic documentation does not contain any information about this and we do not have any experience working with the Eclipse framework.

We have attempted to implement this by using the Emfatic source code (http://git.eclipse.org/c/emfatic/org.eclipse.emfatic.git/). This includes the code for the conversion, but it appears to only be executable via the pop-up menu within Eclipse as described above. We hope to use this code but to apply it outside of the Eclipse IDE.

Most of the relevant code can be found in
http://git.eclipse.org/c/emfatic/org.eclipse.emfatic.git/tree/plugins/org.eclipse.emf.emfatic.core/src/org/eclipse/emf/emfatic/core/generator/emfatic/EmfaticGenerator.java
http://git.eclipse.org/c/emfatic/org.eclipse.emfatic.git/tree/plugins/org.eclipse.emf.emfatic.core/src/org/eclipse/emf/emfatic/core/generator/emfatic/Writer.java

We do not think that we can make use of the IFile class as it does not appear to be applicable for our solution. We are not sure about this but we tried to make use of the java.io.File class instead. Aside from that, we do not make use of the IProgressMonitor class.

Most of this works except the ecoreResource field does not have any data in its contents even though we can read the data from the file. It throws an exception as it requires data in the ecoreResource field. We do not quite know how the Resource and ResourceSet classes work, and we suspect it might not work as intented because we do not use the IFile class.

We decided to ask about this on the forums before we continue. Perhaps there is an easier solution to this and we would like to hear your thoughts on this. Thank you very much.


Kind regards,

James
Re: Ecore to Emfatic conversion standalone application [message #1779097 is a reply to message #1778967] Tue, 02 January 2018 18:26 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

For interest, what is you use case for Emfatic?

If you use OCLinEcore you get a much better serialization of any embedded OCL and arguably a better serialization of Ecore. You do not have to use stop using *.ecore files although you can use *.oclinecore if you prefer.

Whatever. If you have a UI functionality that you want to re-use programmatcally, use the Plugin Spy Alt-Shift-F1 or Plugin Menu Spy Alt-Shift-F2 to locate the code that you need to copy / call / search for similar code to.

Regards

Ed Willink

Re: Ecore to Emfatic conversion standalone application [message #1779131 is a reply to message #1779097] Wed, 03 January 2018 06:08 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Yes, you can see by the commit history in http://git.eclipse.org/c/emfatic/org.eclipse.emfatic.git/ that EMFatic is certainly not the most active project. Certainly OCLInEcore and Xcore are more actively being developed and supported.

In any case, the underlying EMF framework uses URIs to access all underlying storage. So anywhere an IFile is used, it will be converted to a platform:/resource/<workspace-relative-path> which ensures that under the covers the IFile APIs will actually be used to get the bytes. But you could equally well use a file:/ URI or even an http:// URI to access the storage.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Ecore to Emfatic conversion standalone application [message #1819061 is a reply to message #1778967] Mon, 06 January 2020 23:01 Go to previous messageGo to next message
Clever Alves is currently offline Clever AlvesFriend
Messages: 101
Registered: August 2019
Senior Member
Hi!

Quote:
The conversion is already possible with tools such as Epsilon (https://www.eclipse.org/epsilon/) where you can right-click on an Ecore file and select "Generate Emfatic Source" to generate the Emfatic source files


Could you please tell me whether it is also possible to convert an Emfatic source file into an Ecore file?

Thank you for your attention.

Regards,

Clever.
Re: Ecore to Emfatic conversion standalone application [message #1824435 is a reply to message #1819061] Wed, 15 April 2020 08:54 Go to previous message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Hi Clever,

Please see [1] for an example of achieving this.

Thanks,
Dimitris

[1] https://git.eclipse.org/c/epsilon/org.eclipse.epsilon.git/tree/plugins/org.eclipse.epsilon.eugenia/src/org/eclipse/epsilon/eugenia/Emfatic2EcoreDelegate.java
Previous Topic:EMF Forms drop-down
Next Topic:EMF + Multiple inheritance with Interfaces
Goto Forum:
  


Current Time: Fri Mar 29 01:03:09 GMT 2024

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

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

Back to the top