Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Convert AnyTypeImpl to UML elements
Convert AnyTypeImpl to UML elements [message #478065] Mon, 15 December 2008 07:01 Go to next message
David BY Chan is currently offline David BY ChanFriend
Messages: 40
Registered: July 2009
Member
I loaded an UML model file(e.g. House.uml) into memory using standalone
manner.

ResourceSet rs = new ResourceSetImpl();

rs.getResourceFactoryRegistry().getExtensionToFactoryMap().p ut(UMLResource.FILE_EXTENSION,new
UMLResourceFactoryImpl());
URI uml_model_path = URI.createFileURI("model/House.uml");
UMLResource res = (UMLResource) rs.getResource(uml_model_path,true);
TreeIterator<EObject> iter = res.getAllContents();
while (iter.hasNext())
{
EObject obj = iter.next();
System.out.println(obj.getClass().getName());
}

but the output indicated that all types are
org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl, how can I convert them
to UML model elements, such as Package, Class, Property, Operation etc..

Thanks a lot!
Re: Convert AnyTypeImpl to UML elements [message #478066 is a reply to message #478065] Mon, 15 December 2008 10:39 Go to previous message
David BY Chan is currently offline David BY ChanFriend
Messages: 40
Registered: July 2009
Member
David BY Chan wrote:
> I loaded an UML model file(e.g. House.uml) into memory using standalone
> manner.
>
> ResourceSet rs = new ResourceSetImpl();
>
> rs.getResourceFactoryRegistry().getExtensionToFactoryMap().p ut(UMLResource.FILE_EXTENSION,new
> UMLResourceFactoryImpl());
> URI uml_model_path = URI.createFileURI("model/House.uml");
> UMLResource res = (UMLResource)
> rs.getResource(uml_model_path,true);
> TreeIterator<EObject> iter = res.getAllContents();
> while (iter.hasNext())
> {
> EObject obj = iter.next();
> System.out.println(obj.getClass().getName());
> }
>
> but the output indicated that all types are
> org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl, how can I convert them
> to UML model elements, such as Package, Class, Property, Operation etc..
>
> Thanks a lot!
I fixed it because forgetting to register package.

rs.getPackageRegistry().put(UMLPackage.eNsurl, UMLPackage.eInstance)
Re: Convert AnyTypeImpl to UML elements [message #627283 is a reply to message #478065] Mon, 15 December 2008 10:39 Go to previous message
David BY Chan is currently offline David BY ChanFriend
Messages: 40
Registered: July 2009
Member
David BY Chan wrote:
> I loaded an UML model file(e.g. House.uml) into memory using standalone
> manner.
>
> ResourceSet rs = new ResourceSetImpl();
>
> rs.getResourceFactoryRegistry().getExtensionToFactoryMap().p ut(UMLResource.FILE_EXTENSION,new
> UMLResourceFactoryImpl());
> URI uml_model_path = URI.createFileURI("model/House.uml");
> UMLResource res = (UMLResource)
> rs.getResource(uml_model_path,true);
> TreeIterator<EObject> iter = res.getAllContents();
> while (iter.hasNext())
> {
> EObject obj = iter.next();
> System.out.println(obj.getClass().getName());
> }
>
> but the output indicated that all types are
> org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl, how can I convert them
> to UML model elements, such as Package, Class, Property, Operation etc..
>
> Thanks a lot!
I fixed it because forgetting to register package.

rs.getPackageRegistry().put(UMLPackage.eNsurl, UMLPackage.eInstance)
Previous Topic:Convert AnyTypeImpl to UML elements
Next Topic:UML generate with CDO support
Goto Forum:
  


Current Time: Tue Mar 31 00:19:50 GMT 2020

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

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

Back to the top