DropTarget.this.control.getDisplay().timerExec(delay, dragOverHeartbeat);
control.getDisplay().timerExec(delay, dragOverHeartbeat);
public DropTarget(Control control, int style) {	super(control, checkStyle(style));	this.control = control;	if (Drag_Motion == null || Drag_Leave == null || Drag_Data_Received == null || Drag_Drop == null) {		 DND.error(DND.ERROR_CANNOT_INIT_DROP);	}	if (control.getData(DROPTARGETID) != null) {		DND.error(DND.ERROR_CANNOT_INIT_DROP);	}	control.setData(DROPTARGETID, this);		byte[] buffer = Converter.wcsToMbcs(null, "drag_motion", true); //$NON-NLS-1$	drag_motion_handler = OS.g_signal_connect(control.handle, buffer, Drag_Motion.getAddress(), 0);	buffer = Converter.wcsToMbcs(null, "drag_leave", true); //$NON-NLS-1$	drag_leave_handler = OS.g_signal_connect(control.handle, buffer, Drag_Leave.getAddress(), 0);	buffer = Converter.wcsToMbcs(null, "drag_data_received", true); //$NON-NLS-1$	drag_data_received_handler = OS.g_signal_connect(control.handle, buffer, Drag_Data_Received.getAddress(), 0);	buffer = Converter.wcsToMbcs(null, "drag_drop", true); //$NON-NLS-1$	drag_drop_handler = OS.g_signal_connect(control.handle, buffer, Drag_Drop.getAddress(), 0);	// Dispose listeners		controlListener = new Listener(){		public void handleEvent(Event event){			if (!DropTarget.this.isDisposed()){				DropTarget.this.dispose();			}		}	};	control.addListener(SWT.Dispose, controlListener);			this.addListener(SWT.Dispose, new Listener(){		public void handleEvent(Event event){			onDispose();		}		});	// Drag under effect	if (control instanceof Tree) {		effect = new TreeDragUnderEffect((Tree)control);	} else if (control instanceof Table) {		effect = new TableDragUnderEffect((Table)control);	} else {		effect = new NoDragUnderEffect(control);	}	dragOverHeartbeat = new Runnable() {		public void run() {			if (DropTarget.this.control.isDisposed() || dragOverStart == 0) return;			long time = System.currentTimeMillis();			int delay = DRAGOVER_HYSTERESIS;			if (time < dragOverStart) {				delay = (int)(dragOverStart - time);			} else {					int allowedOperations = dragOverEvent.operations;				TransferData[] allowedTypes = dragOverEvent.dataTypes;				//pass a copy of data types in to listeners in case application modifies it				TransferData[] dataTypes = new TransferData[allowedTypes.length];				System.arraycopy(allowedTypes, 0, dataTypes, 0, dataTypes.length);					DNDEvent event = new DNDEvent();				event.widget = dragOverEvent.widget;				event.x = dragOverEvent.x;				event.y = dragOverEvent.y;				event.time = (int)time;				event.feedback = DND.FEEDBACK_SELECT;				event.dataTypes = dataTypes;				event.dataType = selectedDataType;				event.operations = dragOverEvent.operations;				event.detail  = selectedOperation;				selectedDataType = null;				selectedOperation = DND.DROP_NONE;				notifyListeners(DND.DragOver, event);				effect.show(event.feedback, event.x, event.y);				if (event.dataType != null) {					for (int i = 0; i < allowedTypes.length; i++) {						if (allowedTypes[i].type == event.dataType.type) {							selectedDataType = event.dataType;							break;						}					}				}				if (selectedDataType != null && (event.detail & allowedOperations) != 0) {					selectedOperation = event.detail;				}			}			DropTarget.this.control.getDisplay().timerExec(delay, dragOverHeartbeat);		}	};}