Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Sirius Copy/Paste nodes (elements)(Copy/Paste for some elements works for some does not.)
Sirius Copy/Paste nodes (elements) [message #1774607] Tue, 17 October 2017 17:21 Go to next message
Roman Rutsevich is currently offline Roman RutsevichFriend
Messages: 11
Registered: June 2017
Junior Member
Hello!
I've got an awkward question about Sirius copy/paste possibility:
I have some nodes (element) on Palette view. Part of them can be copied/pasted and some of them can be just copied, after some research didn't get much except of that in source class SiriusClipboardGlobalActionHandler override methods "canHandle" and "canPaste" return "false" in case of "paste" command, so for some elements "paste" is not called at all.
I tried to use "New Element Edition" -> "Paste" in .odesign file. Paste command is started calling for other elements (it overlaps standard paste command for all elements and for SiriusClipboardGlobalActionHandler methods mentioned above return "true"), but still not working as i need (I use "service:method" in "Change Context" and return the copiedElement in this method).

Could you be please so kind to give me a hint what I do wrong and share your experience about that, may be someone bumped into issue like this as well.

Thank you very much in advance!
Sincerely, Roma.

[Updated on: Tue, 17 October 2017 20:48]

Report message to a moderator

Re: Sirius Copy/Paste nodes (elements) [message #1774635 is a reply to message #1774607] Wed, 18 October 2017 07:25 Go to previous messageGo to next message
Maxime Porhel is currently offline Maxime PorhelFriend
Messages: 482
Registered: July 2009
Location: Nantes, France
Senior Member
Hi Roman,

Documentation reminder (from https://www.eclipse.org/sirius/doc/specifier/diagrams/Diagrams.html#tools)
Quote:

Paste
The paste tool aims to define operations to paste the given copied semantic element, accessible through the copiedElement variable, into the semantic paste receiver, accessible through the container variable. The copiedView and containerView variables reference the corresponding graphical element. The Containers property indicates the mappings to which this tool apply.

Its semantic target is the copied semantic element. If the copied element was a non domain based element (e.g. relation edge), the semantic element is the original except if it is targeted by a domain based element also selected. When the semantic target is not copied, the tool receive a null copied element.

Warning: The generic behavior is used only when there is no tool defined on the paste receiver. Otherwise the first tool with a precondition evaluated as true will be chosen and if all defined tools have a false precondition, paste action will be disabled.


When the user use the copy action from a Sirius diagram, the selected diagram elements and their semantic targets are copied in the Sirius clipboard.
When the user later uses the paste action, the clipboard is copied (to be sure it will not be modified by the tool, to allow several use of the paste tools in the same or in an other Sirius session and avoid unexpected resource adds in other resourceSets)

If there is no paste tool, we call the EMF paste command which will try to find containment reference on the selected semantic element to paste the semantic elements from the clipboard. (The graphical elements are copied, but are not used, Sirius will creates new graphical elements from the target representation description)

If there is a paste tool, it is its responsability to take the copied elements and attach them in/around the target elements. Pay attention to references between copied elements if you want to put only a subpart in the model (you should avoid dangling references).

I do not understand why you speak about palette view and copy/paste: in the palette Sirius will put the tools defined in your VSM (creation tools, wizards, ...) , you will use them to add content on the diagram but you cannot copy/paste the tools in runtime.

Regards


Maxime Porhel - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius

Join the Sirius community at SiriusCon. Register for free: Nov. 9th Paris
http://www.siriuscon.org/
Re: Sirius Copy/Paste nodes (elements) [message #1775215 is a reply to message #1774635] Thu, 26 October 2017 11:53 Go to previous message
Roman Rutsevich is currently offline Roman RutsevichFriend
Messages: 11
Registered: June 2017
Junior Member
Thank you for the answer and information, Maxime Porhel!

Sincerely, Roma.
Previous Topic:Select Model Element Variable
Next Topic:[Sirius] generate the representations.aird in XML file
Goto Forum:
  


Current Time: Fri Apr 03 11:31:39 GMT 2020

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

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

Back to the top