Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Applying stereotype programmatically fails
Applying stereotype programmatically fails [message #628051] Thu, 12 November 2009 17:38 Go to next message
Vikram Sjn is currently offline Vikram SjnFriend
Messages: 39
Registered: July 2009
Member
I am doing my first UML profile.

Following the article 'Introduction to UML2 Profiles', I tried everything manually. It all went fine, and the article was very useful.

Now when doing it programmatically, I am facing a problem when applying stereotype.

When the stereotype is applied, there is not exception, and everything seems to go fine - but on opening the .uml file in model editor, the stereotype is not there.

On close inspection I found that saving the model just before applying the stereotype, and after applying the stereotype resulted in no difference.

When I use this file (which has everything fine and in place, except the stereotype), and apply stereotype manually then on saving the content of .uml file change, and the entire uml:Model node becomes child of xmi:XMI node.

What am I missing?



uml file start when stereotype was applied, but did not have any effect...


<?xml version="1.0" encoding="UTF-8"?>
<uml:Model xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/3.0.0/UML" xmi:id="_w25RsM-UEd6ARaBEQDTKaA" name="WWCUSTS">
<ownedComment xmi:id="_w25Rsc-UEd6ARaBEQDTKaA">
<body>WWCUSTS Model Comment</body>
</ownedComment>
<packagedElement xmi:type="uml:Package" xmi:id="_w25Rss-UEd6ARaBEQDTKaA" name="Types">
...
...


uml file start when stereotype was applied manually, and resulted in changed xml structure...


<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/3.0.0/UML" xmlns:xanalysis="http:///schemas/xanalysis/_xm39IM-UEd6ARaBEQDTKaA/0" xsi:schemaLocation="http:///schemas/xanalysis/_xm39IM-UEd6ARaBEQDTKaA/0 file:/G:/vikram-admin/Documents/Adhoc/xanalysis.profile.uml# _yNeDEs-UEd6ARaBEQDTKaA ">
<uml:Model xmi:id="_w25RsM-UEd6ARaBEQDTKaA" name="WWCUSTS">
<ownedComment xmi:id="_w25Rsc-UEd6ARaBEQDTKaA">
<body>WWCUSTS Model Comment</body>
</ownedComment>
<packagedElement xmi:type="uml:Package" xmi:id="_w25Rss-UEd6ARaBEQDTKaA" name="Types">
...
...
Re: Applying stereotype programmatically fails [message #628052 is a reply to message #628051] Thu, 12 November 2009 18:20 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Vikram,

Set a breakpoint in StereotypeApplicationHelper.getContainmentList() and
double check that the proper resource is being used for the stereotype
application.
If everything seems fine there, I would suggest posting a small snippet of
code that demonstrates how you are applying the stereotype and saving the
file.

Cheers,
- James.

"Vikram" <vikram.sjn@gmail.com> wrote in message
news:hdhh68$ck0$1@build.eclipse.org...
>I am doing my first UML profile.
>
> Following the article 'Introduction to UML2 Profiles', I tried everything
> manually. It all went fine, and the article was very useful.
>
> Now when doing it programmatically, I am facing a problem when applying
> stereotype.
>
> When the stereotype is applied, there is not exception, and everything
> seems to go fine - but on opening the .uml file in model editor, the
> stereotype is not there.
>
> On close inspection I found that saving the model just before applying the
> stereotype, and after applying the stereotype resulted in no difference.
>
> When I use this file (which has everything fine and in place, except the
> stereotype), and apply stereotype manually then on saving the content of
> .uml file change, and the entire uml:Model node becomes child of xmi:XMI
> node.
>
> What am I missing?
>
>
>
> uml file start when stereotype was applied, but did not have any effect...
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <uml:Model xmi:version="2.1"
> xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
> xmlns:uml="http://www.eclipse.org/uml2/3.0.0/UML"
> xmi:id="_w25RsM-UEd6ARaBEQDTKaA" name="WWCUSTS">
> <ownedComment xmi:id="_w25Rsc-UEd6ARaBEQDTKaA">
> <body>WWCUSTS Model Comment</body>
> </ownedComment>
> <packagedElement xmi:type="uml:Package" xmi:id="_w25Rss-UEd6ARaBEQDTKaA"
> name="Types">
> ..
> ..
>
>
> uml file start when stereotype was applied manually, and resulted in
> changed xml structure...
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xmi:XMI xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
> xmlns:uml="http://www.eclipse.org/uml2/3.0.0/UML"
> xmlns:xanalysis="http:///schemas/xanalysis/_xm39IM-UEd6ARaBEQDTKaA/0"
> xsi:schemaLocation="http:///schemas/xanalysis/_xm39IM-UEd6ARaBEQDTKaA/0
> file:/G:/vikram-admin/Documents/Adhoc/xanalysis.profile.uml# _yNeDEs-UEd6ARaBEQDTKaA ">
> <uml:Model xmi:id="_w25RsM-UEd6ARaBEQDTKaA" name="WWCUSTS">
> <ownedComment xmi:id="_w25Rsc-UEd6ARaBEQDTKaA">
> <body>WWCUSTS Model Comment</body>
> </ownedComment>
> <packagedElement xmi:type="uml:Package"
> xmi:id="_w25Rss-UEd6ARaBEQDTKaA" name="Types">
> ..
> ..
>
Previous Topic:Applying stereotype programmatically fails
Next Topic:RSM 7.5 exports EMF UML2 XMI v3.x instead of v.2.x
Goto Forum:
  


Current Time: Fri Mar 29 00:48:43 GMT 2024

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

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

Back to the top