Hi
I'm developing a JFace application using the ApplicationWindow class as the main entrypoint. Now I want to support multiple instances of my application(window) within one JVM. Is this possible with the ApplicationWindow? My experiments ended with UI-thread/-events problems.
Paul Webster Messages: 6813 Registered: July 2009 Location: Ottawa
Senior Member
On 02/15/2011 12:24 PM, gattacus@gmail.com wrote:
> Hi I'm developing a JFace application using the ApplicationWindow class
> as the main entrypoint. Now I want to support multiple instances of my
> application(window) within one JVM. Is this possible with the
> ApplicationWindow? My experiments ended with UI-thread/-events problems.
You can create multiple ApplicationWindows if you want.
The pattern would be:
void main(String[] args) {
create display
create and open app window 1
create and open app window 2
run display loop
}
How did you get off the UI thread? Or did you setBlockOnOpen(*) on your
windows?
yes, I am using setBlockOnOpen(true). My idea was to have each instance in its own threadgroup. This would make it possible to get the instance from within other (associated) components by using static getInstance(). the singleton pattern is heavily used and a problem in the multiple-window case. so I am looking for a way to circumvent the issue. Any other idea?
Hi
I'm developing a JFace application using the ApplicationWindow class as the
main entrypoint. Now I want to support multiple instances of my
application(window) within one JVM. Is this possible with the
ApplicationWindow? My experiments ended with UI-thread/-events problems.
Paul Webster Messages: 6813 Registered: July 2009 Location: Ottawa
Senior Member
On 02/15/2011 03:30 PM, gattacus@gmail.com wrote:
> yes, I am using setBlockOnOpen(true). My idea was to have each instance
> in its own threadgroup. This would make it possible to get the instance
> from within other (associated) components by using static getInstance().
You cannot do that. SWT, like AWT, runs in a single UI thread.
You need to create and open one or more windows, and then run the
display loop.
You can use WindowManager to keep track of your multiple windows, even
to group them and close them together.