Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your profile (name, country/region, and company) is displayed to the public and will accompany any content you post. You may update your IBM account at any time.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

How to customize your profile tooling model to support association classes

Michelle Crane (craneml@ca.ibm.com), Staff Software Developer, IBM
Michelle Crane
Michelle L. Crane has a Ph. D. in Computer Science from Queen's University. Dr. Crane joined IBM in 2009 and is the development lead responsible for maintaining and enhancing the profile tooling component of the IBM® Rational® Software Modeler and IBM® Rational® Software Architect solutions.

Summary:  Profile tooling enables you to generate tooling from existing or user-created profiles. This article explains how you can modify a tooling model in order to generate profile tooling code for stereotypes on association classes. Profile tooling helps enable you to generate tooling from existing or user-created profiles. Currently, it is possible to generate tooling for stereotypes and associations; however, stereotypes on association classes are not supported. This article explains how you can modify a tooling model in order to generate profile tooling code for stereotypes on association classes. Profile tooling is supported by the IBM Rational Software Architect and IBM Rational Software Modeler solutions. The instructions described in this article pertain to RSM/RSA 7.5.4 and above.

Date:  04 Feb 2010
Level:  Introductory PDF:  A4 and Letter (596KB | 16 pages)Get Adobe® Reader®
Also available in:   Chinese

Activity:  5740 views
Comments:  

Instructions


Setup

Create a new UML Profile Tooling Plug-in Project, based on a new profile. When prompted, enter TestProfile for both the profile name and file name.

In the Project Explorer, navigate to the new profile and create a new Class Diagram.

Create a profile that uses stereotype associations. For the purposes of these instructions, we will use the profile illustrated below.


Figure 1. Profile
class diagram of simple profile.

To summarize, the profile contains two stereotypes, A and B, which extend the metaclass Class. It also contains a stereotype, stereotypeName, which extends the metaclass AssociationClass. Finally, it contains a stereotype, lessThan, which extends the metaclass Association.

Save the profile.

Now right-click on the profile and select Generate Profile Tooling Model. When prompted, choose not to configure the advanced properties.

Once the tooling model is generated, it can be found under the Models folder in the Project explorer. Its name, when closed, will be TestProfile. When open, the model shows as <<ToolingModel, EditHelpers, Figures, L10N, Providers, Utils>> TestProfile, as seen below.


Figure 2. Tooling model
project explorer view of tooling model


Modifying the tooling model

The following instructions demonstrate how to manually modify the tooling model to support the generation of tooling code for one specific stereotype on an association class. In this case, we will modify the tooling model to support the <<stereotype>> stereotypeName. Repeat these steps for every stereotype on an association class in your profile, replacing every instance of “stereotypeName” with your stereotype name. Remember: these steps are not necessary for stereotypes on Classes, or on Associations.

Create a new DefaultEditPart

Click on the <<Shapes>> folder in the tooling model. You can see the default edit parts for all of the existing components; you will be adding a new <<DefaultEditPart>> for the stereotypeName stereotype.

Components are added to the tooling model through diagrams. Right-click on the <<Shapes>> folder. Create a new Freeform diagram, by selecting Add Diagram > Freeform Diagram.

In the new diagram, use the DefaultEditPart tool from the Shapes palette (shown below) to add a new DefaultEditPart to the diagram. Name it stereotypeNameAssociationClass.


Figure 3. Shapes palette
Shapes palette showing the DefaultEditPart

The diagram should look like the figure below. The <<Shapes>> folder now contains the new DefaultEditPart.


Figure 4. Shapes diagram
StereotypeNameAssociationClass


Create a new PropertySection

Click on the <<Properties>> folder in the tooling model, and then click on the <<PropertySections>> folder. You can see the existing property sections; you will be adding a new <<PropertySection>> for the stereotypeName stereotype.

Right-click on the <<PropertySections>> folder. Create a new Freeform diagram.

In the new diagram, use the PropertySection tool from the Properties palette (shown below) to add a new PropertySection to the diagram. Name it <stereotypeName> AssociationClass.


Figure 5. Properties Palette
Properties palette showing PropertySection.

The diagram should look like the figure below. The <<PropertySections>> folder now contains the new PropertySection.


Figure 6. PropertySections diagram
[stereotypeName] AssociationClass


Create a new PaletteTool

Click on the <<Palettes>> folder in the tooling model, and then click on the <<PaletteTools>> folder. You can see the existing palette creation tools; you will be adding a new <<PaletteCreationToolEntry>> for the stereotypeName stereotype.

Right-click on the <<PaletteTools>> folder. Create a new Freeform diagram.

In the new diagram, use the PaletteCreationToolEntry from the Palettes palette (shown below) to add a new PaletteCreationToolEntry to the diagram. Now you need to name it <stereotypeName> AssociationClass.


Figure 7. Palettes palette
Palettes folder showing PaletteCreationToolEntry.

The diagram should look like the figure below. The <<PaletteTools>> folder now contains the new PaletteCreationToolEntry.


Figure 8. PaletteTools diagram
The graphic shows the <stereotypeName> AssociationClass, which is the content of PaletteTools diagram.


Create a new ElementType

Click on the <<ElementTypes>> folder in the tooling model. You can see the existing element types; you will be adding a new <<SterotypeLinkSpecializationElementType>> for the stereotypeName stereotype.

Now right-click on the <<ElementTypes>> folder. Create a new Freeform diagram.

In the new diagram, use the StereotypeLinkSpecializationElementType tool from the Element Types palette (shown below) to add a new StereotypeLinkSpecializationElementType to the diagram. Name it <stereotypeName> AssociationClass.

A tip you can use to make this process go more smoothly is if you cannot immediately see the StereotypeLinkSpecializationElementType tool, explore the Element Types palette. StereotypeLinkSpecializationElementType is in the same palette stack as the StereotypeSpecializationElementType. When you do this, make sure to choose the right tool.


Figure 9. Element Types palette
Element Types folder palette open.

The diagram should look like the figure below. The <<ElementTypes>> folder now contains the new StereotypeLinkSpecializationElementType.


Figure 10. ElementTypes diagram
<stereotypeName> AssociationClass


Connect the new elements

In the Freeform diagram just created (in the <<ElementTypes>> folder, perform the following steps:

  1. From the <<Shapes>> folder, drag the new <<DefaultEditPart>> stereotypeNameAssociationClass onto the diagram.
  2. From the Shapes palette, use the EditPart elementType tool to connect the <<DefaultEditPart>> to the <<StereotypeLinkSpecializationElementType>>.
  3. From the <<PropertySections>> folder, drag the new <<PropertySection>> onto the diagram.
  4. From the Properties palette, use the PropertySection elementType tool to connect the <<PropertySection>> to the <<StereotypeLinkSpecializationElementType>>.
  5. From the <<PaletteTools>> folder, drag the new <<PaletteCreationToolEntry>> onto the diagram.
  6. From the Palettes palette, use the ToolEntry elementType tool to connect the <<PaletteCreationToolEntry>> to the <<StereotypeLinkSpecializationElementType>>.

The resulting freeform diagram is shown below.


Figure 11. Resulting freeform diagram
contents of Freeform diagram


Set the properties

Ensure that the Properties view is open. If not, open it using the Window > Show View > Properties.

In the Freeform diagram (in the <<ElementTypes>> folder, click on the <stereotypeName> AssociationClass <<StereotypeLinkSpecializationElementType>>.

In the Properties view, select the Stereotypes tab, as shown in the graphic below.


Figure 12. Properties view
Stereotypes tab of Properties view

Larger view of Figure 12.

For each of the properties in the table below, click on the Value cell in the property tab and enter the relevant information.

Table 1. Properties

PropertyValue
adviceClassNamestereotypeNameAssociationClassEditHelperAdvice
displayName<stereotypeName> AssociationClass
idTestProfile.stereotypeNameAssociationClass
kindcom.ibm.xtools.uml.type.IStereotypedElementType
matcherClassNamestereotypeNameAssociationClassMatcher
specializesIdcom.ibm.xtools.uml.associationClass

To help ensure that the TestProfile profile is open, navigate to the Profiles folder in the Project Explorer and ensure that you can see the contents of the profile.

Back in the Stereotypes tab of the properties view for the <<StereotypeLinkSpecializationElementType>>, click on the browse button in the Value column of the stereotypeGenClass property.

In the Select Element dialog, click on the Modify Search Scope… button. Select the “Search entire workspace”.

In the Search tab, search for stereotypeName – it is in the TestProfile profile, as shown below.


Figure 13. Select Element dialog
Search tab of Select Element dialog

Select the stereotypeName - TempProfile::stereotypeName and click OK.

The resulting properties should look like the figure below.


Figure 14. Resulting properties
Property and Value screen


Add the new stereotype to the Palette

In the Project Explorer, open the <<Palettes>> folder in the tooling model. Right-click on the <<PaletteStacks>> folder and create a new Freeform diagram.

From the <<PaletteGroups>> folder, drag the <<PaletteDrawer>> TestProfile from the Project Explorer onto the diagram.

Using the PaletteStack tool from the Palettes palette, create a new PaletteStack on the diagram.

Using the PaletteContainer children tool from the Palettes palette, connect the TestProfile palette drawer to the new palette stack.

From the <<PaletteTools>> folder, drag the <<PaletteCreationToolEntry>> <stereotypeName> AssociationClass from the Project Explorer to the diagram.

Using the PaletteContainer children tool from the Palettes palette, connect the new palette stack to the palette creation tool entry.

The Freeform diagram should look like the figure below.


Figure 15. Resulting PaletteStacks freeform diagram
TestProfile, PaletteStackClass  AssociationClass

Save all open diagrams and the tooling model.


Generating the tooling code

Generate the profile tooling code. To do so, right-click on the tooling model and select Generate Tooling Code (this command will be in the bottom third of the context menu).

There should be no compile errors in the generated code. If there are errors, this may indicate that a step above has been missed, or an error has crept into your process. For instance, accidentally using the StereotypeSpecializationElementType tool instead of the StereotypeLinkSpecializationElementType tool will result in errors. In addition, if mistakes were made in the original profile, e.g., adding something to the profile and then deleting it from the diagram but not the profile itself, the resulting tooling could contain errors.


Final result

After the profile tooling code has been generated, the plug-in can be launched. The resulting tooling should look like the figure below.


Figure xxx. Requires a heading
freeform diagram created with deployed plug-in

The example model shows the difference between the stereotyped association and the stereotyped association class.


Summary

By following the steps outlined above, you can now customize your profile tooling model in order to permit the generation of tooling code for stereotypes on association classes. With the help of these instructions, you are now able to customize the profile tooling code for your own profiles, streamlining your development process for your own unique needs.


Resources

Learn

Get products and technologies

Discuss

About the author

Michelle Crane

Michelle L. Crane has a Ph. D. in Computer Science from Queen's University. Dr. Crane joined IBM in 2009 and is the development lead responsible for maintaining and enhancing the profile tooling component of the IBM® Rational® Software Modeler and IBM® Rational® Software Architect solutions.

Report abuse help

Report abuse

Thank you. This entry has been flagged for moderator attention.


Report abuse help

Report abuse

Report abuse submission failed. Please try again later.


developerWorks: Sign in


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Select information in your profile (name, country/region, and company) is displayed to the public and will accompany any content you post. You may update your IBM account at any time.

Choose your display name

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


Rate this article

Comments

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Rational
ArticleID=464924
ArticleTitle=How to customize your profile tooling model to support association classes
publish-date=02042010
author1-email=craneml@ca.ibm.com
author1-email-cc=