Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 6 additions & 15 deletions org.eclipse.wb.core/src/org/eclipse/wb/core/controls/CCombo3.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@

import org.eclipse.draw2d.ColorConstants;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FillLayout;
Expand All @@ -32,8 +30,11 @@
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Widget;

import org.apache.commons.lang3.StringUtils;

/**
* Combo control for {@link PropertyTable} and combo property editors.
*
Expand All @@ -42,7 +43,7 @@
*/
public class CCombo3 extends Composite {
private final long m_createTime = System.currentTimeMillis();
private final CLabel m_text;
private final Text m_text;
private final Button m_arrow;
private final Shell m_popup;
private final Table m_table;
Expand All @@ -58,7 +59,7 @@ public CCombo3(Composite parent, int style) {
addEvents(this, m_comboListener, new int[]{SWT.Dispose, SWT.Move, SWT.Resize});
// create label
{
m_text = new CLabel(this, SWT.NONE);
m_text = new Text(this, SWT.READ_ONLY);
new DefaultControlActionsManager(m_text);
addEvents(m_text, m_textListener, new int[]{
SWT.KeyDown,
Expand Down Expand Up @@ -419,17 +420,9 @@ public void removeAll() {
* Adds new item with given text.
*/
public void add(String text) {
add(text, null);
}

/**
* Adds new item with given text and image.
*/
public void add(String text, Image image) {
checkWidget();
TableItem item = new TableItem(m_table, SWT.NONE);
item.setText(text);
item.setImage(image);
}

/**
Expand Down Expand Up @@ -463,13 +456,11 @@ public void select(int index) {
checkWidget();
if (index == -1) {
m_table.deselectAll();
m_text.setText(null);
m_text.setImage(null);
m_text.setText(StringUtils.EMPTY);
return;
} else {
TableItem item = m_table.getItem(index);
m_text.setText(item.getText());
m_text.setImage(item.getImage());
m_table.select(index);
}
}
Expand Down
Loading