Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "MDT-UML2Tools FAQ"

(Extending UML2 Tools)
 
(15 intermediate revisions by the same user not shown)
Line 4: Line 4:
  
 
=== Which UML diagrams are supported by UML2Tools? ===
 
=== Which UML diagrams are supported by UML2Tools? ===
Class, Profile Definition, Component, Activity, State Machine, Composite Structures, Deployment and Use Case diagram editors are available in UML2Tools.
+
UML2 Tools provides diagram editors for<br>
 +
* Structures:
 +
** Class
 +
** Profile Definition
 +
** Composite Structures
 +
** Component
 +
** Deployment
 +
* Behavior:
 +
** Activity
 +
** State Machine
 +
** Use Case
 +
* Interaction:
 +
** Sequence (expected in Galileo M3)
  
 
=== How can I start with UML2Tools? ===
 
=== How can I start with UML2Tools? ===
Line 23: Line 35:
 
UML2Tools diagram is presented by two files in the file system - domain model file (*.uml) and diagram file (*.umlclass_diagram, *.umlstatemachine_diagram). This is a standard for GMF-generated diagram editors. More information on [http://wiki.eclipse.org/GMF GMF page].
 
UML2Tools diagram is presented by two files in the file system - domain model file (*.uml) and diagram file (*.umlclass_diagram, *.umlstatemachine_diagram). This is a standard for GMF-generated diagram editors. More information on [http://wiki.eclipse.org/GMF GMF page].
  
=== Can I restore diagram from semantic model (*.uml file)? ===
+
=== Can I create a diagram from UML2 model (*.uml file)? ===
 
Yes, it's easy. To 'visualize' diagram from *.uml file use 'Initialize Class Diagram' action from the context menu of the file. There are also actions to initialize Component, Activity or State Machine diagram, choose the one you need. Appropriate diagram file (*.umlclass, *.umlcomp etc) will be created and then open. This feature is provided by GMF.
 
Yes, it's easy. To 'visualize' diagram from *.uml file use 'Initialize Class Diagram' action from the context menu of the file. There are also actions to initialize Component, Activity or State Machine diagram, choose the one you need. Appropriate diagram file (*.umlclass, *.umlcomp etc) will be created and then open. This feature is provided by GMF.
 +
 +
=== How can I export my UML model to XMI? ===
 +
Open your .uml model using the sample UML editor (Open With > UML Model Editor).
 +
Call 'File > Save As..' and enter a file name with .xmi file extension.
  
 
== Extending UML2 Tools ==
 
== Extending UML2 Tools ==
 
=== I want to customize the UML2Tools class diagram. How can I regenerate the diagrams? ===
 
=== I want to customize the UML2Tools class diagram. How can I regenerate the diagrams? ===
 
There is a special "[[MDT-UML2Tools How To Regenerage Diagrams]]" page in with step by step instruction.
 
There is a special "[[MDT-UML2Tools How To Regenerage Diagrams]]" page in with step by step instruction.
 +
=== I want to add my custom actions to the UML2Tools class diagram. How can I do it? ===
 +
You can extend UMLDiagramAction2 class from org.eclipse.uml2.diagram.common plugin. You can use action from [https://bugs.eclipse.org/bugs/show_bug.cgi?id=267227 bug 267227] as an example
 +
 +
== Working with Structure Diagrams ==
 +
===Is it possible to show content of multiple packages in a single diagram?===
 +
Yes, it is possible:<br>[[Image:18.11_Importing_a_package_from_a_profile.gif]]<br>
 +
Here (source are [http://wiki.eclipse.org/images/c/c3/Sample18_11.zip attached]) packages 'Factory' and 'Types' are contained inside their parent 'Package' package. <br>
 +
Package is shown in 'frame' notation here, that's why its content is displayed. In order to show a package in 'frame' notation, invoke 'Show as > Frame' action from the context menu of the package.<br>
 +
In order open a particular package in its own diagram editor, double-click the package:<br>[[Image:18.11_Importing_a_package_from_a_profile_Types.gif]]<br>
 +
 +
===How can I change multiplicity of an Association End?===
 +
* Using label in-place editor:<br>
 +
When association is created, it has at least 3 labels -- the centered one with association name, and pair of the roles labels at the both sides. By default, the roles are set to "src" and "dst".<br>
 +
Try to invoke inplace for "src" label and enter text "src [2..*]" here. It is expected that 2 labels will be created at this side of the link: <br>
 +
one that shows "src" and another that shows just entered multiplicity [2..*]<br>
 +
 +
Note, that both of new labels share the same inplace, so would you select "[2..*]" label and press F2 now, the text in the editor should be "src [2..*]" -- the same as inplace for "scr" label. <br>
 +
 +
Just in case, try to invoke this inplace and enter "scr [2..*] {union}" -- there will be 3 labels (role, multiplicity and properties) at this side. Again, all of them should share the same inplace editor, initialized with complete association notation from 06-04-02.
 +
* Using Properties View:<br>
 +
In properties view of an Association choose SourceEnd(TargetEnd) tab. In the tab you can edit whatever properties of the association end, e.g. its Multiplicity.
 +
 +
===Can I display a single element several times, like it is shown on figure 7.3 of UML 2.2 specification?===
 +
Yes, you can: <br>[[Image:7.3_-_Root_diagram_of_the_Kernel_package.gif]]<br>
 +
The sample diagram is located in cvs in org.eclipse.uml2.diagram.examples.clazz/diagram/08-05-05/infrastructure.
  
 
== Working with Profile Definition Diagram ==
 
== Working with Profile Definition Diagram ==
Line 37: Line 78:
  
 
=== Can I have multiple generalizations for stereotypes? ===  
 
=== Can I have multiple generalizations for stereotypes? ===  
In the example below ThirdLevel extends Propery and generalizes TopLevel and Second Level:<br>[[Image:Multiple_generalization.jpg‎]]<br>
+
In the example below ThirdLevel extends Propery and generalizes TopLevel and Second Level:<br>[[Image:Multiple_generalization2.jpg‎]]<br>
 
However, the user gets this error when runs “UML Editor->Profile->Define”:<br>[[Image:Error_on_multople_generalizations.jpg]]<br>
 
However, the user gets this error when runs “UML Editor->Profile->Define”:<br>[[Image:Error_on_multople_generalizations.jpg]]<br>
 
It's not a bug. 'Define profile' dialog allows you to configure many options, Multiple Generalization is one of them. You can change default value of 'Super Class Order' option from 'Report' to 'Process':<br>[[Image:DefineProfile.jpg]]<br> After that Profile will be applied well.
 
It's not a bug. 'Define profile' dialog allows you to configure many options, Multiple Generalization is one of them. You can change default value of 'Super Class Order' option from 'Report' to 'Process':<br>[[Image:DefineProfile.jpg]]<br> After that Profile will be applied well.
 +
 +
=== Is the source code for umlprofile_diagram in the CVS Repository? ===
 +
[http://wiki.eclipse.org/images/e/e0/Uml2tools_profile.psf This] PSF file consists of plugin for profile diagram editor(org.eclipse.uml2.diagram.profile) and its dependencies from UML2Tools.
 +
Use 'Import>Team>Team Project Set' action in order to import projects into your workspace.
 +
Other useful information on generating UML2Tools diagram is in [http://wiki.eclipse.org/MDT-UML2Tools_How_To_Regenerage_Diagrams How To Regenerage Diagrams] wiki.
 +
 +
=== Has there been any work on profiles to support different Icons?===
 +
Different icons for stereotyped element can be used, for example, when you set the stereotype of a class to plane and you want the diagram to use your defined shape of a plane when displaying the model.
 +
UML2 Tools developers hope to implement the functionality soon. You can track [https://bugs.eclipse.org/bugs/show_bug.cgi?id=246358 bug 246358]for the changes.
 +
===What UML2 Tools diagrams support profile and stereotype using?===
 +
Currently, Only Class Diagram editor supports profile and stereotype application, but they will be available in other structure diagrams soon ([https://bugs.eclipse.org/bugs/show_bug.cgi?id=252748 bug 252748]).
 +
 
[[Category:FAQ]]
 
[[Category:FAQ]]
 
[[Category:MDT]]
 
[[Category:MDT]]
 
[[Category:Modeling]]
 
[[Category:Modeling]]

Latest revision as of 12:40, 5 March 2009

General

What is UML2Tools?

UML2 Tools is a set of GMF-based editors for viewing and editing UML models.

Which UML diagrams are supported by UML2Tools?

UML2 Tools provides diagram editors for

  • Structures:
    • Class
    • Profile Definition
    • Composite Structures
    • Component
    • Deployment
  • Behavior:
    • Activity
    • State Machine
    • Use Case
  • Interaction:
    • Sequence (expected in Galileo M3)

How can I start with UML2Tools?

First, install UML2Tools and its dependencies to your Eclipse platform. You can also install UML2 Tools via Update Manager. To check that UML2Tools feature is installed correctly go to Help/About Eclipse SDK, in the appeared dialog press 'Feature Details' button, feature with id 'org.eclipse.uml2.diagram' should present at the list. If so then New Diagram wizards are available in the 'New/Other/UML 2.1 Diagrams' wizard group. Then you may create diagram by your choice.

Which GMF version is used to generate UML2Tools source code?

UML2Tools diagrams use 'fresh' GMF. Source code is regenerated with up-to-date GMF on every significant change in GMF and on milestone. It is so because GMF provides more and more features with every iteration. However, some amount of custom code exists in this project. This code is put into 'custom-src' folder or marked with '@generated-not' tag. Note that we use 'Generate UML2Tools Diagrams' action in the context menu of *.gmfgen files to generate code. This action is available if you have GMF-sources checked out in your development workspace.

Where can I find GMF-sources?

GMF-sources (GMF files from which java-code is generated) are located in Eclipse CVS:

cvs -d pserver:dev.eclipse.org:/cvsroot/modeling co org.eclipse.mdt/org.eclipse.uml2tools/plugins/org.eclipse.uml2.diagram.def .

What metamodel do UML2Tools use?

UML2Tools use an EMF-based implementation of the UML™ 2.x metamodel for the Eclipse platform from UML2 project.

What are *.uml and *.umlclass_diagram files for?

UML2Tools diagram is presented by two files in the file system - domain model file (*.uml) and diagram file (*.umlclass_diagram, *.umlstatemachine_diagram). This is a standard for GMF-generated diagram editors. More information on GMF page.

Can I create a diagram from UML2 model (*.uml file)?

Yes, it's easy. To 'visualize' diagram from *.uml file use 'Initialize Class Diagram' action from the context menu of the file. There are also actions to initialize Component, Activity or State Machine diagram, choose the one you need. Appropriate diagram file (*.umlclass, *.umlcomp etc) will be created and then open. This feature is provided by GMF.

How can I export my UML model to XMI?

Open your .uml model using the sample UML editor (Open With > UML Model Editor). Call 'File > Save As..' and enter a file name with .xmi file extension.

Extending UML2 Tools

I want to customize the UML2Tools class diagram. How can I regenerate the diagrams?

There is a special "MDT-UML2Tools How To Regenerage Diagrams" page in with step by step instruction.

I want to add my custom actions to the UML2Tools class diagram. How can I do it?

You can extend UMLDiagramAction2 class from org.eclipse.uml2.diagram.common plugin. You can use action from bug 267227 as an example

Working with Structure Diagrams

Is it possible to show content of multiple packages in a single diagram?

Yes, it is possible:
18.11 Importing a package from a profile.gif
Here (source are attached) packages 'Factory' and 'Types' are contained inside their parent 'Package' package.
Package is shown in 'frame' notation here, that's why its content is displayed. In order to show a package in 'frame' notation, invoke 'Show as > Frame' action from the context menu of the package.
In order open a particular package in its own diagram editor, double-click the package:
18.11 Importing a package from a profile Types.gif

How can I change multiplicity of an Association End?

  • Using label in-place editor:

When association is created, it has at least 3 labels -- the centered one with association name, and pair of the roles labels at the both sides. By default, the roles are set to "src" and "dst".
Try to invoke inplace for "src" label and enter text "src [2..*]" here. It is expected that 2 labels will be created at this side of the link:
one that shows "src" and another that shows just entered multiplicity [2..*]

Note, that both of new labels share the same inplace, so would you select "[2..*]" label and press F2 now, the text in the editor should be "src [2..*]" -- the same as inplace for "scr" label.

Just in case, try to invoke this inplace and enter "scr [2..*] {union}" -- there will be 3 labels (role, multiplicity and properties) at this side. Again, all of them should share the same inplace editor, initialized with complete association notation from 06-04-02.

  • Using Properties View:

In properties view of an Association choose SourceEnd(TargetEnd) tab. In the tab you can edit whatever properties of the association end, e.g. its Multiplicity.

Can I display a single element several times, like it is shown on figure 7.3 of UML 2.2 specification?

Yes, you can:
7.3 - Root diagram of the Kernel package.gif
The sample diagram is located in cvs in org.eclipse.uml2.diagram.examples.clazz/diagram/08-05-05/infrastructure.

Working with Profile Definition Diagram

Is it possible to add constraints to the profile (perhaps OCL)?

'Constraint' palette entry is used to create Constraint elements, 'Constrained Element' link connects it with the constrained elements. Constraints are defined in textual form by default. But you can create OCL Constraint as well, as they are supported by subsequent Java-code generation. In order to create an OCL Constraint create 'Constraint' element using UML2 Tools, then go to UML Editor and edit 'language' property of OpaqueExpression there. Then the user returns to UML2 Tools editors and works with the constraint. Palette tool for OCL Constraint should be created soon (bug 252876)

Can I have multiple generalizations for stereotypes?

In the example below ThirdLevel extends Propery and generalizes TopLevel and Second Level:
Multiple generalization2.jpg
However, the user gets this error when runs “UML Editor->Profile->Define”:
Error on multople generalizations.jpg
It's not a bug. 'Define profile' dialog allows you to configure many options, Multiple Generalization is one of them. You can change default value of 'Super Class Order' option from 'Report' to 'Process':
DefineProfile.jpg
After that Profile will be applied well.

Is the source code for umlprofile_diagram in the CVS Repository?

This PSF file consists of plugin for profile diagram editor(org.eclipse.uml2.diagram.profile) and its dependencies from UML2Tools. Use 'Import>Team>Team Project Set' action in order to import projects into your workspace. Other useful information on generating UML2Tools diagram is in How To Regenerage Diagrams wiki.

Has there been any work on profiles to support different Icons?

Different icons for stereotyped element can be used, for example, when you set the stereotype of a class to plane and you want the diagram to use your defined shape of a plane when displaying the model. UML2 Tools developers hope to implement the functionality soon. You can track bug 246358for the changes.

What UML2 Tools diagrams support profile and stereotype using?

Currently, Only Class Diagram editor supports profile and stereotype application, but they will be available in other structure diagrams soon (bug 252748).

Copyright © Eclipse Foundation, Inc. All Rights Reserved.