blob: 672524d2d201a2795feed6e3509b32bc78a4b12c (
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
/*******************************************************************************
* Copyright (c) 2009 Oracle. 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:
* Oracle - initial API and implementation
******************************************************************************/
package org.eclipse.jpt.common.ui.internal.utility.swt;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Combo;
/**
* Adapt an SWT {@link Combo} to the list widget expected by
* {@link ListWidgetModelBinding} and the
* drop-down list box expected by {@link DropDownListBoxSelectionBinding}.
*/
final class SWTComboAdapter
extends AbstractListWidgetAdapter<Combo>
implements DropDownListBoxSelectionBinding.DropDownListBox
{
SWTComboAdapter(Combo combo) {
super(combo);
}
// ********** ListWidgetModelBinding.ListWidget implementation **********
public String[] getItems() {
return this.widget.getItems();
}
public void setItem(int index, String item) {
this.widget.setItem(index, item);
}
public void setItems(String[] items) {
this.widget.setItems(items);
}
public void add(String item, int index) {
this.widget.add(item, index);
}
public void remove(int start, int end) {
this.widget.remove(start, end);
}
public void removeAll() {
this.widget.removeAll();
}
// ********** ComboBoxSelectionBinding.ComboBox implementation **********
public void addSelectionListener(SelectionListener listener) {
this.widget.addSelectionListener(listener);
}
public void removeSelectionListener(SelectionListener listener) {
this.widget.removeSelectionListener(listener);
}
public int getSelectionIndex() {
return this.widget.getSelectionIndex();
}
public void select(int index) {
this.widget.select(index);
}
public void deselect(int index) {
this.widget.deselect(index);
}
public void deselectAll() {
this.widget.deselectAll();
}
}
|