The "One Laptop Per Child" project has a great device ready to ship, but there's no Java on there. Let's think about working together to put Java on OLPC!
Re: Why ColumnViewerEditorActivationListener isn't called
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.
3.At 11:06 PM
on Jul 25, 2008,
Boris Bokowski
wrote:
Re: Why ColumnViewerEditorActivationListener isn't called
Have you created TableViewerColumn objects and called setEditingSupport on
them?
"David Perez"
wrote in message
news:97d3a0a17f893b9a8b7abf57dc88b011$1 at www dot eclipse dot 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().addEditorActivationListener(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
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"
wrote in message
> news:97d3a0a17f893b9a8b7abf57dc88b011$1 at www dot eclipse dot 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().addEditorActivationListener(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
If necessary, I can provide a full example.
David Perez wrote:
> 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?
Re: Why ColumnViewerEditorActivationListener isn't called
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"
wrote in message
>> news:97d3a0a17f893b9a8b7abf57dc88b011$1 at www dot eclipse dot 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().addEditorActivationListener(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
--------------------------------------------------------------------
Why ColumnViewerEditorActivationListener isn't called
At 6:26 AM on Jul 25, 2008, David Perez wrote:
at all, even when I double click a cell in order to edit it.
tableViewer.getColumnViewerEditor().addEditorActivationListener(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) {
}
});
7 replies so far (
Post your own)
Re: Why ColumnViewerEditorActivationListener isn't called
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().addEditorActivationListener(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: Is this the best place to JFace questions
I wonder if this is the right forum for JFace questions.Re: Is this the best place to JFace questions
David Perez wrote:> I wonder if this is the right forum for JFace questions.
>
Yes, it is.
Re: Why ColumnViewerEditorActivationListener isn't called
Have you created TableViewerColumn objects and called setEditingSupport onthem?
"David Perez" wrote in message
news:97d3a0a17f893b9a8b7abf57dc88b011$1 at www dot eclipse dot 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().addEditorActivationListener(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
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" wrote in message
> news:97d3a0a17f893b9a8b7abf57dc88b011$1 at www dot eclipse dot 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().addEditorActivationListener(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
If necessary, I can provide a full example.David Perez wrote:
> 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.
Re: Why ColumnViewerEditorActivationListener isn't called
Please provide a fully running snippet and then file a bug. CC me andBoris 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" wrote in message
>> news:97d3a0a17f893b9a8b7abf57dc88b011$1 at www dot eclipse dot 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().addEditorActivationListener(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
--------------------------------------------------------------------