// Column 2 holds dropdowns
if (column == 0)
{
// Create the dropdown and add data to it
final CCombo combo = new CCombo(incrementTable, SWT.READ_ONLY);
// for (int i = 0, n = sdps.keySet().size(); i < n; i++)
// {
// combo.add(sdps.keySet().toArray()[i].toString());
// }
for (String key : sdps)
{
if(key.contains("["))
continue;
if (getItemIfPresent(key) == null
|| item.getText(column).equals(key))
{
combo.add(key);
}
}
// Select the previously selected item from the cell
combo.select(combo.indexOf(item.getText(column)));
// Compute the width for the editor
// Also, compute the column width, so that the dropdown fits
editor.minimumWidth = combo.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
if (incrementTable.getColumn(column).getWidth() < editor.minimumWidth)
{
incrementTable.getColumn(column).setWidth(editor.minimumWidth);
}
// Set the focus on the dropdown and set into the editor
combo.setFocus();
editor.setEditor(combo, item, column);
combo.addModifyListener(fListener);
// Add a listener to set the selected item back into the cell
final int col = column;
combo.addSelectionListener(new SelectionAdapter()
{
public void widgetSelected(SelectionEvent event)
{
item.setText(col, combo.getText());
Button a = new Button(incrementTable, SWT.PUSH);
TableEditor editor = new TableEditor(incrementTable);
a.setText("Delete");
a.computeSize(SWT.DEFAULT, incrementTable.getItemHeight());
editor.grabHorizontal = true;
editor.minimumHeight = a.getSize().y;
editor.minimumWidth = a.getSize().x;
editor.setEditor(a, item, 4);
a.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
removeItem(incrementTable, col, e);
}
public void widgetDefaultSelected(SelectionEvent e) {
}
}); // setDirty(true);
// updateLaunchConfigurationDialog();
// They selected an item; end the editing session
combo.dispose();
}
});