Create graphic elements programmatically [message #1386567] |
Wed, 18 June 2014 05:33  |
Eclipse User |
|
|
|
Hi,
I am newbie to papyrus and am trying to create models, diagrams, classes...programmatically.
I have been reading the forum and I got to create the model with this post: http://www.eclipse.org/forums/index.php/t/514308/ and created the diagram by means of commands.
My next step would be to create, for example a element (i.e. a class) graphically. I read the forum and the source code but I didn´t find anything that could help me.
The Developer Guide says something like I can use the UMLViewProvider of a specific diagram to create elements and for that I need to create a UML element first and then use the provider to create the associated view but I am not sure how to do that.
Can anyone help me with this problem? or tell me any other way to do that?
Thanks.
|
|
|
|
|
Re: Create graphic elements programmatically [message #1400588 is a reply to message #1400526] |
Mon, 14 July 2014 08:29   |
Eclipse User |
|
|
|
Hi, Natalia,
Are you looking for the same result as a drag-and-drop operation with
the Control modifier key (on Windows; on Mac it's the Option key)? If
so, then I think you just need to add the value of DND.DROP_COPY to the
drop request's extended data. Something like
request.getExtendedData().put("EVENT_DETAIL", DND.DROP_COPY);
The "EVENT_DETAIL" string is available as a constant in the
CustomizableDropEditPolicy class, but I don't know whether that's a
supported public API.
HTH,
Christian
On 2014-07-14 10:23:00 +0000, Natalia B. said:
> Thanks a lot for your reply.
>
> I created a simple example in my diagram with 2 classes linked by an
> association and each class with one attribute. I was be able to draw
> the classes and association using DropObjectRequest but not the
> attributes inside the classes, but I can see them in the model explorer.
>
> What did I miss? Do I have to do something special for elements inside
> the classes (attributes, operations)?
>
> Thanks in advance.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.26577 seconds