Package org.eclipse.core.databinding

Examples of org.eclipse.core.databinding.BindingException


  public Object remove(int index) {
    getterCalled();
    int size = doGetSize();
    if (index < 0 || index > size - 1)
      throw new BindingException(
          "Request to remove an element out of the collection bounds"); //$NON-NLS-1$

    String[] newItems = new String[size - 1];
    String oldElement = getItem(index);
    if (newItems.length > 0) {
View Full Code Here


   * @see org.eclipse.jface.binding.converter.IConverter#convert(java.lang.Object)
   */
  public Object convert(Object source) {
    if (toType.isPrimitive()) {
      if (source == null) {
        throw new BindingException("Cannot convert null to a primitive"); //$NON-NLS-1$
      }
    }
    if (source != null) {
      Class sourceClass = source.getClass();
      if (toType.isPrimitive() || sourceClass.isPrimitive()) {
        if (sourceClass.equals(toType)
            || isPrimitiveTypeMatchedWithBoxed(sourceClass, toType)) {
          return source;
        }
        throw new BindingException(
            "Boxed and unboxed types do not match"); //$NON-NLS-1$
      }
      if (!toType.isAssignableFrom(sourceClass)) {
        throw new BindingException(sourceClass.getName()
            + " is not assignable to " + toType.getName()); //$NON-NLS-1$
      }
    }
    return source;
  }
View Full Code Here

   * @see org.eclipse.jface.binding.converter.IConverter#convert(java.lang.Object)
   */
  public Object convert(Object source) {
    if (toType.isPrimitive()) {
      if (source == null) {
        throw new BindingException("Cannot convert null to a primitive"); //$NON-NLS-1$
      }
    }
    if (source != null) {
      Class sourceClass = source.getClass();
      if (toType.isPrimitive() || sourceClass.isPrimitive()) {
        if (sourceClass.equals(toType)
            || isPrimitiveTypeMatchedWithBoxed(sourceClass, toType)) {
          return source;
        }
        throw new BindingException(
            "Boxed and unboxed types do not match"); //$NON-NLS-1$
      }
      if (!toType.isAssignableFrom(sourceClass)) {
        throw new BindingException(sourceClass.getName()
            + " is not assignable to " + toType.getName()); //$NON-NLS-1$
      }
    }
    return source;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.core.databinding.BindingException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.