Skip to main content



      Home
Home » Eclipse Projects » Sirius » How to create programmatically a new representation element on a diagram representation
How to create programmatically a new representation element on a diagram representation [message #1722027] Tue, 02 February 2016 05:57 Go to next message
Eclipse UserFriend
Hi,

I looked for an API method to create a new representation element on a diagram representation given an existing semantic element (EObject) but could not find any.


How can I do that programmatically ?

many thanks in advance for any hints,
Benoît

[Updated on: Tue, 02 February 2016 08:56] by Moderator

Re: How to create programmatically a new view on a diagram representation [message #1722059 is a reply to message #1722027] Tue, 02 February 2016 09:23 Go to previous messageGo to next message
Eclipse UserFriend
Hi Benoit,

Le 02/02/2016 11:57, Benoit Ries a écrit :
> Hi,
>
> I looked for an API method to create a new view on a diagram
> representation given an existing semantic element (EObject) but could
> not find any.
> How can I do that programmatically ?

Note that this will produce no effect if your are in auto-refresh, with
a synchronized mapping (ie mapping configured as synchronized or
configured as unsynchonizable with the diagram set to synchronized). In
this configuration the element you might want to create will already be
on the diagram and the auto refresh will remove the doublons.


But for an unsynchonized mapping (ie mapping configured as
unsynchronized or configured as unsynchonizable with the diagram set to
unsynchronized), you might want to programmaticaly create a view for a
knwon mapping and a specific domain object. (You might also want to call
a tool, but this might be answered in another thread).

I think you should try to instantiate and execute
org.eclipse.sirius.diagram.tools.api.command.view.CreateDDiagramElementCommand.CreateDDiagramElementCommand(TransactionalEditingDomain,
EObject, AbstractNodeMapping, DragAndDropTarget) (or its pendant edge
specific constructor)

Note that if your domain object is not in the result of the mapping
semantic candidates filtered by the domain class and the precondition,
the view you create should be removed by the refresh done in precommit
or by the next refresh (manual refresh mode)


>
> many thanks in advance for any hints,
> Benoît
>
>

Regards

--
Maxime - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: How to create programmatically a new view on a diagram representation [message #1722068 is a reply to message #1722059] Tue, 02 February 2016 10:10 Go to previous message
Eclipse UserFriend
Yes, this question is in the context of an unsynchronized mapping.

Thanks Maxime, this is exactly what I was looking for !

regards,
Benoît
Previous Topic:Plastic Manufacturing Modelling Tool Source Code
Next Topic:Drop-down list in table cell editor
Goto Forum:
  


Current Time: Mon Jul 14 21:11:29 EDT 2025

Powered by FUDForum. Page generated in 0.04456 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top