Creating a UML diagram with Eclipse Papyrus

Yesterday, I upgraded my Eclipse to Kepler. I needed to create a UML class diagram and decided to try out Papyrus – an Eclipse incubator project.  It wasn’t as straightforward as I expected so blogging about what to do and what not to do.  Class_Diagram

I think this project needs more documentation (and a few more features) before using it seriously.  Luckily, my diagram was trivial.  In fact, it was so trivial, I decided to switch to PowerPoint (or in my clas – Open Office Drawing)

Regardless, here’s what I learned before giving up on it.

Creating a diagram

  1. File > New > Papyrus Project
  2. Enter project name
  3. Click NEXT (Do not click Finish.  I was unable to use papyrus > new diagram > create new class diagram when I didn’t create one right away)
  4. UML
  5. Click next
  6. Enter diagram name and click “UML Class Diagram”
  7. Click finish

Adding a class

  1. Switch to the Papyrus Perspective
  2. Drag a “Class” node from the palette view at right
  3. Click the “Class 1” name once and then type the name of your class.  (Do not double click the class box as it opens a hyberlink view.  Do not click the class box and expect to type in it
  4. Drag an ‘Operation” node from the palette at right onto your class
  5. Click “Operation 1” and type the name of your method (Do not add an operation to the model explorer view at left as it will not show up in the diagram)

Preferences

In the Eclipse preferences, you can set a number of view preferences.  They are extremely granular.  For example, I wanted to hide the fourth “section” of the UML diagram showing just class name, attributes and operations.  To do this, I had to:

  1. Preferences > Papyrus > Diagrams > PapyrusUMLClassDiagram > Class Node
  2. Uncheck “show compartment” in NestedClassifierComponent section
  3. Preferences > Papyrus > Diagrams > PapyrusUMLClassDiagram > Interface Node
  4. Uncheck “show compartment” in NestedClassifierComponent section
  5. Delete my diagram and create a new one as I could not figure out how to get preferences to take effect on an existing diagram.

What still puzzles me

There has to be a way to refresh the graphical view to sync with the model explorer and update based on workspace preferences.

8 thoughts on “Creating a UML diagram with Eclipse Papyrus

  1. Pingback: eclipse kepler (4.3) on a mac | Down Home Country Coding With Scott Selikoff and Jeanne Boyarsky

  2. Hi Jeanne !

    At first,thank you for your post .
    Secondly , Your diagram wasn’t trivial it is very useful for a beginner.
    I agree with you that this project needs more documentation.
    I am reading UML specification and trying to implement those concepts using Papyrus as a modeling environment.
    At first , this was very hard for me to implement those UML concepts with limited documentation plus
    UML is an extremely complex language, not self-consistent and too imprecise for direct interpretation.

    However, I take advantage from the following blog, it is managed by amazing guy

    http://lowcoupling.com/modeling

    I Hope this can help you:)

    Safa

  3. Hi Jeanne and Safa, thank you for your very kind comments. I find this blog very interesting as well and I would be glad to collaborate.

    I have recently updated the MDA page (http://lowcoupling.com/modeling) and I am working on ambitious open source framework from Project Management based on Eclipse you can find on http://www.lowcoupling.com/mdpm.

    I am going to share a link to your blog in my home page among my favorite links.

    Let me know if there anything I can do to help you exploiting Eclipse and the whole MDA suite

  4. Don’t bother to try Papyrus. Such simple thing as creating a class attribute is so complicated.

  5. Hi, we have option to reflect changes done in model explorer in graphical view. Right click your class Filters > Show Hide Contents
    Select the contents added from model explorer

  6. Is this same as rational rose? I dont see any colorful diagrams drawn from papyrus. However your tutorial was very useful for me to try papyrus for the first time. Thanks

Leave a Reply

Your email address will not be published.