Development Environment:To use eclipse UML2 tools plug-in, Environment configuration is very important, my development environment is as follows: l jdk1.5.0 _ 01l eclipse 3.3m6l emf-sdo-xsd-SDK-2.3.0M6l emft-query-SDK-1.1M6l emft-transaction-SDK-1.1M6l emft-validation-SDK-1.1M6l GEF-ALL-3.3M6l GMF-sdk-2.0M6l mdt-ocl-SDK-1.1M6l mdt-uml2-SDK-2.1M6l
IntroductionThis article describes how to create a model using UML2 tools. We use a simple model as an example. The model diagram designed with Rose is as follows:
Create a projectL
File> New> project ...,In the displayed dialog box, select
Eclipse modeling framework>
Empty EMF Project, Click"
Next"Button, in the dialog box, enter the Project name: umltools, click"
Finish"Button;
New ModelL
File> New> other...In the displayed dialog box, select
Examples>
Umlclass digoal, Click"
Next"Button. In this dialog box, you can specify the name and storage location of the UML class diagram, enter the file name test. umlclass_di#and the file storage path umltools/model, and click"
Next"Button, In this dialog box, you can specify the UML file name and storage path, enter the file name test. UML and file storage path umltools/model, click"
Finish"Button, the system automatically opens the class chart editor,
Create basic typeL select the editor. On the name attribute on the property page, enter test and l select the primitivetype on the color palette of the class Graph Editor, drag it to the editing area, and enter the name attribute (string ), in this way, the basic string type is created. Similarly, the basic float and long types are created;
New ClassL select the class in the color palette of the class Graph Editor, drag it to the editing area, and enter the name attribute (customer). In this way, create a customer class. In the same operation, create a class order;
New PropertyL select the attribute on the color palette of the class Graph Editor, drag it to the class customer, enter the name attribute (name), and select the type attribute (<primitivetype> string ), in this way, the name attribute of the customer class is created. Similarly, the ID and price attributes of the Order class are created;
Create AssociationL select Association> composite aggregation in the class Graph Editor palette, associate Class Customer and order, and enter the name attribute (customer_orders); l create the orders attribute in the customer class, set Association to <Association> mermer_orders for this attribute, set type to <class> order, input lower to 0, and upper to-1;
Save ModelSave the model so that a simple model is created.