78
|
1 /*******************************************************************************
|
|
2 * Copyright (c) 2008 Michael Krauter, Catuno GmbH and others.
|
|
3 * All rights reserved. This program and the accompanying materials
|
|
4 * are made available under the terms of the Eclipse Public License v1.0
|
|
5 * which accompanies this distribution, and is available at
|
|
6 * http://www.eclipse.org/legal/epl-v10.html
|
|
7 *
|
|
8 * Contributors:
|
|
9 * Michael Krauter, Catuno GmbH - initial API and implementation (bug 180223)
|
|
10 *******************************************************************************/
|
|
11 module org.eclipse.jface.internal.databinding.internal.swt.LinkObservableValue;
|
|
12
|
|
13 import java.lang.all;
|
|
14
|
|
15 import org.eclipse.core.databinding.observable.Diffs;
|
|
16 import org.eclipse.jface.internal.databinding.provisional.swt.AbstractSWTObservableValue;
|
|
17 import org.eclipse.swt.widgets.Link;
|
|
18
|
|
19 /**
|
|
20 * @since 1.2
|
|
21 *
|
|
22 */
|
|
23 public class LinkObservableValue : AbstractSWTObservableValue {
|
|
24
|
|
25 private final Link link;
|
|
26
|
|
27 /**
|
|
28 * @param link
|
|
29 */
|
|
30 public this(Link link) {
|
|
31 super(link);
|
|
32 this.link = link;
|
|
33 }
|
|
34
|
|
35 public void doSetValue(Object value) {
|
|
36 String oldValue = link.getText();
|
|
37 link.setText(value is null ? "" : value.toString()); //$NON-NLS-1$
|
|
38 fireValueChange(Diffs.createValueDiff(oldValue, link.getText()));
|
|
39 }
|
|
40
|
|
41 public Object doGetValue() {
|
|
42 return link.getText();
|
|
43 }
|
|
44
|
|
45 public Object getValueType() {
|
|
46 return String.classinfo;
|
|
47 }
|
|
48
|
|
49 }
|