Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » basic question: how to load a uml model?
basic question: how to load a uml model? [message #473203] Fri, 15 June 2007 01:56 Go to next message
Leila Naslavsky is currently offline Leila NaslavskyFriend
Messages: 13
Registered: July 2009
Junior Member
Hi All,
I'm trying to load a uml file programmatically, running a standalone Java
application.
I'm running Eclipse SDK 3.3.0 build I20070601-1539
I'm using the example in the "UML2Article" (I call
registerResourceFactories(), and registerPathmaps(URI uri), and load(URI
uri)).

My uml model has only one 'Model' and one 'Class'.
The resources are loaded, because when I call resource.getAllContents()
and print it, I get:


org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@a3aa2c (eClass:
org.eclipse.emf.ecore.impl.EClassImpl@f95165 (name: Model)
(instanceClassName: null) (abstract: false, interface: false)) (mixed:
[ecore.xml.type:text=
, packagedElement=org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@ed1dbe
(eClass: org.eclipse.emf.ecore.impl.EClassImpl@3bc1a1 (name: Class)
(instanceClassName: null) (abstract: false, interface: false)) (mixed: [],
anyAttribute: [name=Minha Classe]), ecore.xml.type:text=
], anyAttribute: [name=Meu Modelo])



but when I call

package_ = (org.eclipse.uml2.uml.Package)
EcoreUtil.getObjectByType(resource.getContents(),UMLPackage. Literals.PACKAGE);

The package_ is null.

I understand the resources are not UML (type) resources. But I don't know
how to fix this.
I've seen the posts in this newsgroup, and (apparently) I'm doing what I
should...
Could anyone help me with this?

Thanks,

- Leila
Re: basic question: how to load a uml model? [message #473205 is a reply to message #473203] Fri, 15 June 2007 13:55 Go to previous messageGo to next message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Leila,

By the "UML2Article" ... I assume you mean the migration guide?

Having AnyTypes left over would lead me to suspect there is some
unrecognized content in your original model. Are you migrating an older
model? How did you create your model? With the UML editor or some other
tool? Does your model have a package at the root.

I would suggest...

1. Try getting the latest RC3 build ( this should be the final build of
UML ). Verify you have all the correct depencies.
2. Follow the instructions in the migration guide to create stand alone
application ( you probably have done this already ).
3. Try to open your model with the UML editor, does it open? are there
errors?
4. Try to open your model programmatically.
5. If that still doesn't work, post your model and I can take a look at it.


Cheers,

- James.


"Leila" <lnaslavsky@hotmail.com> wrote in message
news:16885e849e2549a5604d49f755529c50$1@www.eclipse.org...
> Hi All,
> I'm trying to load a uml file programmatically, running a standalone Java
> application.
> I'm running Eclipse SDK 3.3.0 build I20070601-1539
> I'm using the example in the "UML2Article" (I call
> registerResourceFactories(), and registerPathmaps(URI uri), and load(URI
> uri)).
>
> My uml model has only one 'Model' and one 'Class'.
> The resources are loaded, because when I call resource.getAllContents()
> and print it, I get:
>
>
> org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@a3aa2c (eClass:
> org.eclipse.emf.ecore.impl.EClassImpl@f95165 (name: Model)
> (instanceClassName: null) (abstract: false, interface: false)) (mixed:
> [ecore.xml.type:text=
> , packagedElement=org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@ed1dbe
> (eClass: org.eclipse.emf.ecore.impl.EClassImpl@3bc1a1 (name: Class)
> (instanceClassName: null) (abstract: false, interface: false)) (mixed: [],
> anyAttribute: [name=Minha Classe]), ecore.xml.type:text=
> ], anyAttribute: [name=Meu Modelo])
>
>
>
> but when I call
>
> package_ = (org.eclipse.uml2.uml.Package)
>
EcoreUtil.getObjectByType(resource.getContents(),UMLPackage. Literals.PACKAGE
);
>
> The package_ is null.
>
> I understand the resources are not UML (type) resources. But I don't know
> how to fix this.
> I've seen the posts in this newsgroup, and (apparently) I'm doing what I
> should...
> Could anyone help me with this?
>
> Thanks,
>
> - Leila
>
>
>
Re: basic question: how to load a uml model? [message #473207 is a reply to message #473205] Fri, 15 June 2007 15:56 Go to previous messageGo to next message
Leila Naslavsky is currently offline Leila NaslavskyFriend
Messages: 13
Registered: July 2009
Junior Member
Hi James,
Yes, thats the migration article.
I created the model with the editor, so I'm not trying to migrate (just
using that example because it is an example :). It opens with the editor
and it has a package in the root.
I realized I wasn't registering the package
(RESOURCE_SET.getPackageRegistry().put(UMLPackage.eNS_URI,
UMLPackage.eINSTANCE)) , however, since this line of code is nowhere in
the example, I thought I wouldn't need it.
(My Bad, sorry!).

Now it loads the model programmatically, but I still don't fully
understand how the example works without registering the package and my
code didn't.

Thanks again!

- Leila
Re: basic question: how to load a uml model? [message #473209 is a reply to message #473207] Fri, 15 June 2007 17:03 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Leila,

That code does appear in the article ...have a look at the function
registerPackages(...) ... the very last line by "tag 2".
Can you find it? You should be able to cut and paste verbatim from that
aricle. If there is still an issue, please let me know.

Cheers,

- James.


"Leila" <lnaslavsky@hotmail.com> wrote in message
news:c19feba9988a0a0a75d6b2643ea31456$1@www.eclipse.org...
> Hi James,
> Yes, thats the migration article.
> I created the model with the editor, so I'm not trying to migrate (just
> using that example because it is an example :). It opens with the editor
> and it has a package in the root.
> I realized I wasn't registering the package
> (RESOURCE_SET.getPackageRegistry().put(UMLPackage.eNS_URI,
> UMLPackage.eINSTANCE)) , however, since this line of code is nowhere in
> the example, I thought I wouldn't need it.
> (My Bad, sorry!).
>
> Now it loads the model programmatically, but I still don't fully
> understand how the example works without registering the package and my
> code didn't.
>
> Thanks again!
>
> - Leila
>
Re: basic question: how to load a uml model? [message #621683 is a reply to message #473203] Fri, 15 June 2007 13:55 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Leila,

By the "UML2Article" ... I assume you mean the migration guide?

Having AnyTypes left over would lead me to suspect there is some
unrecognized content in your original model. Are you migrating an older
model? How did you create your model? With the UML editor or some other
tool? Does your model have a package at the root.

I would suggest...

1. Try getting the latest RC3 build ( this should be the final build of
UML ). Verify you have all the correct depencies.
2. Follow the instructions in the migration guide to create stand alone
application ( you probably have done this already ).
3. Try to open your model with the UML editor, does it open? are there
errors?
4. Try to open your model programmatically.
5. If that still doesn't work, post your model and I can take a look at it.


Cheers,

- James.


"Leila" <lnaslavsky@hotmail.com> wrote in message
news:16885e849e2549a5604d49f755529c50$1@www.eclipse.org...
> Hi All,
> I'm trying to load a uml file programmatically, running a standalone Java
> application.
> I'm running Eclipse SDK 3.3.0 build I20070601-1539
> I'm using the example in the "UML2Article" (I call
> registerResourceFactories(), and registerPathmaps(URI uri), and load(URI
> uri)).
>
> My uml model has only one 'Model' and one 'Class'.
> The resources are loaded, because when I call resource.getAllContents()
> and print it, I get:
>
>
> org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@a3aa2c (eClass:
> org.eclipse.emf.ecore.impl.EClassImpl@f95165 (name: Model)
> (instanceClassName: null) (abstract: false, interface: false)) (mixed:
> [ecore.xml.type:text=
> , packagedElement=org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@ed1dbe
> (eClass: org.eclipse.emf.ecore.impl.EClassImpl@3bc1a1 (name: Class)
> (instanceClassName: null) (abstract: false, interface: false)) (mixed: [],
> anyAttribute: [name=Minha Classe]), ecore.xml.type:text=
> ], anyAttribute: [name=Meu Modelo])
>
>
>
> but when I call
>
> package_ = (org.eclipse.uml2.uml.Package)
>
EcoreUtil.getObjectByType(resource.getContents(),UMLPackage. Literals.PACKAGE
);
>
> The package_ is null.
>
> I understand the resources are not UML (type) resources. But I don't know
> how to fix this.
> I've seen the posts in this newsgroup, and (apparently) I'm doing what I
> should...
> Could anyone help me with this?
>
> Thanks,
>
> - Leila
>
>
>
Re: basic question: how to load a uml model? [message #621685 is a reply to message #473205] Fri, 15 June 2007 15:56 Go to previous message
Leila Naslavsky is currently offline Leila NaslavskyFriend
Messages: 13
Registered: July 2009
Junior Member
Hi James,
Yes, thats the migration article.
I created the model with the editor, so I'm not trying to migrate (just
using that example because it is an example :). It opens with the editor
and it has a package in the root.
I realized I wasn't registering the package
(RESOURCE_SET.getPackageRegistry().put(UMLPackage.eNS_URI,
UMLPackage.eINSTANCE)) , however, since this line of code is nowhere in
the example, I thought I wouldn't need it.
(My Bad, sorry!).

Now it loads the model programmatically, but I still don't fully
understand how the example works without registering the package and my
code didn't.

Thanks again!

- Leila
Re: basic question: how to load a uml model? [message #621690 is a reply to message #473207] Fri, 15 June 2007 17:03 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Leila,

That code does appear in the article ...have a look at the function
registerPackages(...) ... the very last line by "tag 2".
Can you find it? You should be able to cut and paste verbatim from that
aricle. If there is still an issue, please let me know.

Cheers,

- James.


"Leila" <lnaslavsky@hotmail.com> wrote in message
news:c19feba9988a0a0a75d6b2643ea31456$1@www.eclipse.org...
> Hi James,
> Yes, thats the migration article.
> I created the model with the editor, so I'm not trying to migrate (just
> using that example because it is an example :). It opens with the editor
> and it has a package in the root.
> I realized I wasn't registering the package
> (RESOURCE_SET.getPackageRegistry().put(UMLPackage.eNS_URI,
> UMLPackage.eINSTANCE)) , however, since this line of code is nowhere in
> the example, I thought I wouldn't need it.
> (My Bad, sorry!).
>
> Now it loads the model programmatically, but I still don't fully
> understand how the example works without registering the package and my
> code didn't.
>
> Thanks again!
>
> - Leila
>
Previous Topic:How to get compatible Eclipse and EMF?
Next Topic:Bug in UML2Util resource bundle cache?
Goto Forum:
  


Current Time: Fri Mar 29 13:15:45 GMT 2024

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

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

Back to the top