widget disposed error during save action [message #20110] |
Mon, 28 April 2003 12:26  |
Eclipse User |
|
|
|
Originally posted by: kfarnand.bowstreet.com
I am working on a multipage editor. One of the pages in this editor may
need to be redrawn(disposed and then re-created) on the save action.
When I click on the the save button, the save action is fired and the
doSave() method in my multipage editor is called. If a widget is
selected on this page (that gets redrawn) on a save I get a "Widget is
disposed" error on my console because after the save action is complete,
focus is given back to the last widget that had focus before the save
began (and that widget no longer exists). The exact line that causes
the problem is in the class org.eclipse.jface.window.ApplicationWindow
in the run() method. It is the last line in this method:
if (currentFocus != null) currentFocus.setFocus();
(I have added the stack trace below)
I have been trying to fix the problem on my end, trying to push off the
redrawing of the page until after the save but there is no
listener/event that I can use to catch that situation. There seems to
be no notifier for save completion. W/O getting into the details
maintaining widget focus for this page during the save operation is not
important.
I am not sure how to proceed? I rather not write my own custom save
action because the current action does everything I need. It would be
nice if the line of code above read:
if (currentFocus != null && !currentFocus.diposed())
currentFocus.setFocus();
Can anyone make some suggestions on how I might work around this?
Thanks, kyle.
Stack Trace
~~~~~~~~~~~
org.eclipse.swt.SWTException: Widget is disposed
at org.eclipse.swt.SWT.error(SWT.java:2119)
at org.eclipse.swt.SWT.error(SWT.java:2051)
at org.eclipse.swt.widgets.Widget.error(Widget.java:370)
at org.eclipse.swt.widgets.Control.getDisplay(Control.java:705)
at org.eclipse.swt.widgets.Widget.isValidThread(Widget.java:573 )
at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:301)
at org.eclipse.swt.widgets.Control.setFocus(Control.java:1902)
at
org.eclipse.jface.window.ApplicationWindow.run(ApplicationWi ndow.java:425)
at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow. java:1126)
at
org.eclipse.ui.internal.EditorManager.runProgressMonitorOper ation(EditorManager.java:879)
at
org.eclipse.ui.internal.EditorManager.saveEditor(EditorManag er.java:1009)
at
org.eclipse.ui.internal.WorkbenchPage.saveEditor(WorkbenchPa ge.java:1990)
at org.eclipse.ui.internal.SaveAction.run(SaveAction.java:32)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:749 )
|
|
|
|
|
|
Re: widget disposed error during save action [message #22594 is a reply to message #22365] |
Tue, 29 April 2003 11:38  |
Eclipse User |
|
|
|
Originally posted by: kfarnand.bowstreet.com
Yeah, I thought about that but the problem is I can't change the focus
in the time between the save action being clicked/fired and the doSave()
method being called because there is nothing like a "pre-save" event (or
"post-save" event) in which to do this. This is where I would like to
handle the destroying and recreating of my widgets. As far as I can
tell, there is nothing (besides isDirty()) that gets called b4 doSave()
when the save action is kicked off. Do you know of any events I can
listen for to could achieve this?
Lynne Kues wrote:
> What about setting the focus to something that is not getting disposed
> before your doSave code that destroys and recreates widgets?
>
> "kyle farnand" <kfarnand@bowstreet.com> wrote in message
> news:b8kfoh$sqn$1@rogue.oti.com...
>
>>I am using 2.0.2. Any suggestions for a work around on this version?
>>
>>Lynne Kues wrote:
>>
>>>What build are you using? The isDisposed() test is being done in the
>
> 2.1
>
>>>release.
>>>
>>>"kyle farnand" <kfarnand@bowstreet.com> wrote in message
>>>news:b8jkkf$75i$1@rogue.oti.com...
>>>
>>>
>>>>I am working on a multipage editor. One of the pages in this editor may
>>>>need to be redrawn(disposed and then re-created) on the save action.
>>>>When I click on the the save button, the save action is fired and the
>>>>doSave() method in my multipage editor is called. If a widget is
>>>>selected on this page (that gets redrawn) on a save I get a "Widget is
>>>>disposed" error on my console because after the save action is complete,
>>>>focus is given back to the last widget that had focus before the save
>>>>began (and that widget no longer exists). The exact line that causes
>>>>the problem is in the class org.eclipse.jface.window.ApplicationWindow
>>>>in the run() method. It is the last line in this method:
>>>>
>>>>if (currentFocus != null) currentFocus.setFocus();
>>>>
>>>>(I have added the stack trace below)
>>>>
>>>>I have been trying to fix the problem on my end, trying to push off the
>>>>redrawing of the page until after the save but there is no
>>>>listener/event that I can use to catch that situation. There seems to
>>>>be no notifier for save completion. W/O getting into the details
>>>>maintaining widget focus for this page during the save operation is not
>>>>important.
>>>>
>>>>I am not sure how to proceed? I rather not write my own custom save
>>>>action because the current action does everything I need. It would be
>>>>nice if the line of code above read:
>>>>
>>>>if (currentFocus != null && !currentFocus.diposed())
>>>>currentFocus.setFocus();
>>>>
>>>>Can anyone make some suggestions on how I might work around this?
>>>>
>>>>Thanks, kyle.
>>>>
>>>>Stack Trace
>>>>~~~~~~~~~~~
>>>>
>>>>org.eclipse.swt.SWTException: Widget is disposed
>>>>at org.eclipse.swt.SWT.error(SWT.java:2119)
>>>>at org.eclipse.swt.SWT.error(SWT.java:2051)
>>>>at org.eclipse.swt.widgets.Widget.error(Widget.java:370)
>>>>at org.eclipse.swt.widgets.Control.getDisplay(Control.java:705)
>>>>at org.eclipse.swt.widgets.Widget.isValidThread(Widget.java:573 )
>>>>at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:301)
>>>>at org.eclipse.swt.widgets.Control.setFocus(Control.java:1902)
>>>>at
>>
>>> org.eclipse.jface.window.ApplicationWindow.run(ApplicationWi ndow.java:425)
>>>
>>>>at
>
> org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow. java:1126)
>
>>>>at
>>>>
>>>
>>>
> org.eclipse.ui.internal.EditorManager.runProgressMonitorOper ation(EditorMana
>
>>>ger.java:879)
>>>
>>>
>>>>at
>>
>>> org.eclipse.ui.internal.EditorManager.saveEditor(EditorManag er.java:1009)
>>>
>>>>at
>>
>>> org.eclipse.ui.internal.WorkbenchPage.saveEditor(WorkbenchPa ge.java:1990)
>>>
>>>>at org.eclipse.ui.internal.SaveAction.run(SaveAction.java:32)
>>>>at org.eclipse.jface.action.Action.runWithEvent(Action.java:749 )
>>>>
>>>
>>>
>>>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03960 seconds