| TableEditor and dispose [message #372576] |
Wed, 13 August 2003 05:38  |
Eclipse User |
|
|
|
Originally posted by: sven.knop.versant.com
Hi
I am new to SWT and came across the following problem (bare with me, this
will get a bit lengthy):
I am trying to add an editor to a table, which works fine. The editor is of
type Combo. In the example for the editor, the editor will get disposed when
a new editor gets created, something like
Control oldEditor = editor.getEditor()
if (oldEditor != null) oldEditor.dispose()
This works as well, but is not very pretty, especially if I want to add
sorting of columns and even after pressing the column header I still have
the editor in place. So I thought I would be clever and added this code:
Listener comboListener = new Listener() {
public void handleEvent(Event event) {
switch(event.type) {
case SWT.FocusOut:
item.setText(2, categories[combo.getSelectionIndex()]);
editor.getEditor().dispose();
break;
case SWT.Traverse:
switch(event.detail) {
case SWT.TRAVERSE_RETURN:
item.setText(2, categories[combo.getSelectionIndex()]);
// fall through
case SWT.TRAVERSE_ESCAPE:
editor.getEditor().dispose();
event.doit = false;
}
break;
}
}
};
combo.addListener (SWT.FocusOut, comboListener);
combo.addListener (SWT.Traverse, comboListener);
To my surprise, when I loose focus or tab out of the editor -->> Eclipse
crashes! The JVM falls over, without leaving any hint in the .log file.
Is there something I did wrong or is this a bug? The code is a variation an
a theme I found in the documented examples on the eclipse.org site.
This is
Eclipse 2.1.1
Windows XP SP1
SUN JVM 1.4.2
Any ideas?
Sven Erik Knop
Principal Consultant
Versant
|
|
|
| Re: TableEditor and dispose [message #372619 is a reply to message #372576] |
Fri, 15 August 2003 05:10   |
Eclipse User |
|
|
|
Originally posted by: sven.knop.versant.com
Noone interested in replying to this question? Is this the wrong forum for
bugs?
"Sven Erik Knop" <sven.knop@versant.com> wrote in message
news:bhd0sv$8h6$1@eclipse.org...
> Hi
>
> I am new to SWT and came across the following problem (bare with me, this
> will get a bit lengthy):
>
> I am trying to add an editor to a table, which works fine. The editor is
of
> type Combo. In the example for the editor, the editor will get disposed
when
> a new editor gets created, something like
>
> Control oldEditor = editor.getEditor()
> if (oldEditor != null) oldEditor.dispose()
>
> This works as well, but is not very pretty, especially if I want to add
> sorting of columns and even after pressing the column header I still have
> the editor in place. So I thought I would be clever and added this code:
>
> Listener comboListener = new Listener() {
> public void handleEvent(Event event) {
> switch(event.type) {
> case SWT.FocusOut:
> item.setText(2, categories[combo.getSelectionIndex()]);
> editor.getEditor().dispose();
> break;
> case SWT.Traverse:
> switch(event.detail) {
> case SWT.TRAVERSE_RETURN:
> item.setText(2, categories[combo.getSelectionIndex()]);
> // fall through
> case SWT.TRAVERSE_ESCAPE:
> editor.getEditor().dispose();
> event.doit = false;
> }
> break;
> }
> }
> };
> combo.addListener (SWT.FocusOut, comboListener);
> combo.addListener (SWT.Traverse, comboListener);
>
> To my surprise, when I loose focus or tab out of the editor -->> Eclipse
> crashes! The JVM falls over, without leaving any hint in the .log file.
>
> Is there something I did wrong or is this a bug? The code is a variation
an
> a theme I found in the documented examples on the eclipse.org site.
>
> This is
>
> Eclipse 2.1.1
> Windows XP SP1
> SUN JVM 1.4.2
>
> Any ideas?
>
> Sven Erik Knop
> Principal Consultant
> Versant
>
>
|
|
|
|
| Re: TableEditor and dispose [message #372748 is a reply to message #372576] |
Wed, 20 August 2003 10:54  |
Eclipse User |
|
|
|
Originally posted by: veronika_irvine.oti.com
This could be because you are using SUN JVM 1.4.2
See:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=40884
Try using a 1.4.1 VM or the latest 3.0 version of Eclipse with the 1.4.2 VM.
"Sven Erik Knop" <sven.knop@versant.com> wrote in message
news:bhd0sv$8h6$1@eclipse.org...
> Hi
>
> I am new to SWT and came across the following problem (bare with me, this
> will get a bit lengthy):
>
> I am trying to add an editor to a table, which works fine. The editor is
of
> type Combo. In the example for the editor, the editor will get disposed
when
> a new editor gets created, something like
>
> Control oldEditor = editor.getEditor()
> if (oldEditor != null) oldEditor.dispose()
>
> This works as well, but is not very pretty, especially if I want to add
> sorting of columns and even after pressing the column header I still have
> the editor in place. So I thought I would be clever and added this code:
>
> Listener comboListener = new Listener() {
> public void handleEvent(Event event) {
> switch(event.type) {
> case SWT.FocusOut:
> item.setText(2, categories[combo.getSelectionIndex()]);
> editor.getEditor().dispose();
> break;
> case SWT.Traverse:
> switch(event.detail) {
> case SWT.TRAVERSE_RETURN:
> item.setText(2, categories[combo.getSelectionIndex()]);
> // fall through
> case SWT.TRAVERSE_ESCAPE:
> editor.getEditor().dispose();
> event.doit = false;
> }
> break;
> }
> }
> };
> combo.addListener (SWT.FocusOut, comboListener);
> combo.addListener (SWT.Traverse, comboListener);
>
> To my surprise, when I loose focus or tab out of the editor -->> Eclipse
> crashes! The JVM falls over, without leaving any hint in the .log file.
>
> Is there something I did wrong or is this a bug? The code is a variation
an
> a theme I found in the documented examples on the eclipse.org site.
>
> This is
>
> Eclipse 2.1.1
> Windows XP SP1
> SUN JVM 1.4.2
>
> Any ideas?
>
> Sven Erik Knop
> Principal Consultant
> Versant
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.26947 seconds