Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » how to design a drag and drop between to containment references(EMF.Edit)
how to design a drag and drop between to containment references [message #1703881] Wed, 05 August 2015 15:03 Go to next message
voiry laurent is currently offline voiry laurentFriend
Messages: 3
Registered: August 2015
Junior Member
Hello,

Can someone help me to desgin a drag and drop between two containment references shared by the same container ?

I want two design this DND between two views : each is displaying one of the two references.

I've tried to use for the target view an EditingDomainDropAdapter with generated item providers. But it is considering the two references as children features for the dragged element and the drop can then be done in the wrong reference.

I've also tried to override generated item providers two only consider the reference viewed in the target view. But in this case the drag and drop command cannot execute because no parent is found for the dragged element.

I've considered too put the item providers adapter factory of the source view in the dragged data, and design an EditingDomainDropAdatper using this factory for building the drag part of the drag an drop command. But it seems to be a big a job...

So I prefer to ask your help to find the wright design for my need.

Best regards,
Laurent
Re: how to design a drag and drop between to containment references [message #1703947 is a reply to message #1703881] Thu, 06 August 2015 04:36 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30553
Registered: July 2009
Senior Member
On 05/08/2015 8:44 PM, voiry laurent wrote:
> Hello,
>
> Can someone help me to desgin a drag and drop between two containment
> references shared by the same container ?
>
> I want two design this DND between two views : each is displaying one
> of the two references.
How did you achieve that result? By modifying the item provider's
getChildrenFeatures(Object)?
>
> I've tried to use for the target view an EditingDomainDropAdapter with
> generated item providers. But it is considering the two references as
> children features for the dragged element and the drop can then be
> done in the wrong reference.
Yes,
org.eclipse.emf.edit.provider.ItemProviderAdapter.getChildFeature(Object, Object)
does that. That's why I ask how you specialized it to show only one of
the features, because if you did it by specializing what's returned by
getChildrenFeatures it should only consider the one reference, and not
both...
>
> I've also tried to override generated item providers two only consider
> the reference viewed in the target view. But in this case the drag and
> drop command cannot execute because no parent is found for the dragged
> element.
I'm not sure specifically what you did, but getChildFeature should
return your desired target feature...
>
> I've considered too put the item providers adapter factory of the
> source view in the dragged data, and design an
> EditingDomainDropAdatper using this factory for building the drag part
> of the drag an drop command. But it seems to be a big a job...
Seems not necessary. I imagine each view has its own specialized item
provider, each returning the desired feature for getChildrenFeatures,
and that all else should just work as a result.
>
> So I prefer to ask your help to find the wright design for my need.
>
> Best regards,
> Laurent
Re: how to design a drag and drop between to containment references [message #1703993 is a reply to message #1703947] Thu, 06 August 2015 12:55 Go to previous messageGo to next message
voiry laurent is currently offline voiry laurentFriend
Messages: 3
Registered: August 2015
Junior Member
Hi Ed,

Thank for your prompt reply.

For displaying the desired reference in each view, I've indeed redefined each itemProvider's getChildrenFeatures(Object) to return the desired feature.

But I cannot use the same itemProviders in the editingDomains provided to their editingDomainViewerDropAdapters. The drop adapter is indeed using the same editingDomain to execute the drag or drop command. But with the redefined itemProvider, the drag cannot execute. As far as I remember, but I'm not sure, it is because no feature where to remove the dragged element is found.

Regards,
Laurent
Re: how to design a drag and drop between to containment references [message #1704182 is a reply to message #1703993] Sat, 08 August 2015 07:20 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30553
Registered: July 2009
Senior Member
Laurent,

Comments below.

On 06/08/2015 2:55 PM, voiry laurent wrote:
> Hi Ed,
> Thank for your prompt reply.
>
> For displaying the desired reference in each view, I've indeed
> redefined each itemProvider's getChildrenFeatures(Object) to return
> the desired feature.
>
> But I cannot use the same itemProviders in the editingDomains provided
> to their editingDomainViewerDropAdapters.
Yes, I see what you mean.
> The drop adapter is indeed using the same editingDomain to execute the
> drag or drop command. But with the redefined itemProvider, the drag
> cannot execute. As far as I remember, but I'm not sure, it is because
> no feature where to remove the dragged element is found.
Specializing
org.eclipse.emf.edit.provider.ItemProviderAdapter.factorRemoveCommand(EditingDomain,
CommandParameter) so that it can still compute the feature from which to
remove seems necessary...
> Regards,
> Laurent
>
Re: how to design a drag and drop between to containment references [message #1705470 is a reply to message #1704182] Sun, 16 August 2015 11:34 Go to previous message
voiry laurent is currently offline voiry laurentFriend
Messages: 3
Registered: August 2015
Junior Member
Thanks Ed,

I will test this solution and give you feedback as soon as possible.

Regards,
Laurent
Previous Topic:[CDO] DBStore and Model Evolution
Next Topic:[CDO] Unmonitored fail-over example
Goto Forum:
  


Current Time: Wed Oct 23 00:07:43 GMT 2019

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

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

Back to the top