Example usage for org.eclipse.jface.viewers DialogCellEditor setValidator

List of usage examples for org.eclipse.jface.viewers DialogCellEditor setValidator

Introduction

In this page you can find the example usage for org.eclipse.jface.viewers DialogCellEditor setValidator.

Prototype

public void setValidator(ICellEditorValidator validator) 

Source Link

Document

Sets the input validator for this cell editor.

Usage

From source file:com.cisco.yangide.ext.model.editor.property.DialogTextPropertyDescriptor.java

License:Open Source License

public DialogCellEditor createPropertyEditor(Composite parent) {
    DialogCellEditor editor = new DialogCellEditor(parent) {

        @Override/*  ww  w  .  j  a  v  a  2  s  .  c  o  m*/
        protected Object openDialogBox(Control cellEditorWindow) {
            Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
            MultilineTextDialog dialog = new MultilineTextDialog(shell, Strings.getAsString(getValue()),
                    id.getName());
            if (IStatus.OK == dialog.open()) {
                setValue(dialog.getValue());
            }
            return null;
        }

    };
    if (getValidator() != null) {
        editor.setValidator(getValidator());
    }
    return editor;
}