Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Can man edit DDiagram programmatically?
icon1.gif  Can man edit DDiagram programmatically? [message #1691309] Sun, 05 April 2015 12:17 Go to next message
Minh Hiep Pham is currently offline Minh Hiep PhamFriend
Messages: 10
Registered: February 2015
Location: Hannover, Germany
Junior Member
Hi guys,

i want to create a new element in my current opened Diagram Editor, when i click a button in the toolbar menu of eclipse or a new double click command! I don't want to use section tools, so there is anyway to do that? For example my current DDiagram contains 5 Node (Node1, Node2, Node3, Node4, Node5). And now i want to create e new button, which will create a new Edge between Node2 and Node5 when Diagram is opened. Thanks so much for your help.


Regards,


Minh Hiep Pham
Re: Can man edit DDiagram programmatically? [message #1691426 is a reply to message #1691309] Tue, 07 April 2015 08:21 Go to previous messageGo to next message
Maxime Porhel is currently offline Maxime PorhelFriend
Messages: 516
Registered: July 2009
Location: Nantes, France
Senior Member
Hi Minh,

Le 05/04/2015 14:17, Minh Hiep Pham a écrit :
> Hi guys,

> i want to create a new element in my current opened Diagram Editor, when
> i click a button in the toolbar menu of eclipse or a new double click
> command!

Did you try the Double click tool [1], which will allow you to specify
some action to trigger when you double-click on a node ?

I don't want to use section tools, so there is anyway to do
> that? For example my current DDiagram contains 5 Node (Node1, Node2,
> Node3, Node4, Node5).


And now i want to create e new button, which will
> create a new Edge between Node2 and Node5 when Diagram is opened. Thanks
> so much for your help.

Did you try the Edge Creation tool [2], which will allow you to click on
the source and then the target of the nodes you want to rely with an edge ?


Regards

--
Maxime - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius
--
[1]https://www.eclipse.org/sirius/doc/specifier/diagrams/Diagrams.html#double_click_tool
[2]https://www.eclipse.org/sirius/doc/specifier/diagrams/Diagrams.html#edge_tools


Maxime Porhel - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Can man edit DDiagram programmatically? [message #1725135 is a reply to message #1691426] Tue, 01 March 2016 08:01 Go to previous messageGo to next message
Nguyen Xuan Nhan is currently offline Nguyen Xuan NhanFriend
Messages: 11
Registered: February 2016
Junior Member
Hi Maxime,
I've the same question, can we create edge between 2 element, programmatically? Not using edge creation tool

[quote title=Maxime Porhel wrote on Tue, 07 April 2015 08:21]Hi Minh,

Le 05/04/2015 14:17, Minh Hiep Pham a écrit :
> Hi guys,

> i want to create a new element in my current opened Diagram Editor, when
> i click a button in the toolbar menu of eclipse or a new double click
> command!

Did you try the Double click tool [1], which will allow you to specify
some action to trigger when you double-click on a node ?

I don't want to use section tools, so there is anyway to do
> that? For example my current DDiagram contains 5 Node (Node1, Node2,
> Node3, Node4, Node5).


And now i want to create e new button, which will
> create a new Edge between Node2 and Node5 when Diagram is opened. Thanks
> so much for your help.

Did you try the Edge Creation tool [2], which will allow you to click on
the source and then the target of the nodes you want to rely with an edge ?
Re: Can man edit DDiagram programmatically? [message #1725145 is a reply to message #1725135] Tue, 01 March 2016 09:07 Go to previous message
Laurent Fasani is currently offline Laurent FasaniFriend
Messages: 182
Registered: October 2014
Senior Member
Hello


Note that if you create directly sirius model like node or edges, they
will dissapear at next refresh.
I advise you to create first the mapping that will represent your
semantic model and second to do the semantic model changes.

For the latter, as Maxime suggested, the best way is indeed to use a
tool to change your model. If your tool is not specific to a node or
edge creation you can use a Generic tool [1] which will call a java
service [2]

Perhaps, you have good reasons to not use a sirius tool. Then you can
create a action in sirius tabbar [3].
If you don't use a sirius tool, don't forget to change your model
through an EMF command as described below.
session.getTransactionalEditingDomain().getCommandStack().execute(new
RecordingCommand(session.getTransactionalEditingDomain()) {
@Override
protected void doExecute() {
//make your changes;
}
});

Regards
Laurent

[1]
http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.sirius.doc%2Fdoc%2Fspecifier%2Fdiagrams%2FDiagrams.html&cp=69_2_1&anchor=tools_specification
[2]
http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.sirius.doc%2Fdoc%2Fspecifier%2Fgeneral%2FWriting_Queries.html&cp=69_2_8_7&anchor=service_methods
[3]
http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.sirius.doc%2Fdoc%2Fdeveloper%2Fextensions-provide_tabbar_extensions.html&cp=69_3_3_5

Le 01/03/2016 09:02, Nguyen Xuan Nhan a écrit :
> Hi Maxime,
> I've the same question, can we create edge between 2 element,
> programmatically? Not using edge creation tool
>
> [quote title=Maxime Porhel wrote on Tue, 07 April 2015 08:21]Hi Minh,
>
> Le 05/04/2015 14:17, Minh Hiep Pham a écrit :
>> Hi guys,
>
>> i want to create a new element in my current opened Diagram Editor, when
>> i click a button in the toolbar menu of eclipse or a new double click
>> command!
>
> Did you try the Double click tool [1], which will allow you to specify
> some action to trigger when you double-click on a node ?
>
> I don't want to use section tools, so there is anyway to do
>> that? For example my current DDiagram contains 5 Node (Node1, Node2,
>> Node3, Node4, Node5).
>
>
> And now i want to create e new button, which will
>> create a new Edge between Node2 and Node5 when Diagram is opened. Thanks
>> so much for your help.
>
> Did you try the Edge Creation tool [2], which will allow you to click on
> the source and then the target of the nodes you want to rely with an edge ?


Laurent Fasani - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Previous Topic:Edge Customization Smoothness
Next Topic:Diagram refresh problem
Goto Forum:
  


Current Time: Thu Apr 25 05:44:29 GMT 2024

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

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

Back to the top