public CellEditor createPropertyEditor(Composite parent) { CellEditor editor = new PathCellEditor(parent); if (getValidator() != null) { editor.setValidator(getValidator()); } return editor; }
/** * The <code>TextPropertyDescriptor</code> implementation of this <code>IPropertyDescriptor</code> * method creates and returns a new <code>TextCellEditor</code>. * * <p>The editor is configured with the current validator if there is one. * * @param parent the parent * @return the cell editor */ public CellEditor createPropertyEditor(Composite parent) { CellEditor editor = new TextCellEditor(parent) { @Override protected Object doGetValue() { String value = (String) super.doGetValue(); if (value == null || value.equals("")) // $NON-NLS-1$ return (Double) null; return new Double(value); } @Override protected void doSetValue(Object value) { if (value == null) super.doSetValue(""); // $NON-NLS-1$ else { Assert.isTrue(text != null && (value instanceof Double)); super.doSetValue(((Double) value).toString()); } } }; editor.setValidator(DoubleCellEditorValidator.instance()); setValidator(DoubleCellEditorValidator.instance()); HelpSystem.bindToHelp(this, editor.getControl()); return editor; }