Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » TableEditor and dispose
TableEditor and dispose [message #372576] Wed, 13 August 2003 05:38 Go to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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 #372725 is a reply to message #372576] Wed, 20 August 2003 05:39 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mueller.software.email.de

May be your oldEditor has already been disposed.

Try this:

Control oldEditor = editor.getEditor()
if (oldEditor != null) {
if (!oldEditor.isDisposed()) oldEditor.dispose();
}

Hope this helps

J
Re: TableEditor and dispose [message #372748 is a reply to message #372576] Wed, 20 August 2003 10:54 Go to previous message
Eclipse UserFriend
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
>
>
Previous Topic:TableTree disappears
Next Topic:Clipboard Problems
Goto Forum:
  


Current Time: Thu Nov 06 15:14:14 EST 2025

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

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

Back to the top