Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 10:57 Go to next message
Benoit Ries is currently offline Benoit RiesFriend
Messages: 83
Registered: May 2013
Member
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 13:56]

Report message to a 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 14:23 Go to previous messageGo to next message
Maxime Porhel is currently offline Maxime PorhelFriend
Messages: 500
Registered: July 2009
Location: Nantes, France
Senior Member
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


Maxime Porhel - 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 15:10 Go to previous message
Benoit Ries is currently offline Benoit RiesFriend
Messages: 83
Registered: May 2013
Member
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 Mar 08 00:35:25 GMT 2021

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

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

Back to the top