Пример #1
0
 @Override
 protected CellEditor getCellEditor(Object element) {
   final TextCellEditor result = new TextCellEditor(viewer.getTable());
   result.setValidator(new NumberCellValidator());
   result.addListener(new CellEditorListener(shell, result));
   return result;
 }
  /* (non-Javadoc)
   * @see org.eclipse.jface.viewers.EditingSupport#getCellEditor(java.lang.Object)
   */
  @Override
  protected CellEditor getCellEditor(final Object element) {
    TextCellEditor editor = new TextCellEditor((Composite) getViewer().getControl(), SWT.NONE);
    editor.setValidator(
        new ICellEditorValidator() {

          @Override
          public String isValid(Object value) {
            String desc = (String) value;
            if (desc.length() > 255) {
              return Messages.descTooLong;
            }
            return null;
          }
        });
    return editor;
  }