Re: [xtext] "EPackage is used twice" or How to import several packages of the same ecore m [message #537034] |
Tue, 01 June 2010 02:24  |
Eclipse User |
|
|
|
(replying to eclipse.modeling.tmf, which is where Xtext is discussed)
Frank Kuehnlenz schrieb:
> Hi,
>
> My existing ecore model has several packages:
> - root_package
> -- package_A
> -- package_B
> -- package_C
>
> and within package A classes from package B and C are referenced.
>
> Now I used the project creation wizard "Xtext Project From Existing
> Ecore Models" with the root_package as default package.
If you can split them up, i.e. one file per EPackage, I strongly suggest
to do so. Nested packages tend to complicate things.
>
> The generated xtext file contains now three imports:
>
> import "platform:/resource/testProject/test.ecore" as package_A
> import "platform:/resource/testProject/test.ecore" as package_B
> import "platform:/resource/testProject/test.ecore" as package_C
That's a bug in the wizard (please file a bug report).
You need to add the fragment part to the URIs. They should looke like
this:
platform:/resource/testProject/test.ecore#//package_A
Sven
--
Need professional support for Xtext and EMF?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de
|
|
|
|
|
|
|
|
|
|
|
Re: [xtext] "EPackage is used twice" or How to import several packages of the same ecore m [message #538358 is a reply to message #537592] |
Mon, 07 June 2010 09:02  |
Eclipse User |
|
|
|
Originally posted by: kuehnlenz.informatik.hu-berlin.de
Am 03.06.2010 06:30, schrieb Sven Efftinge:
> It is very untypical to use nsURIs to reference other EPackages.
> You might be able to colve this by registering all (sub)packages using
> the StandaloneSetup class.
It's just generated stuff out of the MagicDraw export.
I tried to register the EPackage classes manually using this way (maybe
wrong) without a positive effect:
public class TextEditorStandaloneSetup extends
TextEditorStandaloneSetupGenerated{
public static void doSetup() {
new TextEditorStandaloneSetup().createInjectorAndDoEMFRegistrati on();
EPackage.Registry.INSTANCE.put("http:///root_package/package_A.ecore#//package_A/",
root_package.package_A.Package_APackage.eINSTANCE);
EPackage.Registry.INSTANCE.put("http:///root_package/package_B.ecore#//package_B/",
root_package.package_B.Package_BPackage.eINSTANCE);
EPackage.Registry.INSTANCE.put("http:///root_package/package_C.ecore#//package_C/",
root_package.package_C.Package_CPackage.eINSTANCE);
}
However, if I do not use any subpackages in my ecore-model and therefore
have a flat hierarchy, than it's working fine.
All the best,
Frank
> Frank Kuehnlenz schrieb:
>> Am 02.06.2010 08:16, schrieb Sven Efftinge:
>>> Frank Kuehnlenz schrieb:
>>>> Addition and correction:
>>>>> But using the editor causes now the following error:
>>>>>
>>>>> An internal error occurred during: "XtextReconcilerJob".
>>>>> java.lang.IllegalStateException: Unresolved proxy
>>>>> http:///root_package/package_B.ecore#//package_A/SomeClassIn A Make
>>>>> sure
>>>>> the EPackage has been registered.
>>>> Having a closer look: There is something more strange, because the URI
>>>> contains different package names.
>>>> There is a use-relation between the classes in the packages: package_A
>>>> uses package_B.
>>>>
>>>> Caused by: java.lang.IllegalStateException: Unresolved proxy
>>>> http:///root_package/package_B.ecore#//package_A/SomeClassIn A Make
>>>> sure
>>>> the EPackage has been registered.
>>> The cross references between the Ecore packages shouldn't be done using
>>> nsURIs but platform:/resource uris. How did you create the ecore model?
>> I create my ecore-model out of an UML source (exported by MagicDraw) by
>> using the UML2 Extender SDK that integrates into the EMF Project
>> creation wizard.
>> (The ecore model is also used for CDO and has maybe some additional
>> properties)
>>
>> Cheers,
>> Frank
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.08113 seconds