Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Tigerstripe Class Diagram Tutorial
< To: Tigerstripe_Tutorials
You can edit a Tigerstripe model project graphically using the Tigerstripe Class Diagram Editor. This allows you to better visualize how the artifacts in your model are related and used.
Contents
Prerequisites
Before you can complete this tutorial, you must be familiar with the concepts covered in the Simple Service Contract Design tutorial.
Create a new class diagram
- Open a Tigerstripe Project and navigate to a package where you have, or want to create, some artifacts. Right-click on the package folder in the Tigerstripe Explorer, select New and click New Class Diagram. The New Tigerstripe Diagram dialog box opens.
creatediagram - Enter a file name and click Finish.
- For this example use the name simpleDiagram.
In the Tigerstripe Explorer you will see a new icon representing your Class Diagram, and the Diagram Editor will open, showing a blank diagram.
You are now ready to start graphically designing your service contract.
Add existing Artifacts a Class diagram
- Click on an artifact in your project (Note: Don't select an Association, AssociationClass or Dependency Artifact!)
- Keep the mouse button pressed down and drag the icon across the diagram, then release the mouse.
- The artifact will be shown in the diagram, with its Stereotypes, Attributes, Methods and Labels as appropriate.
- As you drag more artifacts on, any Associations, AssociationClasses or Dependencies that relate to the artifacts are automatically added to the diagram, as are extends relationships.
Dragging Artifacts form another package into diagram will result in the Fully Qualified Name for that artifact being displayed. You can change this behaviour through the options described in #Navigating and Enhancing your diagram
Adding Artifacts to the model using the Diagram Editor
The drawing pallete is the most convient way to create your service contract when utilizing the Tigerstripe Diagram Editor. The drawing pallete automatically displays on the right hand side of the Tigerstripe Diagram Editor once you create your class diagram.
- To create a new artifact, click on the icon corresponding to the type of artifact you wish to create, then point to where on the diagram you want to draw it, and click again.
- The artifact will be drawn, and the name of the artifact will immediately be set in edit mode so that you can enter your own name for the artifact.
- When you have entered the name, press Enter.
Alternatively, if you rest the mouse pointer on the diagram background, the available artifact types will appear in a floating toolbar - just select the type and proceed as above.
Notice that the artifacts created like this are created in the package where the diagram was created, and that they are automatically added to the Tigerstripe Explorer.
- Adding Relationships
You may notice that there are no icons for adding Associations, AssociationClasses or Dependencies (Collectively called relationship). These can be added directly to your diagram as follows:
- Hover the mouse pointer the artifact that you want to be at one end of the relationship.
- Notice two arrows will appear that point to/from the artifact. Click on the box at the end of the arrow pointing away from the artifact. Hold the mouse button down and drag the line to the artifact you want to be at the other end of your relationship, then release the mouse.
- A pop-up menu will appear with a number of options asking you which type of relationship should be created. Select Create Association.
- An Association Artifact will be created in the Tigerstripe Explorer, and it will be drawn on the diagram. You can edit the name as for the Artifact you just created.
- Using the away arrow will result in the first Artifact you selected being the A end and the second being the Z end. using the in arrow would have created the Association with the ends swapped.
Note that subject to normal model constraints you can also create Extends relationships between Artifacts in the same way, even though these are not Artifacts themselves.
Editing the Model through the Diagram Editor
- Adding Attributes to Artifacts
- To add an attribute from the editor, hover the mouse pointer over the artifact where you wish to add the attribute.
- Notice a floating toolbar will appear with icons representing items that can be added to the Artifact - a red square corresponds to an Attribute (as it does in the Tigerstripe Explorer expanded view).
- Click on the icon and an attribute will be added to the Artifact, with default name and type. This is equivalent to selecting the Add button in the Attributes section of the Artifact editor.
- Adding Methods and Labels to Artifacts.
- This is done in using the same technique as for attributes, but selecting the relevant icons in the floating toolbar.
You can edit Artifact names, and a subset of other details by double-clicking on the item concerned. Note: Not everything can be in this manner.
Class Diagram are automatically kept up to date with model changes that are made through Artifact editors (although you may be prompted to save the diagram after such updates). Similarly updates made through the diagram editor are automatically propagated to the Tigerstripe Explorer.
You can switch from the Diagram Editor to the Artifact Editor by selecting an Artifact in the Diagram, right-clicking and selecting Open in Editor
- Zooming
- Select items in your diagram using the Select tool ().
- Zoom in closer to view specific areas of your diagram using the Zoom tool ().
- Zoom out to view your entire diagram by pressing SHIFT + the Zoom tool.
- Zooming is also possible from the Diagram toolbar.
- Layout
- You can drag your Artifacts around the diagram to get the layout you require. The Relationships will follow the Artifact.
- You can try using the Arrange All and Arrange Selection items from the toolbar to improve the layout.
- You can also add or remove points to/from lines for clarity.
- Options
- If you right-click on the Diagram background, there are three options in the pop-up menu. None of these options affect the model itself, but are intended to facilitate cleaner, more meaningful diagrams.
- Synch-up with Model This can be useful if the diagram gets out of sycnh with the model (eg by not saving the diagram when prompted).
- Manage Links This can be used to hide/expose links between artifacts which might aid clarity of drawing.
- Hide/Show Using the options here you can de-clutter your diagram to show the key information.
- Other diagram tools
- In addition to the model specific tools available with the Tigerstripe Diagram Editor, you also have access to additional standard drawing tools. These tools allow you to add basic shapes to your diagram, such as ovals, triangles, rectangles, cylinders, and diamonds. These are accessed by right-clicking on the diagram background, and selecting Add.
- Attach notes and text to your diagram by using the Note tool and the corresponding pull-down menu to select from the options available: Note, Text, Note Attachment.
- You can also format your Artifact representations eg change the color coding using the right-click options.