MagicDraw OpenAPI User Guide - 3D S

OPEN API

version 17.0.1 user guide

No Magic, Inc. 2011

All material contained herein is considered proprietary information owned by No Magic, Inc. and is not to be shared, copied, or reproduced by any means. All information copyright 2003-2011 by No Magic, Inc. All Rights Reserved.

CONTENTS

0

INTRODUCTION 8

PLUG-INS 10

How plug-ins work 10 Writing plug-in 11 Testing plug-in 13 Detail information 13

Plug-in descriptor 13 Plug-in classes 15 Plug-In class loading 16 Important notes for Unix systems 17

Resource dependent plug-in 17

Implementing ResourceDependentPlugin example 17

NEW! MagicDraw Plugin Integration with Eclipse 18

Extending Eclipse Main Menu with Plugin Command 18

NEW! DEVELOPING PLUG-INS USING IDE 20

MagicDraw Plug-in Development in Eclipse 20

Step 1: Create Java Eclipse Project for MagicDraw Plug-in 20 Step 2: Create Plug-in Main Class 21 Step 3: Prepare Plug-in Descriptor File 21 Step 4: Start MagicDraw From Eclipse Environment 22 Step 5: Run MagicDraw Tests Cases from Eclipse Environment 23

PLUGINS MIGRATION TO MAGICDRAW 15.0 AND LATER OPEN API 25

UML metamodel changes 25

UML specification changes 25 UML metamodel API implementation changes 25

Removed deprecated methods 26 Libraries jars changes 26 Package name change for build-in plug-ins 26

PLUGINS MIGRATION TO MAGICDRAW 17.0.1 AND LATER OPEN API 27

UML Metamodel Changes 27 Project (Decomposition) Structure API Changes 27 Other OpenAPI Changes 28 Libraries jars Changes 28

NEW! MAGICDRAW UML 17.0.1 FILE FORMAT CHANGES 29

File Formats in MagicDraw 17.0.1 29

Zip Based File Format (mdzip, xml.zip) 29 Plain Text File Format (xml, mdxml) 29 Changes Related to Diagrams 29

3

Copyright ? 2003-2011 No Magic, Inc.

CONTENTS

NEW! UML MODEL IMPLEMENTATION USING EMF 32 UML Model Implementation Using EMF 32 UML Model Implementation in MagicDraw 17.0 Details 32

UML model implementation in MagicDraw 17.0.1 details 33

DISTRIBUTING RESOURCES 34

How to distribute resources 34 Creating required files and folders structure 34 Resource Manager descriptor file 40

JYTHON SCRIPTING 43 Creating script 43

Step 1: Create directory 43 Step 2: Write script descriptor 43 Step 3: Write script code 44 Variables passed to script 44

Jython 45

ADDING NEW FUNCTIONALITY 46 Invoking Actions 46 Creating a new action for MagicDraw 47

Step 1: Create new action class 47 Step 2: Specify action properties 49 Step 3: Describe enabling/disabling logic 49 Step 4: Configure actions 50 Step 5: Register configurator 52

Actions hierarchy 53

Predefined actions configurations 54 NEW! Selecting elements via element Selection dialog 54

UML MODEL 55 Project 55

Root Model 56

Accessing Model Element properties 56

Container properties 56

Collecting all children from all hierarchy levels 57

Visitors 58 InheritanceVisitor 58

Changing UML model 59

SessionManager 59 ModelElementsManager 59 Creating new model element 60 Editing model element 60 Adding new model element or moving it to another parent 60 Removing model element 61 NEW! Refactoring model elements 62 Creating Diagram 62 Creating new Relationship object 63

4

Copyright ? 2003-2011 No Magic, Inc.

CONTENTS

NEW! Copying elements and symbols 63

Working with Stereotypes and Tagged Values 64

Hyperlinks 65

PRESENTATION ELEMENTS 67 Presentation Element 67

Using set and sSet 68

Diagram Presentation Element 68 Shapes 69 Paths 69 Presentation Elements Manager 69

Creating shape element 70 Creating path element 70 Reshaping shape element 70 Changing path break points 71 Deleting presentation element 71 Changing properties of presentation element 71

Notification of Presentation Element draw 72 NEW! Displaying Related Symbols 73

SYMBOLS RENDERING 74 Custom Renderer Provider 74

Registering Provider 74

Custom Symbol Renderer 74 Custom Renderers Sample 75

Creating Custom Renderers 75 Registering Custom Symbol Renderer Provider 77

DIAGRAM EVENTS 79 NEW! Diagram Listener Adapter 79

PATTERNS 80 Target concept 80

Using PatternHelper 80 Abstract Pattern 80

How to create my own pattern 82

Step 1: Create pattern properties class 82 Step 2: Create pattern panels class 83 Step 3: Create pattern class 83 Step 4: Create Description.html 84 Step 5: Create plug-in 84

PROPERTIES 86

NEW DIAGRAM TYPES 88

Diagram Types hierarchy 89 Adding a new diagram type for MagicDraw 89

5

Copyright ? 2003-2011 No Magic, Inc.

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download