Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2008, 2010 Matthew Hall and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html Contributors: Matthew Hall - initial API and implementation (bug 194734) Matthew Hall - bugs 195222, 264307, 265561, 301774 Ovidio Mallo - bug 306633 /
 
 
 package org.eclipse.core.internal.databinding.beans;
 
 import java.util.List;
 

Since:
3.3
 
 public class BeanListProperty extends SimpleListProperty {
 	private final Class elementType;

Parameters:
propertyDescriptor
elementType
 
 	public BeanListProperty(PropertyDescriptor propertyDescriptor,
 			Class elementType) {
 		this. = propertyDescriptor;
 		this. = elementType == null ? BeanPropertyHelper
 				.getCollectionPropertyElementType(propertyDescriptor)
 				: elementType;
 	}
 
 	public Object getElementType() {
 		return ;
 	}
 
 	protected List doGetList(Object source) {
 		return asList(BeanPropertyHelper.readProperty(source,
 	}
 
 	private List asList(Object propertyValue) {
 		if (propertyValue == null)
 			return Arrays.asList((Object[]) propertyValue);
 		return (ListpropertyValue;
 	}
 
 	protected void doSetList(Object sourceList listListDiff diff) {
 		doSetList(sourcelist);
 	}
 
 	protected void doSetList(Object sourceList list) {
 		BeanPropertyHelper.writeProperty(source,
 	}
 
 		Object propertyValue = list;
 			Object[] array = (Object[]) Array.newInstance(componentTypelist
 					.size());
 			list.toArray(array);
 			propertyValue = array;
 		}
 		return propertyValue;
 	}
 
 			final ISimplePropertyListener listener) {
 		return new BeanPropertyListener(thislistener) {
 			protected IDiff computeDiff(Object oldValueObject newValue) {
 				return Diffs
 						.computeListDiff(asList(oldValue), asList(newValue));
 			}
 		};
 	}
 
 	public String toString() {
 		String s = BeanPropertyHelper.propertyName() + "[]"//$NON-NLS-1$
		if ( != null)
			s += "<" + BeanPropertyHelper.shortClassName() + ">"//$NON-NLS-1$//$NON-NLS-2$
		return s;
	}
New to GrepCode? Check out our FAQ X