TextCellEditor does not show edited content [message #1467760] |
Mon, 10 November 2014 09:35 |
Andrea Richiardi Messages: 64 Registered: August 2012 |
Member |
|
|
My implementation of a TextCellEditor is the following, also adding a KeyListener:
fHoverTableViewerTextCellEditor = new TextCellEditor(fHoverTableViewer.getTable());
fHoverTableViewerTextCellEditor.getControl().addKeyListener(new KeyListener() {
private boolean isPressedKeyModifier = false;
private boolean isStateKeyModifier = false;
public void keyPressed(KeyEvent e) {
isPressedKeyModifier = e.keyCode > 0 && e.character == 0 && (e.keyCode & SWT.MODIFIER_MASK) != 0;
isStateKeyModifier = e.stateMask > 0 && (e.stateMask & SWT.MODIFIER_MASK) != 0;
String insertString = null;
String modifierString = Action.findModifierString(e.keyCode);
String modifierMask = Action.findModifierString(e.stateMask);
if (isPressedKeyModifier) {
insertString = Action.findModifierString(e.keyCode);
if (isStateKeyModifier) {
insertString= java.text.MessageFormat.format(Messages.HoverPreferencePage_insertModifierAndDelimiterAndModifier,
new Object[] { Action.findModifierString(e.keyCode), Action.findModifierString(e.stateMask) });
}
fHoverTableViewerTextCellEditor.setValue(insertString);
}
}
And then I bind:
fModifierTableViewerColumn.setEditingSupport(ObservableValueEditingSupport.create(fHoverTableViewer, context,
fHoverTableViewerTextCellEditor,
CellEditorProperties.control().value(WidgetProperties.text(SWT.Modify)),
HoverViewModel.getEditingDomain()));
But when I press enter I cannot see my content, or better, if I click again on the Cell, it shows my content, but it dies not show it after the "Editing" context is over.
What am I missing?
|
|
|
Re: TextCellEditor does not show edited content [message #1467783 is a reply to message #1467760] |
Mon, 10 November 2014 09:56 |
Thomas Schindl Messages: 6651 Registered: July 2009 |
Senior Member |
|
|
You need to call viewer.update(Object,null) after you modified the value.
On 10.11.14 10:35, Andrea Richiardi wrote:
> My implementation of a TextCellEditor is the following, also adding a
> KeyListener:
>
>
> fHoverTableViewerTextCellEditor = new
> TextCellEditor(fHoverTableViewer.getTable());
> fHoverTableViewerTextCellEditor.getControl().addKeyListener(new
> KeyListener() {
>
> private boolean isPressedKeyModifier = false;
> private boolean isStateKeyModifier = false;
>
> public void keyPressed(KeyEvent e) {
> isPressedKeyModifier = e.keyCode > 0 && e.character == 0
> && (e.keyCode & SWT.MODIFIER_MASK) != 0;
> isStateKeyModifier = e.stateMask > 0 && (e.stateMask &
> SWT.MODIFIER_MASK) != 0;
>
> String insertString = null;
>
> String modifierString =
> Action.findModifierString(e.keyCode);
> String modifierMask =
> Action.findModifierString(e.stateMask);
>
> if (isPressedKeyModifier) {
> insertString = Action.findModifierString(e.keyCode);
>
> if (isStateKeyModifier) {
> insertString=
> java.text.MessageFormat.format(Messages.HoverPreferencePage_insertModifierAndDelimiterAndModifier,
>
> new Object[] {
> Action.findModifierString(e.keyCode),
> Action.findModifierString(e.stateMask) });
>
> }
>
> fHoverTableViewerTextCellEditor.setValue(insertString);
> }
> }
>
>
> And then I bind:
> fModifierTableViewerColumn.setEditingSupport(ObservableValueEditingSupport.create(fHoverTableViewer,
> context,
> fHoverTableViewerTextCellEditor,
>
> CellEditorProperties.control().value(WidgetProperties.text(SWT.Modify)),
> HoverViewModel.getEditingDomain()));
>
> But when I press enter I cannot see my content, or better, if I click
> again on the Cell, it shows my content, but it dies not show it after
> the "Editing" context is over.
>
> What am I missing?
>
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03726 seconds