Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » How to add a stereotype to an element in an UML diagram(How to add a stereotype to an action in an activity diagram)
How to add a stereotype to an element in an UML diagram [message #685399] Fri, 17 June 2011 12:55 Go to next message
PSZ  is currently offline PSZ Friend
Messages: 2
Registered: June 2011
Junior Member
Dear all,
how do I add a stereotype to a class or an action in an UML diagram.
I select a diagram element, click "Profile" tab then click the "Plus" button and can see the list "Applicable stereotypes" - but it is always empty and it seems like there is no way to add an element to this list. Is it possible somehow to add values to this list so I could use them with my classes or actions?

Best regards,
PSZ

P.S.
I've spent few hours searching an answer this this naive question but could not find it in forums nor documentations. Other UML tools like OMONDO allow simply to type stereotype in an appropiate field.

Re: How to add a stereotype to an element in an UML diagram [message #685408 is a reply to message #685399] Fri, 17 June 2011 13:14 Go to previous messageGo to next message
Yann Tanguy is currently offline Yann TanguyFriend
Messages: 80
Registered: July 2009
Member
In UML, stereotypes are declared in profiles.

In your model, you have to "apply" a profile before you can use ("apply stereotype") the stereotypes it contains.

To do that:
- select a package (say the root of your model) in the model explorer
- open the profile tab in the property view
- in the profile application area use the buttons on the right to select and apply the profile you want (some profile are pre-registered in papyrus and can be applied with the third button "Apply registered profile")

- Once this is done you should be able to apply stereotype on your UML elements (doing the same action you previously tried).


To make a trial :
- try to apply the registered profile "Standard" (the Standard UML2 profile is described in UML Specification document)
- create a Class and try to apply a stereotype, the list of "Applicable stereotypes" is no longer empty as some Stereotypes defined in Standard profile are applicable on Class (ex. Focus, Auxiliary, Metaclass...).


----------------

Creating your own Profile:

1. Create a Profile
2. Save / Define / Close the profile
3. Use your profile (described above)

To create a profile:
- use Papyrus wizard (File / New / Papyrus / Papyrus Model), and select "Profile" on the second page.
- create a profile diagram
- add the metaclass you want your stereotype to relates to using "Import Metaclass" button in the palette (ex. Select "Class" and your stereotype will be applicable on any "Class" element)
- create a new "Stereotype" with your desired name
- create an "Extension" link going from your stereotype to the meta class

You can now save the profile but you'll not be able to use it unless it is "defined", so make sure you answer "yes" when Papyrus ask if you want to define the profile during save.

Always close the profile before using it.

In case you make some changes in the profile, you'll have to re-define it and to re-apply it in your models.

[Updated on: Fri, 17 June 2011 13:32]

Report message to a moderator

Re: How to add a stereotype to an element in an UML diagram [message #685417 is a reply to message #685408] Fri, 17 June 2011 13:25 Go to previous messageGo to next message
PSZ  is currently offline PSZ Friend
Messages: 2
Registered: June 2011
Junior Member
Thanks a lot for your help!
I created a profile with a Stereotype, Import MetaClass and an Extension between them. Next I followed your instructions and it works Smile
Best wishes,
PSZ
Re: How to add a stereotype to an element in an UML diagram [message #685922 is a reply to message #685417] Mon, 20 June 2011 18:53 Go to previous messageGo to next message
Steve Blackwell is currently offline Steve BlackwellFriend
Messages: 30
Registered: May 2011
Member
Yann,

(Sorry but this ended up being quite long and detailed)

I, too, have been struggling with applying stereotypes and I tried to follow your example above but without success.

Here's what I'm trying to do. I created a deployment diagram with some devices in it. I want to make one of them look like a truck instead of the normal box. I am assuming that this is possible as I have seen examples even though they were not from Papyrus.

I created a profile, added an imported metaclass, and set it to Device so now I have a box with <<metaclass>> on one line and Device on the next line in the box.
Next I added a Stereotype and named it Truck. With the stereotype selected, I clicked on the UML tab in the Properties view, clicked on the green '+' "Add elements" icon next to the icon box which then popped up the "Create a new Element" dialog and I selected the UML tab there. From the Kind dropdown menu I selected Shape and then clicked on the green '+' "Content" icon and selected my graphic. When I clicked OK, image0 is now displayed in the icon box in the Properties view.

Next I selected the Extension link and drew a line between the stereotype and the metaclass with the arrow at the metaclass end.

I saved the profile and answered "Yes" when asked if I wanted to define the profile. Finally, I closed the profile.

Now back in my deployment diagram, I clicked on the background to deselect everything, and clicked on the Profile tab in the Properties view which displays 3 boxes; ProfileApplication, Applied Stereotypes and Property Values all of which are empty.

I clicked on the green '+' Apply Profile button next to the ProfileApplication box, selected my saved profile, clicked OK and then checked the checkbox next to profile. 'profile' is now displayed in the ProfileApplication box.

Now in my deployment diagram, I select the device I want to apply the stereotype to which causes the ProfileApplication box to disappear from the Properties view Profie tab. I clicked the green '+' "Add a new Element" button next to the Applied Stereotypes box in the Profile tab, selected my Truck stereotype and pushed it over to the Applied Sterotypes side and clicked OK. This caused "Truck (from profile)" stereotype to be displayed in the Applied Stereotypes box and the Property Values box to disappear from the Property View Profile tab.

However it did not make the jpg I selected for the stereotype display.

Did I miss a step or do something wrong?

Steve
Re: How to add a stereotype to an element in an UML diagram [message #685990 is a reply to message #685922] Tue, 21 June 2011 09:50 Go to previous messageGo to next message
Yann Tanguy is currently offline Yann TanguyFriend
Messages: 80
Registered: July 2009
Member
I did not manage to make this work in Deployment diagram.

Normally, when selecting a stereotyped element, the "Appearance" tab of the "Property View" let you choose how you want the stereotype to be shown (nothing, text, icon, shape...).

Anyway thanks for reporting the problem, I have filled the following bugzilla entries related to this:

349920: [Deployment Diagram] Stereotype representation is not supported in this diagram
https://bugs.eclipse.org/bugs/show_bug.cgi?id=349920
Re: How to add a stereotype to an element in an UML diagram [message #686030 is a reply to message #685990] Tue, 21 June 2011 12:52 Go to previous message
Steve Blackwell is currently offline Steve BlackwellFriend
Messages: 30
Registered: May 2011
Member
OK, Thanks. I voted for that bug.
Previous Topic:When next relases of papyrus?
Next Topic:How to get a diagram programmatically?
Goto Forum:
  


Current Time: Wed Apr 24 14:30:00 GMT 2024

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

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

Back to the top