Why ColumnViewerEditorActivationListener isn't called [message #330321] |
Fri, 25 July 2008 06:26  |
Eclipse User |
|
|
|
I have created a TableViewer and register a listener, which isn't called
at all, even when I double click a cell in order to edit it.
tableViewer.getColumnViewerEditor().addEditorActivationListe ner(new
ColumnViewerEditorActivationListener() {
@Override public void
afterEditorActivated(ColumnViewerEditorActivationEvent event) {
}
@Override public void
afterEditorDeactivated(ColumnViewerEditorDeactivationEvent event) {
}
@Override public void
beforeEditorActivated(ColumnViewerEditorActivationEvent event) {
CrudContentProvider.this.beforeEditorActivated(event);
}
@Override public void
beforeEditorDeactivated(ColumnViewerEditorDeactivationEvent event) {
}
});
|
|
|
Re: Why ColumnViewerEditorActivationListener isn't called [message #330322 is a reply to message #330321] |
Fri, 25 July 2008 06:38   |
Eclipse User |
|
|
|
I'm going to explain more in depth my problem.
In my TableViewer, when the user changes the current row, its contents are
validated, and saved. If they aren't correct, the selection is set back
to the edited row.
I do this thru a selection listener:
viewer.addSelectionChangedListener(selChanged = new
ISelectionChangedListener() {
public void selectionChanged(final SelectionChangedEvent event) {
selectionChanged();
}
});
int lastIndex;
Object lastSel;
protected void selectionChanged() {
if (ignoreSel > 0) {
return;
}
ignoreSel++;
try {
IStructuredSelection sel =
(IStructuredSelection)viewer.getSelection();
Object sel1 = sel.getFirstElement();
if (sel1 == lastSel || saveCurrentRow()) {
lastSel = sel1;
lastIndex = viewer.getTable().getSelectionIndex();
} else {
viewer.cancelEditing();
// If we cannot save current row, then come back
viewer.getTable().setSelection(lastIndex);
}
} finally {
ignoreSel--;
}
}
The problem:
One the user double clicks a cell in another row, that cell is activated,
even though I set the selection back to the old row.
How can I stop the activation going to that cell?
Any help will be grealty appreciated.
David Perez wrote:
> I have created a TableViewer and register a listener, which isn't called
> at all, even when I double click a cell in order to edit it.
> tableViewer.getColumnViewerEditor().addEditorActivationListe ner(new
> ColumnViewerEditorActivationListener() {
> @Override public void
> afterEditorActivated(ColumnViewerEditorActivationEvent event) {
> }
> @Override public void
> afterEditorDeactivated(ColumnViewerEditorDeactivationEvent event) {
> }
> @Override public void
> beforeEditorActivated(ColumnViewerEditorActivationEvent event) {
> CrudContentProvider.this.beforeEditorActivated(event);
> }
> @Override public void
> beforeEditorDeactivated(ColumnViewerEditorDeactivationEvent event) {
> }
> });
|
|
|
|
|
|
|
|
Re: Why ColumnViewerEditorActivationListener isn't called [message #330580 is a reply to message #330385] |
Mon, 04 August 2008 08:23  |
Eclipse User |
|
|
|
Please provide a fully running snippet and then file a bug. CC me and
Boris and we'll have a look.
Tom
David Perez schrieb:
> Thanks Boris.
> Yes, I've done so. Otherwise, editing a cell wouldn't work at all.
>
> Boris Bokowski wrote:
>
>> Have you created TableViewerColumn objects and called
>> setEditingSupport on them?
>
>> "David Perez" <craquerpro@yahoo.es> wrote in message
>> news:97d3a0a17f893b9a8b7abf57dc88b011$1@www.eclipse.org...
>>> I have created a TableViewer and register a listener, which isn't
>>> called at all, even when I double click a cell in order to edit it.
>>>
>>> tableViewer.getColumnViewerEditor().addEditorActivationListe ner(new
>>> ColumnViewerEditorActivationListener() {
>>> @Override public void
>>> afterEditorActivated(ColumnViewerEditorActivationEvent event) {
>>> }
>>> @Override public void
>>> afterEditorDeactivated(ColumnViewerEditorDeactivationEvent event) {
>>> }
>>> @Override public void
>>> beforeEditorActivated(ColumnViewerEditorActivationEvent event) {
>>>
>>> CrudContentProvider.this.beforeEditorActivated(event);
>>> }
>>> @Override public void
>>> beforeEditorDeactivated(ColumnViewerEditorDeactivationEvent event) {
>>> }
>>> });
>>>
>
>
--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
|
|
|
Powered by
FUDForum. Page generated in 0.03868 seconds