Mercurial > projects > dwt2
diff org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/internal/swt/LinkObservableValue.d @ 78:0a55d2d5a946
Added file for databinding
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Tue, 14 Apr 2009 11:35:29 +0200 |
parents | |
children | 6be48cf9f95c |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/internal/swt/LinkObservableValue.d Tue Apr 14 11:35:29 2009 +0200 @@ -0,0 +1,49 @@ +/******************************************************************************* + * Copyright (c) 2008 Michael Krauter, Catuno GmbH 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: + * Michael Krauter, Catuno GmbH - initial API and implementation (bug 180223) + *******************************************************************************/ +module org.eclipse.jface.internal.databinding.internal.swt.LinkObservableValue; + +import java.lang.all; + +import org.eclipse.core.databinding.observable.Diffs; +import org.eclipse.jface.internal.databinding.provisional.swt.AbstractSWTObservableValue; +import org.eclipse.swt.widgets.Link; + +/** + * @since 1.2 + * + */ +public class LinkObservableValue : AbstractSWTObservableValue { + + private final Link link; + + /** + * @param link + */ + public this(Link link) { + super(link); + this.link = link; + } + + public void doSetValue(Object value) { + String oldValue = link.getText(); + link.setText(value is null ? "" : value.toString()); //$NON-NLS-1$ + fireValueChange(Diffs.createValueDiff(oldValue, link.getText())); + } + + public Object doGetValue() { + return link.getText(); + } + + public Object getValueType() { + return String.classinfo; + } + +}