iterating over the URI Registry [message #418223] |
Sun, 06 April 2008 17:37 |
Eclipse User |
|
|
|
Originally posted by: comouraf-lixo.yahoo.fr
Hi,
I'd like to print the URIs of all registered metamodels. The following
snippet doesn't help much, cause it only prints the ecore URI (and the fake
"myURI" created in the code):
EPackage.Registry registry = EPackage.Registry.INSTANCE;
(2) EPackage pack = EcoreFactory.eINSTANCE.createEPackage();
(3) registry.put("http://myURI.com", pack);
for(String uri: registry.keySet()){
System.out.println(uri);
}
What should I do? Of course I didn't want to have all plugins loaded into
memory, just check their URIs. Another question: I can only see the Ecore
URI if I first register the fake URI ("myURI" ) . That is, if I remove lines
2 and 3 from the snippet above, I see nothing. Why is it?
Thanks
Cesar
|
|
|
Re: iterating over the URI Registry [message #418224 is a reply to message #418223] |
Sun, 06 April 2008 18:52 |
Ed Merks Messages: 33140 Registered: July 2009 |
Senior Member |
|
|
Cesar,
I'll have to assume you're running standalone, because otherwise all the
global package registered via the plugin.xml registrations for the
generated_package/dynamic_package extension points would appear. When
running standalone, a package will only register itself the first time
XyzPackage.eINSTANCE is accessed. So if you did
EcorePackage.eINSTANCE.eClass(), for example, you'd see the
EcorePackage's nsURI being registered and the same goes for any other
packages..
kaiserlautern wrote:
> Hi,
>
> I'd like to print the URIs of all registered metamodels. The following
> snippet doesn't help much, cause it only prints the ecore URI (and the
> fake "myURI" created in the code):
>
> EPackage.Registry registry = EPackage.Registry.INSTANCE;
> (2) EPackage pack = EcoreFactory.eINSTANCE.createEPackage();
> (3) registry.put("http://myURI.com", pack);
> for(String uri: registry.keySet()){
> System.out.println(uri);
> }
>
> What should I do? Of course I didn't want to have all plugins loaded
> into memory, just check their URIs. Another question: I can only see
> the Ecore URI if I first register the fake URI ("myURI" ) . That is,
> if I remove lines 2 and 3 from the snippet above, I see nothing. Why
> is it?
>
> Thanks
>
> Cesar
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.02760 seconds