} }  if (key.equals (ADD_WIDGET_KEY)) { Object [] data = (Object []) value; int  handle = ((LONG) data [0]).value; Widget widget = (Widget) data [1]; if (widget != null) { addWidget (handle, widget); } else { removeWidget (handle);
public void setData (String key, Object value) {	checkDevice ();	if (key == null) error (SWT.ERROR_NULL_ARGUMENT);	if (key.equals (ADD_WIDGET_KEY)) {		Object [] data = (Object [])value;		int /*long*/ handle = ((LONG)data [0]).value;		Widget widget = (Widget)data [1];		if (widget == null) removeWidget (handle);		else addWidget (handle, widget);	}		if (key.equals (DISPATCH_EVENT_KEY)) {		if (value == null || value instanceof int []) {			dispatchEvents = (int []) value;			if (value == null) putGdkEvents ();			return;		}	}	/* Remove the key/value pair */	if (value == null) {		if (keys == null) return;		int index = 0;		while (index < keys.length && !keys [index].equals (key)) index++;		if (index == keys.length) return;		if (keys.length == 1) {			keys = null;			values = null;		} else {			String [] newKeys = new String [keys.length - 1];			Object [] newValues = new Object [values.length - 1];			System.arraycopy (keys, 0, newKeys, 0, index);			System.arraycopy (keys, index + 1, newKeys, index, newKeys.length - index);			System.arraycopy (values, 0, newValues, 0, index);			System.arraycopy (values, index + 1, newValues, index, newValues.length - index);			keys = newKeys;			values = newValues;		}		return;	}		/* Add the key/value pair */	if (keys == null) {		keys = new String [] {key};		values = new Object [] {value};		return;	}	for (int i=0; i<keys.length; i++) {		if (keys [i].equals (key)) {			values [i] = value;			return;		}	}	String [] newKeys = new String [keys.length + 1];	Object [] newValues = new Object [values.length + 1];	System.arraycopy (keys, 0, newKeys, 0, keys.length);	System.arraycopy (values, 0, newValues, 0, values.length);	newKeys [keys.length] = key;	newValues [values.length] = value;	keys = newKeys;	values = newValues;}