Adding documentation to ModelElement

MagicDraw OpenAPI, scripting related questions and discussions

Moderator: Moderators

Adding documentation to ModelElement

Postby Andrew VanderVelde » Tue Feb 28, 2006 9:37 am

I am trying to create a new Use Case model element. I have created a menu
action that extends DefaultBrowserAction and it can create a new Use Case
with the following code:
UseCase newUseCase = new UseCase(((ModelElement)
getSelectedObject()).getNameSpace());
newUseCase.setName("Test");
ModelElementsManager.getInstance().addModelElement(newUseCase,
(ModelElement) getSelectedObject());

I would like to add documentation to the use case, however, there is no
setDocumentation method, only a getDocumentation() method.
How can I add documentation to the use case?


Andrew VanderVelde
 
Posts Rating:

Re: Adding documentation to ModelElement

Postby Tomas Pugzlys » Mon Mar 06, 2006 10:55 am

Hello,

Documentation of element is set as a comment for a model element.

ModelHelper.setComment(element, commentBody),
ModelHelper.getComment(Element element) helper methods are used to
set/get comments.

Hope this helps.

Regards,
--
Tomas Pugzlys
Programmer
No Magic Lithuanian Development Center
Savanoriu pr. 363- IV, LT-49425, Kaunas
P.O. box 2166, LT-44011, Kaunas
Phone: +370 37 324032 Fax: +370 37 320670
e-mail : tomasp
WWW: http://www.magicdraw.com
--
MagicDraw - UML Made Simple

"Andrew VanderVelde" <avandervelde6> wrote in message
news:du515b$h96$1...
> I am trying to create a new Use Case model element. I have created a
menu
> action that extends DefaultBrowserAction and it can create a new Use
Case
> with the following code:
> UseCase newUseCase = new UseCase(((ModelElement)
> getSelectedObject()).getNameSpace());
> newUseCase.setName("Test");
> ModelElementsManager.getInstance().addModelElement(newUseCase,
> (ModelElement) getSelectedObject());
>
> I would like to add documentation to the use case, however, there is no
> setDocumentation method, only a getDocumentation() method.
> How can I add documentation to the use case?
Tomas Pugzlys
 
Posts Rating:

Re: Adding documentation to ModelElement

Postby Andrew VanderVelde » Wed Mar 08, 2006 2:45 pm

I am using MagicDraw 9.5 and that method does not seem to exist in the 9.5
API. There's a ModelHelper.setCommentName(element, comment, bj) method, but
I'm not sure what to put in the bj argument. What else can I use?


Andrew VanderVelde
 
Posts Rating:

Re: Adding documentation to ModelElement

Postby Tomas Pugzlys » Thu Mar 09, 2006 6:54 am

Hello,

Sorry, it was my mistake. My answer was for MagicDraw 10.x Open API.

For MagicDraw 9.5:

Use getDocumentation() to get documentation.

In order to set a comment the code is the following:
SessionManager.getInstance().createSession("Set comment");

SessionManager.getInstance().addToSession(classA);
classA.sSetCommentName(newName);
SessionManager.getInstance().closeSession();

Regards,
--
Tomas Pugzlys
Programmer
No Magic Lithuanian Development Center
Savanoriu pr. 363- IV, LT-49425, Kaunas
P.O. box 2166, LT-44011, Kaunas
Phone: +370 37 324032 Fax: +370 37 320670
e-mail : tomasp
WWW: http://www.magicdraw.com
--
MagicDraw - UML Made Simple

nntp://news.nomagic.com/nomagic.products.magicdrawuml.openapi wrote:
> I am using MagicDraw 9.5 and that method does not seem to exist in the 9.5
> API. There's a ModelHelper.setCommentName(element, comment, bj) method, but
> I'm not sure what to put in the bj argument. What else can I use?
>

Tomas Pugzlys
 
Posts Rating:


Return to Programmatic Extendibility

Who is online

Users browsing this forum: No registered users and 1 guest