use of org.eclipse.nebula.widgets.nattable.edit.config.RenderErrorHandling in project nebula.widgets.nattable by eclipse.
the class TextCellEditor method activateCell.
@Override
protected Control activateCell(final Composite parent, Object originalCanonicalValue) {
this.text = createEditorControl(parent);
// editor is activated by keypress
if (originalCanonicalValue instanceof Character) {
this.text.setText(originalCanonicalValue.toString());
selectText(this.selectionMode != null ? this.selectionMode : EditorSelectionEnum.END);
} else // if there is no initial value, handle the original canonical value to
// transfer it to the text control
{
setCanonicalValue(originalCanonicalValue);
selectText(this.selectionMode != null ? this.selectionMode : EditorSelectionEnum.ALL);
}
if (!isEditable()) {
this.text.setEditable(false);
}
// show an error decoration if this is enabled
this.decorationProvider.createErrorDecorationIfRequired(this.text);
// conversion/validation
if (this.inputConversionErrorHandler instanceof RenderErrorHandling) {
IStyle conversionErrorStyle = this.configRegistry.getConfigAttribute(EditConfigAttributes.CONVERSION_ERROR_STYLE, DisplayMode.EDIT, this.labelStack.getLabels());
((RenderErrorHandling) this.inputConversionErrorHandler).setErrorStyle(conversionErrorStyle);
}
if (this.inputValidationErrorHandler instanceof RenderErrorHandling) {
IStyle validationErrorStyle = this.configRegistry.getConfigAttribute(EditConfigAttributes.VALIDATION_ERROR_STYLE, DisplayMode.EDIT, this.labelStack.getLabels());
((RenderErrorHandling) this.inputValidationErrorHandler).setErrorStyle(validationErrorStyle);
}
// ContentProposalAdapter
if (this.controlContentAdapter != null) {
configureContentProposalAdapter(new ContentProposalAdapter(this.text, this.controlContentAdapter, this.proposalProvider, this.keyStroke, this.autoActivationCharacters));
}
this.text.forceFocus();
return this.text;
}
Aggregations