|
Re: DND with multiple Transfer Types [message #666467 is a reply to message #666370] |
Wed, 20 April 2011 10:12   |
Eclipse User |
|
|
|
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.
|
|
|
Re: DND with multiple Transfer Types [message #666500 is a reply to message #666467] |
Wed, 20 April 2011 11:33  |
Eclipse User |
|
|
|
Hello Philippe and thanks for your input!
But the "target" is my smartphone Object in the Treeviewer.
The App comes from the TableViewer as you suggested.
Also the SelectedObject is the current selected Smartphone on the Treeviewer.
Maybe you got annother hint?
Greetings from Switzerland!
|
|
|
Powered by
FUDForum. Page generated in 0.23547 seconds