Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Visual Editor (VE) » SWT Application with several shells
SWT Application with several shells [message #133933] Tue, 05 December 2006 01:23 Go to next message
Eclipse UserFriend
Originally posted by: daniel.m.ziegler.gmx.net

Hi! I have been successful in creating a visual SWT application with one
shell using the Visual Editor. Now I want to extend this by other windows
which open in certain contexts. At this point I face some problems.



So far, I have been trying to create my child shells as "Shell Visual Class".
The currently most important question is how to link them to the main shell.
I have read that it is good style to use only one common Display instance.
Consequently, I have to tell the child shell to use the display of the
parent shell. After selecting the parent shell bean there is an option
"Change Parent.." But therein, no shell is offered for being selected as
parent. When does the Shell Visual Class recognize another shell as
potential parent shell?
Re: SWT Application with several shells [message #133951 is a reply to message #133933] Tue, 05 December 2006 14:50 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

It sees parents only in the same physical class. You can drop several
shells on the freeform (white) surface. Then when you need to show that
shell you do a


if (shell1 == null)
createShell1();
shell1.open();


That's it. It uses the display from the current thread, so the thread
doing the open should be the display thread. Which if you are doing this
from a widget event, then it will be the display thread.

If the thread is not the display thread, then you would do:

Display.syncExec(new Runnable() {
public void run() {
if (shell1 == null)
createShell1();
shell1.open();
}
});

However, word of warning. If you intend to open and close and then
reopen the shell, please add this in the createShell1() method.

shell1.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposedEvent e) {
shell1 = null;
}
});

That will make sure that when you try to open again it will create a
brand new copy instead of trying to reuse the disposed copy.

Daniel Ziegler wrote:
> Hi! I have been successful in creating a visual SWT application with one
> shell using the Visual Editor. Now I want to extend this by other windows
> which open in certain contexts. At this point I face some problems.
>
>
>
> So far, I have been trying to create my child shells as "Shell Visual Class".
> The currently most important question is how to link them to the main shell.
> I have read that it is good style to use only one common Display instance.
> Consequently, I have to tell the child shell to use the display of the
> parent shell. After selecting the parent shell bean there is an option
> "Change Parent.." But therein, no shell is offered for being selected as
> parent. When does the Shell Visual Class recognize another shell as
> potential parent shell?
>
>

--
Thanks,
Rich Kulp
Re: SWT Application with several shells [message #133958 is a reply to message #133951] Tue, 05 December 2006 14:52 Go to previous message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

By the way, you don't need to have a parent for a shell unless you want
that shell to always be in front of the parent shell. If they are
independent shells then you don't need the parent to be set.


--
Thanks,
Rich Kulp
Re: SWT Application with several shells [message #614844 is a reply to message #133933] Tue, 05 December 2006 14:50 Go to previous message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

It sees parents only in the same physical class. You can drop several
shells on the freeform (white) surface. Then when you need to show that
shell you do a


if (shell1 == null)
createShell1();
shell1.open();


That's it. It uses the display from the current thread, so the thread
doing the open should be the display thread. Which if you are doing this
from a widget event, then it will be the display thread.

If the thread is not the display thread, then you would do:

Display.syncExec(new Runnable() {
public void run() {
if (shell1 == null)
createShell1();
shell1.open();
}
});

However, word of warning. If you intend to open and close and then
reopen the shell, please add this in the createShell1() method.

shell1.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposedEvent e) {
shell1 = null;
}
});

That will make sure that when you try to open again it will create a
brand new copy instead of trying to reuse the disposed copy.

Daniel Ziegler wrote:
> Hi! I have been successful in creating a visual SWT application with one
> shell using the Visual Editor. Now I want to extend this by other windows
> which open in certain contexts. At this point I face some problems.
>
>
>
> So far, I have been trying to create my child shells as "Shell Visual Class".
> The currently most important question is how to link them to the main shell.
> I have read that it is good style to use only one common Display instance.
> Consequently, I have to tell the child shell to use the display of the
> parent shell. After selecting the parent shell bean there is an option
> "Change Parent.." But therein, no shell is offered for being selected as
> parent. When does the Shell Visual Class recognize another shell as
> potential parent shell?
>
>

--
Thanks,
Rich Kulp
Re: SWT Application with several shells [message #614845 is a reply to message #133951] Tue, 05 December 2006 14:52 Go to previous message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

By the way, you don't need to have a parent for a shell unless you want
that shell to always be in front of the parent shell. If they are
independent shells then you don't need the parent to be set.


--
Thanks,
Rich Kulp
Previous Topic:Matisse for SWT!
Next Topic:Problem in Setup Visual Java Editor: Initializing model
Goto Forum:
  


Current Time: Thu Sep 26 18:58:21 GMT 2024

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

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

Back to the top