Skip to main content



      Home
Home » Eclipse Projects » Sirius » Default copy/paste behaviour is overridden
Default copy/paste behaviour is overridden [message #1833216] Wed, 07 October 2020 01:30 Go to next message
Eclipse UserFriend
Hi

Default copy/paste tool works fine for my diagrams. I can copy objects between diagrams of the same kind.

However I need to extend it allowing to copy nodes from different diagram kinds. So I define a paste tool, which works fine. But it completely overrides the default paste tool.

Should I redefine the default paste tool for each object kind explicitly? What is a simplest way to do it?
Re: Default copy/paste behaviour is overridden [message #1833657 is a reply to message #1833216] Tue, 20 October 2020 09:46 Go to previous message
Eclipse UserFriend
Hello,

If you copy multiple elements and paste them in a diagram with a paste tool, this tool will be called for each copied element one by one, that will be available in the "copiedElement" variable.
If you intend to copy different types of elements (as in different EClasses from your metamodel), I think it will be easier to have your tool call a service where the type of the argument is EObject. This way in your service, you will be able to handle any kind of copied element and process them as you need. So basically, you first need a model operation "Change context var:copiedElement" and an inner operation that call your service. I did a quick test with a sub operation "Change Context service:test()" and in my service class I have a method with the signature "public void test(EObject container) ". The first argument is always the context. If you want to also use the container variable in the service, you can add it to the arguments.

Best regards,
Steve
Previous Topic:How to reconnect the source of an edge
Next Topic:How to get an element based edge to show across hierarchies
Goto Forum:
  


Current Time: Fri Jun 13 10:31:28 EDT 2025

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

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

Back to the top