ViewerDropAdapter dropAdapter = new ViewerDropAdapter(fViewer) {
@Override
public boolean validateDrop(final Object target, int operation, TransferData transferType) {
if (LocalSelectionTransfer.getTransfer().isSupportedType(transferType)) {
final boolean[] result = new boolean[] { false };
SafeRunner.run(new LoggingSafeRunnable() {
public void run() throws Exception {
ISelection selection = LocalSelectionTransfer.getTransfer().getSelection();
if (selection instanceof IStructuredSelection) {
List<?> draggedObjects = ((IStructuredSelection) selection).toList();
result[0] = isValidDrop(draggedObjects, target);
}
}
});
return result[0];
}
return false;
}
@Override
public boolean performDrop(final Object data) {
if (data instanceof IStructuredSelection) {
SafeRunner.run(new LoggingSafeRunnable() {
public void run() throws Exception {
IStructuredSelection selection = (IStructuredSelection) data;
List<?> draggedObjects = selection.toList();
perfromDrop(draggedObjects, getCurrentTarget());
}