@Override public CellEditor createPropertyEditor(Composite parent) { DialogCellEditor cellEditor = new SqlAreaDialogCellEditor(parent); // DialogCellEditor cellEditor = new SqlSetDialogCellEditor(parent); if (getValidator() != null) { cellEditor.setValidator(getValidator()); } return cellEditor; }
public CellEditor createPropertyEditor(Composite parent) { DialogCellEditor cellEditor = new CTableDialogCellEditor(parent); // DialogCellEditor cellEditor = new SqlSetDialogCellEditor(parent); if (getValidator() != null) { cellEditor.setValidator(getValidator()); } return cellEditor; }
public Control construct(Composite section) { GridLayoutFactory.swtDefaults().numColumns(1).applyTo(section); final Table table = new Table(section, SWT.BORDER | SWT.FULL_SELECTION); final TableViewer v = new TableViewer(table); final MyCellModifier modifier = new MyCellModifier(v); TableColumn column = new TableColumn(table, SWT.NONE); column.setWidth(200); v.setLabelProvider(new LabelProvider()); v.setContentProvider(new MyContentProvider()); v.setCellModifier(modifier); v.setColumnProperties(new String[] { "column1" }); v.setCellEditors(new CellEditor[] { new DialogCellEditor(table) { protected Object openDialogBox(Control cellEditorWindow) { Object oldValue = getValue(); Dialog dialog = new Dialog(cellEditorWindow.getShell()) { protected Control createContents(Composite parent) { Label l = new Label(parent, SWT.NONE); l.setText("Please presse OK to add 1 to cell value"); return super.createContents(parent); } }; int open = dialog.open(); if (open == Dialog.OK) { return Integer.valueOf((((Integer) oldValue).intValue() + 1)); } return oldValue; } } }); MyModel[] model = createModel(); v.setInput(model); v.getTable().setLinesVisible(true); GridDataFactory.fillDefaults().grab(true, true).applyTo(table); return table; }