OPEN API - CATIA

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.

0

CONTENTS

INTRODUCTION

PLUG-INS

8

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

NEW! MagicDraw Plugin Integration with Eclipse

17

18

Extending Eclipse Main Menu with Plugin Command 18

NEW! DEVELOPING PLUG-INS USING IDE

MagicDraw Plug-in Development in Eclipse

20

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

UML metamodel changes

25

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

DISTRIBUTING RESOURCES 27

How to distribute resources 27

Creating required files and folders structure 27

Resource Manager descriptor file 33

JYTHON SCRIPTING

36

Creating script 36

Step 1: Create directory 36

Step 2: Write script descriptor 36

Step 3: Write script code 37

Variables passed to script 37

3

Copyright ? 2003-2011 No Magic, Inc.

CONTENTS

Jython 38

ADDING NEW FUNCTIONALITY 39

Invoking Actions 39

Creating a new action for MagicDraw 40

Step 1: Create new action class 40

Step 2: Specify action properties 42

Step 3: Describe enabling/disabling logic

Step 4: Configure actions 43

Step 5: Register configurator 45

42

Actions hierarchy 46

Predefined actions configurations 47

NEW! Selecting elements via element Selection dialog

UML MODEL

Project

47

48

48

Root Model

49

Accessing Model Element properties

Container properties

49

49

Collecting all children from all hierarchy levels

Visitors 51

InheritanceVisitor

Changing UML model

50

51

52

SessionManager 52

ModelElementsManager 52

Creating new model element 53

Editing model element 53

Adding new model element or moving it to another parent

Removing model element 54

NEW! Refactoring model elements 55

Creating Diagram 55

Creating new Relationship object 56

NEW! Copying elements and symbols 56

Working with Stereotypes and Tagged Values

Hyperlinks

53

57

58

PRESENTATION ELEMENTS

Presentation Element

60

60

Using set and sSet 61

Diagram Presentation Element 61

Shapes 62

Paths 62

Presentation Elements Manager 62

Creating shape element 63

Creating path element 63

Reshaping shape element 63

Changing path break points 64

Deleting presentation element 64

Changing properties of presentation element

4

64

Copyright ? 2003-2011 No Magic, Inc..

CONTENTS

Notification of Presentation Element draw

NEW! Displaying Related Symbols 66

SYMBOLS RENDERING

65

67

Custom Renderer Provider 67

Registering Provider

67

Custom Symbol Renderer 67

Custom Renderers Sample 68

Creating Custom Renderers 68

Registering Custom Symbol Renderer Provider

DIAGRAM EVENTS

72

NEW! Diagram Listener Adapter

PATTERNS

70

72

73

Target concept 73

Using PatternHelper 73

Abstract Pattern 73

How to create my own pattern 75

Step 1: Create pattern properties class 75

Step 2: Create pattern panels class 76

Step 3: Create pattern class 76

Step 4: Create Description.html 77

Step 5: Create plug-in 77

PROPERTIES

79

NEW DIAGRAM TYPES

81

Diagram Types hierarchy 82

Adding a new diagram type for MagicDraw

PROJECTS MANAGEMENT

82

86

ProjectsManager 86

ProjectDescriptor 87

Project management 87

Module management 88

NEW! Merging and Differencing

PROJECT OPTIONS

90

92

Adding Own Project Options 92

Retrieving Project Option Value 93

5

NEW! ENVIRONMENT OPTIONS

94

Adding Custom Environment Options

94

Copyright ? 2003-2011 No Magic, Inc..

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

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

Google Online Preview   Download