User Tools

Site Tools


User Guide for version 0.2.0

Release notes, reporting bugs


Sample models

For a quick start we recommend experimenting with the sample models.

  • Download and unzip the sample models.
  • Import them into your Eclipse workspace (File / Import / General / Existing projects into workspace).

Each sample model is implemented using both XtxtUML syntax (see the files with .xtxtuml extension) and JtxtUML syntax (see the Java classes inheriting from the Model type). In addition, the sample models are accompanied with class diagram descriptions (see the Java classes inheriting from the Diagram type).

We suggest reading the Generating diagrams and the Running and debugging models sections as the next steps of experimenting with the sample models.

Creating own models

New txtUML project

txtUML models should be placed in txtUML projects. A new txtUML project can be created by selecting File / New project… / txtUML / txtUML Project and setting the project name.

By default, the project will be created in the current workspace. In order to override this, uncheck the Use default location checkbox and select a location for the new project.

New txtUML model

Select File / New / Other… / txtUML / txtUML Model.

Select a Source folder from an existing project to save the new model in. Select an existing Package from that folder or type a new Package name. (If you leave the Package field empty, the model will be in the default package, which is allowed but discouraged.)Type a Name for the new model.

Select the syntax of the new model:

  • JtxtUML for Java syntax. A Java file will be created in this case.
  • XtxtUML for custom modelling syntax. A file with xtxtuml will be created in this case.

Both JtxtUML and XtxtUML models can be connected with Java code, can be run and debugged, and used as a source for Papyrus UML model generation.

This wizard results in a new file with a model skeleton.

Modeling Language

See the Language Guide to study the txtUML language both in Java syntax (JtxtUML) and in custom syntax (XtxtUML). In case of JtxtUML, the JavaDoc of the API can also be used.

Generating diagrams

It is possible to generate EMF-UML2 models together with Papyrus diagrams from txtUML models. Currently class diagrams and state machine diagrams can be generated. Content and layout of the class diagrams can be defined by textual diagram descriptions. State machine diagrams are generated as is, and usually need to be laid out manually afterwards. (Support for state machine layout definitions is coming in a later release.)

We will use the following simple class model as example:

model ExampleModel {
	class A;
	class B;
	class C;
	class D;
	association AB {
		1 A a;
		* B b;
	association BD {
		1..* B b;
		0..1 D d;

In the following, we create a class diagram with where classes A, B and C are in a row, and class D is below B. Diagram definitions can be written using a Java API. See the Diagram Language Guide for detailed description.

Our example diagram can be defined as follows:

import hu.elte.txtuml.api.layout.*;
import examplePackage.ExampleModel.*;

public class ExampleDiagram extends Diagram {
	@Row({A.class, B.class, C.class})
	@Below(val = D.class, from = B.class)
	class ExampleLayout extends Layout {}

In order to generate diagrams, from the menu select txtUML / Generate diagrams from txtUML.

Fill in the name of the project containing the txtUML model, then fully qualified name of the model. Using the Add txtUML diagram description button, you can add as many diagram descriptions as needed. In our example, there is only one. The fully qualified name of the Java class representing the diagram definition needs to be filled in. Tick the check box to generate state machine diagrams for each class of the model. (This is not needed in our example, as there are no state machines in the model.)

When clicking Finish, a Papyrus model is generated with the following class diagram:

Diagram language

See the Diagram Language Guide for detailed description of the diagram language of txtUML.

Running and debugging models

The following hold both for XtxtUML and JtxtUML.

Switch to Java or Debug perspective and create a new run/debug configuration. Use Java Application type if you only want to run or debug the model only in text. Use txtUML Application type if state machine animation is required as well.

Breakpoints can be created and managed the same way as for Java programs. The standard debug controls (stop, pause, resume, step, step-into) work as usual.

The variable view can show the current signal, current state, associations and the attribute values of the actual object.

State machine animation

txtUML can animate state machine diagrams generated by the txtUML visualization process. See the Generating diagrams section and do not forget to tick the generate state machine diagrams automatically check box. Make sure that the run/debug configuration is of txtUML Application type.

Open the generated Papyrus diagram and start the model either in run or in debug mode. The current state and currently executed transition gets highlighted.

For each state machine diagram, the state changes of the first activated object of the corresponding type will be highlighted. An expected later improvement will make it possible to select the object to be animated during the debug session.

Compilation to C++

There is an experimental C++ model compiler in hu.elte.txtuml.export.cpp_(version).jar, that comes with the txtUML installation. It is not yet functional and integrated with the rest of the txtUML Eclipse GUI. We expect it to be fixed and integrated in a later release.

v020/userguide.txt · Last modified: 2015/11/05 15:16 by deva