Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Default copy/paste behaviour is overridden
Default copy/paste behaviour is overridden [message #1833216] Wed, 07 October 2020 05:30 Go to next message
Denis Nikiforov is currently offline Denis NikiforovFriend
Messages: 283
Registered: August 2013
Senior Member
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 13:46 Go to previous message
Steve Monnier is currently offline Steve MonnierFriend
Messages: 508
Registered: May 2011
Senior Member
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


Steve Monnier - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
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: Thu Apr 22 03:58:45 GMT 2021

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

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

Back to the top