Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: f6ac1a0dbacca99e65f04f6cb846fbf30e0577c2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*******************************************************************************
 * Copyright (c) 2008, 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 194734)
 *     Matthew Hall - bugs 195222, 251611, 263413, 265561
 ******************************************************************************/

package org.eclipse.jface.internal.databinding.swt;

import java.util.Arrays;
import java.util.List;

import org.eclipse.core.databinding.observable.list.ListDiff;
import org.eclipse.core.databinding.property.INativePropertyListener;
import org.eclipse.core.databinding.property.ISimplePropertyListener;
import org.eclipse.jface.databinding.swt.WidgetListProperty;
import org.eclipse.swt.widgets.Control;

/**
 * @since 3.3
 * 
 */
public abstract class ControlStringListProperty extends WidgetListProperty {
	public Object getElementType() {
		return String.class;
	}

	protected void doSetList(Object source, List list, ListDiff diff) {
		String[] strings = (String[]) list.toArray(new String[list.size()]);
		doSetStringList((Control) source, strings, diff);
	}

	abstract void doSetStringList(Control control, String[] list, ListDiff diff);

	protected List doGetList(Object source) {
		String[] list = doGetStringList((Control) source);
		return Arrays.asList(list);
	}

	abstract String[] doGetStringList(Control control);

	public INativePropertyListener adaptListener(
			ISimplePropertyListener listener) {
		return null;
	}
}

Back to the top