/******************************************************************************* * Copyright (c) 2009 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 264286) *******************************************************************************/ package org.eclipse.jface.internal.databinding.swt; import org.eclipse.core.databinding.property.value.IValueProperty; import org.eclipse.swt.custom.CLabel; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Item; import org.eclipse.swt.widgets.Label; /** * @since 3.3 * */ public class WidgetImageProperty extends WidgetDelegatingValueProperty { private IValueProperty button = new ButtonImageProperty(); private IValueProperty cLabel = new CLabelImageProperty(); private IValueProperty item = new ItemImageProperty(); private IValueProperty label = new LabelImageProperty(); /** * */ public WidgetImageProperty() { super(Image.class); } protected IValueProperty doGetDelegate(Object source) { if (source instanceof Button) return button; if (source instanceof CLabel) return cLabel; if (source instanceof Item) return item; if (source instanceof Label) return label; throw notSupported(source); } }