Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Delcare imports when generating operation body [SOLVED]
Delcare imports when generating operation body [SOLVED] [message #1765697] Tue, 13 June 2017 13:37 Go to next message
Veselin Markov is currently offline Veselin MarkovFriend
Messages: 15
Registered: February 2012
Junior Member
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 08:06]

Report message to a moderator

Re: Delcare imports when generating operation body [message #1765701 is a reply to message #1765697] Tue, 13 June 2017 14:00 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 29590
Registered: July 2009
Senior Member
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 14:10 Go to previous message
Veselin Markov is currently offline Veselin MarkovFriend
Messages: 15
Registered: February 2012
Junior Member
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: Wed Oct 17 04:48:44 GMT 2018

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

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

Back to the top