Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How do I mimic Window/New Window
How do I mimic Window/New Window [message #444123] Wed, 06 October 2004 18:45 Go to next message
Eclipse UserFriend
Originally posted by: news0reader.hotmail.com

Hi,

I have a small "file viewer" jface app with a single (main) window. On this
window I have a button, and I'd like its click action to open another copy
of the main window, akin to Window/New Window menu command in the Eclipse
workbench.

My current code to open one window is:

w = MyApplicationWindow()
w.setBlockOnOpen( 1 )
w.open()
Display.getCurrent().dispose()

Calling this code block repeatedly does indeed open new windows...but as
soon as I close one of the windows, all opened windows close and I get an
"Invalid thread access" exception. Not too strange because the code gets
rid of the display; perhaps I should remember the originally opened window
as the "real" main window to "close" and simply "dispose()" newly opened
ones? However what I'd like is workbench behavior in which each workbench
opened via Window/New Window is not dependent on earlier-opened windows for
its lifetime.

Obviously I didn't find anything germane in a web or eclipse-archive search.
Could somebody point me to a sample of how this is done?

Thanx

--A
Re: How do I mimic Window/New Window [message #444127 is a reply to message #444123] Wed, 06 October 2004 22:06 Go to previous message
Eclipse UserFriend
Originally posted by: news0reader.hotmail.com

Errata in original post : once I open multiple windows using the method
outlined earlier, it only if I close the last-opened window that all other
windows close and I get the thread exception.

What I've done since is remove the line

Display.getCurrent().dispose()

This gives me the behavior I want...but I suspect I'm not cleaning up
something.

--A


"news0reader" <news0reader@hotmail.com> wrote in message
news:ck1e7g$5f9$1@eclipse.org...
> Hi,
>
> I have a small "file viewer" jface app with a single (main) window. On
this
> window I have a button, and I'd like its click action to open another copy
> of the main window, akin to Window/New Window menu command in the Eclipse
> workbench.
>
> My current code to open one window is:
>
> w = MyApplicationWindow()
> w.setBlockOnOpen( 1 )
> w.open()
> Display.getCurrent().dispose()
>
> Calling this code block repeatedly does indeed open new windows...but as
> soon as I close one of the windows, all opened windows close and I get an
> "Invalid thread access" exception. Not too strange because the code gets
> rid of the display; perhaps I should remember the originally opened window
> as the "real" main window to "close" and simply "dispose()" newly opened
> ones? However what I'd like is workbench behavior in which each workbench
> opened via Window/New Window is not dependent on earlier-opened windows
for
> its lifetime.
>
> Obviously I didn't find anything germane in a web or eclipse-archive
search.
> Could somebody point me to a sample of how this is done?
>
> Thanx
>
> --A
Previous Topic:How to define Drag and drop transfer types?
Next Topic:Sizing text widgets
Goto Forum:
  


Current Time: Thu Apr 25 13:41:04 GMT 2024

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

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

Back to the top