| 
| GENERATION PROBLEM [message #144747] | Mon, 30 July 2007 10:50  |  | 
| Eclipse User  |  |  |  |  | Originally posted by: prodanov.tk.informatik.tu-darmstadt.de 
 Hello everyone,
 
 I have a problem wiht the generetion step. As usual I have my metamodel in
 ecore file and then I create my emf .genmodel and when I set a "base
 package" i.e. com.myproject.managers then GMF generates wrong imports. I
 give an example:
 "import com.myproject.managers.Metamodel.MetamodelCommons;" is generated
 and then when has to use some import it is generated:
 "return
 Metamodel.MetamodelCommons.MetamodelCommonsPackage.eINSTANCE .getMyElement(); "
 where  MetamodelCommons is a package in .ecore and in the EMF genmodel.
 the right import hast to be "import
 com.myproject.managers.Metamodel.MetamodelCommons.MetamodelC ommonsPackage; "
 because this is actually the interface to be used(from the generated EMF
 code)and then simply:
 return MetamodelCommonsPackage.eINSTANCE.getMyElement(); When I don't use
 the base Package, it generates the imports properly.
 Can somebody help me whit this. I'm suffering from this problem too much.
 And it is I think Bug in the GMF Jet generation.
 
 Thanks in advance!
 
 Martin
 |  |  |  | 
| 
| Re: GENERATION PROBLEM [message #144756 is a reply to message #144747] | Mon, 30 July 2007 11:00   |  | 
| Eclipse User  |  |  |  |  | Hi Martin, 
 If I understand your description correctly, the problem is that the
 import statement imports a package name, and not a class name. This is a
 known behavior of the GMF generator in some situations. Since there is
 no purely semantic way to distinguish between names of packages, classes
 and attributes, we employ a heuristics whereas if the name starts with a
 lowercase letter, it is assumed to stand for a package, if it is
 all-uppercase, it is considered an attribute (with several hardcoded
 exceptions, i.e. SWT, NLS and URI), otherwise it is a class/interface.
 Your package starts with an uppercase letter, thus failing this heuristics.
 
 I would recommend to change the name of your package to match these
 criteria, which do not seem too strict after all.
 
 Best regards,
 Boris
 
 
 Martin Prodanov wrote:
 > Hello everyone,
 >
 > I have a problem wiht the generetion step. As usual I have my metamodel
 > in ecore file and then I create my emf .genmodel and when I set a "base
 > package" i.e. com.myproject.managers then GMF generates wrong imports. I
 > give an example:
 > "import com.myproject.managers.Metamodel.MetamodelCommons;" is generated
 > and then when has to use some import it is generated:
 > "return
 >  Metamodel.MetamodelCommons.MetamodelCommonsPackage.eINSTANCE .getMyElement(); "
 > where  MetamodelCommons is a package in .ecore and in the EMF genmodel.
 > the right import hast to be "import
 >  com.myproject.managers.Metamodel.MetamodelCommons.MetamodelC ommonsPackage; "
 > because this is actually the interface to be used(from the generated EMF
 > code)and then simply: return
 > MetamodelCommonsPackage.eINSTANCE.getMyElement(); When I don't use the
 > base Package, it generates the imports properly.
 > Can somebody help me whit this. I'm suffering from this problem too
 > much. And it is I think Bug in the GMF Jet generation.
 >
 > Thanks in advance!
 >
 > Martin
 >
 |  |  |  | 
| 
| Errata [message #144765 is a reply to message #144756] | Mon, 30 July 2007 11:03   |  | 
| Eclipse User  |  |  |  |  | Hi Martin, 
 In my previous post, the word semantic was used where syntactic was meant.
 
 Best regards,
 Boris
 
 
 Boris Blajer wrote:
 > Hi Martin,
 >
 > If I understand your description correctly, the problem is that the
 > import statement imports a package name, and not a class name. This is a
 > known behavior of the GMF generator in some situations. Since there is
 > no purely semantic way to distinguish between names of packages, classes
 > and attributes, we employ a heuristics whereas if the name starts with a
 > lowercase letter, it is assumed to stand for a package, if it is
 > all-uppercase, it is considered an attribute (with several hardcoded
 > exceptions, i.e. SWT, NLS and URI), otherwise it is a class/interface.
 > Your package starts with an uppercase letter, thus failing this heuristics.
 >
 > I would recommend to change the name of your package to match these
 > criteria, which do not seem too strict after all.
 >
 > Best regards,
 > Boris
 >
 >
 > Martin Prodanov wrote:
 >> Hello everyone,
 >>
 >> I have a problem wiht the generetion step. As usual I have my
 >> metamodel in ecore file and then I create my emf .genmodel and when I
 >> set a "base package" i.e. com.myproject.managers then GMF generates
 >> wrong imports. I give an example:
 >> "import com.myproject.managers.Metamodel.MetamodelCommons;" is
 >> generated and then when has to use some import it is generated:
 >> "return
 >>  Metamodel.MetamodelCommons.MetamodelCommonsPackage.eINSTANCE .getMyElement(); "
 >> where  MetamodelCommons is a package in .ecore and in the EMF
 >> genmodel. the right import hast to be "import
 >>  com.myproject.managers.Metamodel.MetamodelCommons.MetamodelC ommonsPackage; "
 >> because this is actually the interface to be used(from the generated
 >> EMF code)and then simply: return
 >> MetamodelCommonsPackage.eINSTANCE.getMyElement(); When I don't use the
 >> base Package, it generates the imports properly.
 >> Can somebody help me whit this. I'm suffering from this problem too
 >> much. And it is I think Bug in the GMF Jet generation.
 >>
 >> Thanks in advance!
 >>
 >> Martin
 >>
 |  |  |  | 
| 
| Re: Errata [message #144774 is a reply to message #144765] | Mon, 30 July 2007 11:09  |  | 
| Eclipse User  |  |  |  |  | Originally posted by: prodanov.tk.informatik.tu-darmstadt.de 
 Thanks for the fast answer Boris!
 
 Cheers
 
 Martin
 |  |  |  | 
Powered by 
FUDForum. Page generated in 0.04036 seconds