Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Why ColumnViewerEditorActivationListener isn't called
Why ColumnViewerEditorActivationListener isn't called [message #330321] Fri, 25 July 2008 06:26 Go to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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: Is this the best place to JFace questions [message #330333 is a reply to message #330322] Fri, 25 July 2008 11:40 Go to previous messageGo to next message
Eclipse UserFriend
I wonder if this is the right forum for JFace questions.
Re: Is this the best place to JFace questions [message #330339 is a reply to message #330333] Fri, 25 July 2008 14:21 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse-news.rizzoweb.com

David Perez wrote:
> I wonder if this is the right forum for JFace questions.
>

Yes, it is.
Re: Why ColumnViewerEditorActivationListener isn't called [message #330357 is a reply to message #330321] Fri, 25 July 2008 23:06 Go to previous messageGo to next message
Eclipse UserFriend
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) {
> }
> });
>
Re: Why ColumnViewerEditorActivationListener isn't called [message #330385 is a reply to message #330357] Mon, 28 July 2008 05:06 Go to previous messageGo to next message
Eclipse UserFriend
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) {
>> }
>> });
>>
Re: Why ColumnViewerEditorActivationListener isn't called [message #330389 is a reply to message #330322] Mon, 28 July 2008 05:41 Go to previous messageGo to next message
Eclipse UserFriend
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 [message #330580 is a reply to message #330385] Mon, 04 August 2008 08:23 Go to previous message
Eclipse UserFriend
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
------------------------------------------------------------ --------
Previous Topic:Default behaviour for find TableItem associated to a TableViewer element
Next Topic:JFace snippet doesn't compile
Goto Forum:
  


Current Time: Thu May 01 14:22:04 EDT 2025

Powered by FUDForum. Page generated in 0.03075 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top