GMF generated diagram code do not support namespace. [message #481840] |
Mon, 24 August 2009 14:09 |
Eclipse User |
|
|
|
Originally posted by: diogenes.wang.gmail.com
Hi,
I am using the latest Eclipse Modeling Tool EPP (Eclipse Modeling Tools,
Build id: 20090619-0625). The problem I came across is:
When I generated the diagram editor code by right-clicking the .gmfgen
file, then 'Generate diagram code', I got the source code that could not
compile. The errors were caused by wrong reference to model elements. here
is an example:
import oaf.model.perception.Stakeholders;
...
Stakeholders.Stakeholder newElement =
Stakeholders.StakeholdersFactory.eINSTANCE
.createStakeholder();
both lines are wrong, since the referenced classes Stakeholder and
StakeholderFactory are all in package oaf.model.perception.Stakeholders (I
had the Base Package set as "oaf.model.perception" in my .genmodel, Prefix
as "Stakeholders".)
therefore the generated code should be something like this:
oaf.model.perception.Stakeholders.Stakeholder newElement =
oaf.model.perception.Stakeholders.StakeholdersFactory.eINSTA NCE
.createStakeholder();
I can get arround this problem by remove the Base Package setting,
therefore it generate the following code:
Stakeholders.Stakeholder newElement =
stakeholders.StakeholdersFactory.eINSTANCE
.createStakeholder();
which are correct since the package name Stakeholders has no base prefix.
But this is ugly and cannot fit into my projects. Otherwise every time
when I generate the code, I had to manually correct them. It's really
pain. So I really need to find the proper solution.
I suspect this is a bug in code generation, where the Base Package
information in .genmodel is not used to prefix the referenced package name.
Can anyone suggest a quick fix? or direct me to the right place, I really
need to get it solved ASAP.
Thanks,
Derek
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02286 seconds