Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » GENERATION PROBLEM
GENERATION PROBLEM [message #144747] Mon, 30 July 2007 14:50 Go to next message
Eclipse UserFriend
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 15:00 Go to previous messageGo to next message
Boris Blajer is currently offline Boris BlajerFriend
Messages: 217
Registered: July 2009
Senior Member
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 15:03 Go to previous messageGo to next message
Boris Blajer is currently offline Boris BlajerFriend
Messages: 217
Registered: July 2009
Senior Member
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 15:09 Go to previous message
Eclipse UserFriend
Originally posted by: prodanov.tk.informatik.tu-darmstadt.de

Thanks for the fast answer Boris!

Cheers

Martin
Previous Topic:Modify values diagram elements variables
Next Topic:Drag from a view, drop onto the diagram, and create a node
Goto Forum:
  


Current Time: Fri Oct 18 02:44:35 GMT 2024

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

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

Back to the top