2 application window generates "widget is disposed" by closing [message #442709] |
Mon, 13 September 2004 03:57 |
Eclipse User |
|
|
|
Originally posted by: mail.zschorn.com
I am pretty new with swt and jface and I think I have some errors in my
thoughts.
I create a jface applicationwindow and want as a help system that a button
open new applicationwindow and displays the help.
Everything is fine but when I close any of the application windows I get
the the "widget is disposed" error and both application windows crash.
Both application work perfectly when I start them alone.
I start the 2 application window through a action
with
public void run()
HelpGui help = new HelpGui(null);
help.show();
}
Can someone please tell me where is my error.
Do I have to create a new Display thread ?
I have the feeling this my initial idea is also not the right thing to
accomplish
my task. Does anyone have another idea to get a second application window
as an help system started?
Andreas
|
|
|
|
Re: 2 application window generates "widget is disposed" by closing [message #442816 is a reply to message #442805] |
Mon, 13 September 2004 23:11 |
Eclipse User |
|
|
|
Originally posted by: mail.zschorn.com
Steve Northover wrote:
> You will have to post the code. Note that you should have only one event
> loop and one display for both windows.
> "Andreas Zschorn" <mail@zschorn.com> wrote in message
> news:ci35s5$aan$1@eclipse.org...
> > I am pretty new with swt and jface and I think I have some errors in my
> > thoughts.
> > I create a jface applicationwindow and want as a help system that a button
> > open new applicationwindow and displays the help.
> > Everything is fine but when I close any of the application windows I get
> > the the "widget is disposed" error and both application windows crash.
> > Both application work perfectly when I start them alone.
> >
> > I start the 2 application window through a action
> > with
> > public void run()
> > HelpGui help = new HelpGui(null);
> > help.show();
> > }
> > Can someone please tell me where is my error.
> > Do I have to create a new Display thread ?
> > I have the feeling this my initial idea is also not the right thing to
> > accomplish
> > my task. Does anyone have another idea to get a second application window
> > as an help system started?
> > Andreas
> >
> >
Sorry for the code, I just created a new example with no content which
should show my problem
---this is the main program
public class CopyOfInvoiceUIswt extends ApplicationWindow {
private ExitAction exitaction;
private InvoiceHelp invoiceHelp;
public void show() {
this.setBlockOnOpen(true);
this.open();
Display.getCurrent().dispose();
}
public CopyOfInvoiceUIswt() {
super(null);
exitaction = new ExitAction(this);
invoiceHelp = new InvoiceHelp(this);
addToolBar(SWT.FLAT | SWT.WRAP);
}
protected Control createContents(Composite parent) {
getShell().setText("MainApplication");
return parent;
}
protected ToolBarManager createToolBarManager(int style) {
ToolBarManager toolBarManager = new ToolBarManager(style);
toolBarManager.add(invoiceHelp);
toolBarManager.add(exitaction);
return toolBarManager;
}
public static void main(String[] args) {
CopyOfInvoiceUIswt w = new CopyOfInvoiceUIswt();
w.show();
}
}
---
the second application
public class HelpGui extends ApplicationWindow{
/**
*
*/
private ExitAction exitaction;
private static HelpGui app;
public HelpGui() {
super(null);
exitaction = new ExitAction(this);
addToolBar(SWT.FLAT | SWT.WRAP);
}
public HelpGui(Shell parent) {
super(parent);
addStatusLine();
exitaction = new ExitAction(this);
addToolBar(SWT.FLAT | SWT.WRAP);
}
public void show() {
this.setBlockOnOpen( true );
this.open();
Display.getCurrent().dispose();
}
protected Control createContents(Composite parent)
{
getShell().setText("Help");
return parent;
}
protected ToolBarManager createToolBarManager(int style)
{
ToolBarManager tool_bar_manager = new ToolBarManager(style);
tool_bar_manager.add(exitaction);
return tool_bar_manager;
}
}
----- and the exit action
public class ExitAction extends Action
{
ApplicationWindow window;
public ExitAction(ApplicationWindow w)
{
window = w;
setText("E&xit@Ctrl+X");
setToolTipText("Exit the application");
}
public void run()
{
window.close();
}
}
|
|
|
|
Powered by
FUDForum. Page generated in 0.01758 seconds