01: /*******************************************************************************
02: * Copyright (c) 2005, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.jface.internal.databinding.internal.swt;
11:
12: import org.eclipse.jface.databinding.swt.SWTObservables;
13: import org.eclipse.swt.widgets.Combo;
14:
15: /**
16: * @since 3.2
17: *
18: */
19: public class ComboObservableList extends SWTObservableList {
20:
21: private final Combo combo;
22:
23: /**
24: * @param combo
25: */
26: public ComboObservableList(Combo combo) {
27: super (SWTObservables.getRealm(combo.getDisplay()));
28: this .combo = combo;
29: }
30:
31: protected int getItemCount() {
32: return combo.getItemCount();
33: }
34:
35: protected void setItems(String[] newItems) {
36: combo.setItems(newItems);
37: }
38:
39: protected String[] getItems() {
40: return combo.getItems();
41: }
42:
43: protected String getItem(int index) {
44: return combo.getItem(index);
45: }
46:
47: protected void setItem(int index, String string) {
48: combo.setItem(index, string);
49: }
50: }
|