Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » 2 application window generates "widget is disposed" by closing
2 application window generates "widget is disposed" by closing [message #442709] Mon, 13 September 2004 03:57 Go to next message
Eclipse UserFriend
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 #442805 is a reply to message #442709] Mon, 13 September 2004 17:12 Go to previous messageGo to next message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
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
>
>
Re: 2 application window generates "widget is disposed" by closing [message #442816 is a reply to message #442805] Mon, 13 September 2004 23:11 Go to previous messageGo to next message
Eclipse UserFriend
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();
}
}
Re: 2 application window generates "widget is disposed" by closing [message #442886 is a reply to message #442816] Tue, 14 September 2004 14:21 Go to previous message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
You are using JFace classes. Try reposting on eclipse.platform. Sorry for
the run around but someone could probably help you there.

"Andreas Zschorn" <mail@zschorn.com> wrote in message
news:ci59e4$vs3$1@eclipse.org...
> 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();
> }
> }
>
Previous Topic:tab-key in text widget
Next Topic:Dialog capture information
Goto Forum:
  


Current Time: Fri Apr 19 07:53:11 GMT 2024

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

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

Back to the top