|
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 |
Ed Merks Messages: 33216 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
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
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 |
Ed Merks Messages: 33216 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
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Powered by
FUDForum. Page generated in 3.45272 seconds