Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Only a type can be imported.
Only a type can be imported. [message #990161] Tue, 11 December 2012 08:24 Go to next message
Matthias N is currently offline Matthias NFriend
Messages: 66
Registered: June 2012
Member
Hi,

when I generate my diagram code I get some strange errors:

the import declaration I get errors:
import eastadl21.EAST_ADL.Infrastructure;

Only a type can be imported. eastadl21.EAST_ADL.Infrastructure resolves to a package

Infrastructure is a Package in my Ecore.

And in the code the elements can not be resolved:

myFeaturesToSynchronize.add(Infrastructure.Elements.ElementsPackage.eINSTANCE.getEAPackage_Element());

Infrastructure cannot be resolved



So, I have to manually resolve the problems... that's not practical for me. Do I really have to change the generation templates to get the imports working?! Or is there a workaround?

Thanks
Re: Only a type can be imported. [message #990190 is a reply to message #990161] Tue, 11 December 2012 10:39 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Matthias,

You don't provide much information about your model, but please be sure
to respect Java naming conventions in your Ecore model. I.e., use Camel
case names and ensure that class names start with an upper case letter
and that package names start with a lower case letter. Be sure to avoid
ever having a package name and a class name be the same (which of course
can't ever happen if you follow the conventions).

On 11/12/2012 9:24 AM, Matthias N wrote:
> Hi,
>
> when I generate my diagram code I get some strange errors:
>
> the import declaration I get errors:
>
> import eastadl21.EAST_ADL.Infrastructure;
>
>
> Only a type can be imported. eastadl21.EAST_ADL.Infrastructure
> resolves to a package
>
> Infrastructure is a Package in my Ecore.
>
> And in the code the elements can not be resolved:
>
>
> myFeaturesToSynchronize.add(Infrastructure.Elements.ElementsPackage.eINSTANCE.getEAPackage_Element());
>
>
>
> Infrastructure cannot be resolved
>
>
>
> So, I have to manually resolve the problems... that's not practical
> for me. Do I really have to change the generation templates to get the
> imports working?! Or is there a workaround?
>
> Thanks


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Only a type can be imported. [message #990193 is a reply to message #990161] Tue, 11 December 2012 10:56 Go to previous message
Matthias N is currently offline Matthias NFriend
Messages: 66
Registered: June 2012
Member
Hi Ed, thanks for your answer.

I solved it by setting the Package's names in my Ecore to lowercase.

Thanks
Previous Topic:Use existing model implementation
Next Topic:"Diagram is not present" message when opening 2nd Editor
Goto Forum:
  


Current Time: Thu Apr 25 05:44:03 GMT 2024

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

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

Back to the top