Getting nsuri in Eclipse

353 Views Asked by At

I have Tree.ecore as source Metamodel. I need to write something like this:

model Tree driver EMF {nsuri="http://www.eclipse.org/emf/2002/Tree"};

How can I get exact nsuri of my registered ecore in eclipse?

2

There are 2 best solutions below

0
Dimitris Kolovos On BEST ANSWER

If you are using @namespace(uri="Tree", prefix="Tree") in your Emfatic metamodel, then the nsuri you're looking for is Tree (nsuri stands for "namespace URI")

4
Mad Matts On

I suppose you have generated the model code for your Tree.ecore Then you get the nsuri and all other elements (like all EAttributes, EReferences etc) via the generated static Package class. In your case it is probably called TreePackage.

So you get the nsuri like this:

TreePackage.eNS_URI or TreePackage.eINSTANCE.getNsURI()

Update:

If you only have the *.ecore file and want to know the uri, open the file with a text editor and look in the <ecore:EPackage tag at the beginning of the file. There you see the attribut nsURI