Skip to main content



      Home
Home » Modeling » EMF » Delcare imports when generating operation body [SOLVED]
Delcare imports when generating operation body [SOLVED] [message #1765697] Tue, 13 June 2017 09:37 Go to next message
Eclipse UserFriend
Hello,

I'm trying to set some java code into a declared operation in an class.
I did create an annotation with source "http://www.eclipse.org/emf/2002/GenModel" and key "body" and added my code as value. When the code gets generated I'm missing some imports that I need in the operation body code. Is there anotder key where I can definde the missing imports?

Is there any other way to import the referenced classes or do I have to use the ugly FQNs?

[Updated on: Wed, 14 June 2017 04:06] by Moderator

Re: Delcare imports when generating operation body [message #1765701 is a reply to message #1765697] Tue, 13 June 2017 10:00 Go to previous messageGo to next message
Eclipse UserFriend
Body annotations are processed by org.eclipse.emf.codegen.ecore.genmodel.impl.GenBaseImpl.indentAndImport(String, String) and it looks for "<%" and "%> brackets. So you can specify for example <%a.b.C%> and if there is so import conflict for "C", you'll end with an import and the sort name in the body. Also, you can use <%java.util.Map$Entry%> so that java.util.Map will be imported and Map.Entry will be the short name used.
Re: Delcare imports when generating operation body [message #1765702 is a reply to message #1765701] Tue, 13 June 2017 10:10 Go to previous message
Eclipse UserFriend
Thanks! It works :)
Previous Topic:org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.getEObjectToIDMap() as WeakHashMap
Next Topic:Finding references in EMF generated Editor
Goto Forum:
  


Current Time: Thu Jul 03 05:33:52 EDT 2025

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

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

Back to the top