|
Re: DND with multiple Transfer Types [message #666467 is a reply to message #666370] |
Wed, 20 April 2011 14:12 |
BLANC Philippe Messages: 89 Registered: July 2009 |
Member |
|
|
Hi,
Say me if I'm wrong but your problem is just to know both your app object and your smartphone object in the validateDrop method of your dropListener, isn't it?
You want to drag an object "App" from a tableViewer to your treeviewer that contains the list of "Smartphones".
Then you would like to check if the App object is compatible with your Smartphone object.
On your treeviewer, I suppose that you have assigned your own dragSupport as following:
mSmartphoneViewer.addDropSupport(
DND.DROP_MOVE,
new Transfer[]{myTransfer},
myDropListener());
Is your DropListener an instance of org.eclipse.jface.viewers.ViewerDropAdapter? If not, implements this class.
public class MyDropListener extends ViewerDropAdapter{
@Override
public boolean performDrop(Object data) {
...
}
@Override
public boolean validateDrop(Object target, int operation,
TransferData transferType) {
//The target object corresponds to your "App" Object
App myApp = (App) target
// You can get your Smartphone object, you can use the method getSelectedObject()
Smartphone mysmartPhone = (SmartPhone) getSelectedObject
}
}
In this case, your transfert object should be able to convert both Smartphone and App objects.
I hope this will help you.
Regards,
Philippe B.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03883 seconds