SDA SE Wiki

Software Engineering for Smart Data Analytics & Smart Data Analytics for Software Engineering

User Tools

Site Tools


Editing UML Tips

Open a diagram

  • UML2 diagrams are stored in two separated files:
    • one for the pure model (.uml)
    • one for diagram, containing layout and position information (e.g. .umlusc, .umlclass, …, .umldi)
  • You edit the diagram files using graphical editors by double clicking the files in the Eclipse Navigator view1). The model files are automatically updated.
  • :!: You cannot open the diagram files outside an Eclipse workspace. Always import the enclosing project into your workspace2) before opening a file. This is always the case when you use the Eclipse SVN plug-ins.

Create a diagram

  • for use case diagrams and class diagrams:
    • Open the new file dialog (Ctrl+N).
    • Select the respective diagram type.
  • for all other diagrams:
    • Open the new file dialog.
    • Select “UML Model with TOPCASED”
    • Choose the diagram type on the following dialog
  • :!: Choose the name of the diagram wisely. Changing it afterwards is unfortunately very complex and buggy. Here is the receipt anyway which works for uml2tools files:
    • First rename the model file: Right-click on the <name>.uml file and select Refactor→Rename
    • Delete the GUI file (*.umlusc or *.umlclass)
    • Right-click on the .uml model file and select Initialize Use Case Diagram, resp. Initialize Class Diagram

Create a profile

  • Create the profile definition diagram
  • “Define” (or re-define) the profile by selecting this option in the context menu of the editor's background
  • Save

Use a profile

  • Context menu of the background: Load Resource
  • Context menu of the background: Apply Profile
    • Once you changed and re-defined a profile and want to use the changed stereotypes, you must re-apply the profile, too.
  • To use a stereotype, e.g. select “apply stereotype” in the context menu of a class

Class Diagrams

Adding Fields
  • select the Attribute element in the Palette view and or click on the class's attribute area or use the fly-over menu and choose Add Property3):  Add a field to a class
  • Type a <property name> : <typename>. The type must already be defined, otherwise it will be ignored and only the property name is shown.
  • To edit a field name or its type click once on the property to select it and once more to edit it (or F2).
  • Change the visibility via the prefixes + (public, the default), - (private), # (protected), ~ (package)
Adding Methods
  • Proceed as like you did for fields, but use Operations instead
  • The pattern for method signatures is: <name> ( [<param_name> : <Type> ( [ , <param_name> : <Type> ] ) * ] ) [ : <ReturnType> ], e. g. m(p:Integer,p2:String) : Integer
  • Be aware of the following bug: After changing a method signature it may be necessary edit it again to see result of you changes (F2 + Enter)

Adding Lifelines to Sequence Diagrams

  • Click on Lifeline in the toolbox
  • Click to place it in the diagram
  • Open the Properties view (Ctrl+3 Properties)
  • Click on “New” at the end of the “Represents:” field.
  • Enter the name of the class this lifeline instantiates.
  • To use classes from existing class diagrams import the classes's package in the outline view4):
    • Right-click the context-menu of the uml model in the outline
    • Open project, enclosing folder and model file. Select the package containing the classes to import.

 Context-menu of the uml model in the editor's outline  Open project, enclosing folder and model file. Select the package containing the classes to import.

Further documentation

1)
By default the Navigator view is not open in the SVN … Perspective. Switch to the Java perspective after your first checkout to see the Navigator.
2)
File→Import→Existing Project into Workspace
3)
In UML2 Properties are used to represent fields in classes
4)
In case the outline is closed, open the outline view via Ctrl+3 and type outline
teaching/lectures/atsc/2009/using_the_uml_editor.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2025