|
Re: Set Coordinates/Position from Node Creation Tool ? [message #1726632 is a reply to message #1726538] |
Tue, 15 March 2016 09:40 |
Esteban Dugueperoux Messages: 472 Registered: July 2009 |
Senior Member |
|
|
Hi Nikolay,
You can define the location and size of additional created nodes/edges
by using the "CreateView/CreateEdgeView" operation in your creation tool
and calling a java service to use
org.eclipse.sirius.diagram.ui.business.api.view.SiriusLayoutDataManager
API. Sirius will use this singleton to know with which location and size
create the nodes/edges.
After having called CreateView operation to get the DDiagramElement
created, you can call a java service as sub operation (a ChangeContext
for example). And in this java service call :
LayoutData layoutData =
SiriusLayoutDataManager.INSTANCE.getData(createdView, true);
layoutData = new RootLayoutData(layoutData.getTarget(), newLocation,
newSize);
SiriusLayoutDataManager.INSTANCE.addData(layoutData);
Best Regards.
Le 14/03/2016 15:07, Nikolay Manolov a écrit :
> Hi,
>
> Is it possible to set the position of a new element from a Node Creation
> or a generic tool? I have a Node Creation Tool that creates a new
> element instance inside a container and the new element is placed where
> I clicked. I have defined additional behavior to that tool so that if
> you click on an existing node in that container the clicked node is
> replicated. In that case, however, the new node is placed "randomly"
> somewhere on the diagram. I would like, if possible, in addition to
> creating an instance to also create the graphical representation and set
> the position to be where I clicked (on another node inside a container)
> + some offset.
>
> Looked in the Sirius code for anything about setting the position but It
> seems this may be delegated to gmf along with the click event.
>
> So, the question is if it is possible to set/affect the position of a
> graphical representation directly from a Node Creation Tool/Diagram
> Specification. If not, would it be possible from an external JavaAction
> or any other way?
>
> Regards,
> Nik
>
>
--
Esteban Dugueperoux - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04673 seconds