How to open a second window programmatically? [message #654894] |
Thu, 17 February 2011 09:37  |
Eclipse User |
|
|
|
Hi,
My application has 2 windows at the moment. at startup the login window is visible, the registration window not. on the login window is a link which calls a command. this is the handler to close the login window and open the registration window:
public class ShowPart {
@Execute
public void execute(final MApplication application, final EModelService ms, final EPartService partService,
@Named("windowId") final String windowId) {
// find the window to show
MUIElement e = ms.find(windowId, application);
e.setVisible(true);
e.setOnTop(true);
e.setToBeRendered(true);
ms.bringToTop(e);
// hide the others
for (MWindow window : application.getChildren()) {
if (!windowId.equals(window.getElementId())) {
window.setVisible(false);
window.setOnTop(false);
window.setToBeRendered(false);
}
}
}
}
This successfully closes the login window but it doesn't open my registration window.
What am i doing wrong?
thank you for your help,
mike
|
|
|
|
Re: How to open a second window programmatically? [message #654966 is a reply to message #654894] |
Thu, 17 February 2011 13:56   |
Eclipse User |
|
|
|
Why are you creating Workbench-Windows and not simply open a
TitleAreaDialog, Dialog, Shell?
Tom
Am 17.02.11 15:37, schrieb Mike Moor:
> Hi,
>
> My application has 2 windows at the moment. at startup the login window
> is visible, the registration window not. on the login window is a link
> which calls a command. this is the handler to close the login window and
> open the registration window:
>
>
> public class ShowPart {
>
> @Execute
> public void execute(final MApplication application, final
> EModelService ms, final EPartService partService,
> @Named("windowId") final String windowId) {
>
> // find the window to show
> MUIElement e = ms.find(windowId, application);
> e.setVisible(true);
> e.setOnTop(true);
> e.setToBeRendered(true);
> ms.bringToTop(e);
>
> // hide the others
> for (MWindow window : application.getChildren()) {
> if (!windowId.equals(window.getElementId())) {
> window.setVisible(false);
> window.setOnTop(false);
> window.setToBeRendered(false);
> }
> }
>
> }
> }
>
>
> This successfully closes the login window but it doesn't open my
> registration window.
>
> What am i doing wrong?
>
> thank you for your help,
> mike
|
|
|
Re: How to open a second window programmatically? [message #654967 is a reply to message #654966] |
Thu, 17 February 2011 13:59   |
Eclipse User |
|
|
|
BTW naturally opening/closing MWindows should work but I think you can
get around using native SWT/JFace-Code.
Did you have a look in my tutorial? I've successfully opened there
windows programmatically but things might have changed since 4.0.
Tom
Am 17.02.11 19:56, schrieb Tom Schindl:
> Why are you creating Workbench-Windows and not simply open a
> TitleAreaDialog, Dialog, Shell?
>
> Tom
>
> Am 17.02.11 15:37, schrieb Mike Moor:
>> Hi,
>>
>> My application has 2 windows at the moment. at startup the login window
>> is visible, the registration window not. on the login window is a link
>> which calls a command. this is the handler to close the login window and
>> open the registration window:
>>
>>
>> public class ShowPart {
>>
>> @Execute
>> public void execute(final MApplication application, final
>> EModelService ms, final EPartService partService,
>> @Named("windowId") final String windowId) {
>>
>> // find the window to show
>> MUIElement e = ms.find(windowId, application);
>> e.setVisible(true);
>> e.setOnTop(true);
>> e.setToBeRendered(true);
>> ms.bringToTop(e);
>>
>> // hide the others
>> for (MWindow window : application.getChildren()) {
>> if (!windowId.equals(window.getElementId())) {
>> window.setVisible(false);
>> window.setOnTop(false);
>> window.setToBeRendered(false);
>> }
>> }
>>
>> }
>> }
>>
>>
>> This successfully closes the login window but it doesn't open my
>> registration window.
>>
>> What am i doing wrong?
>>
>> thank you for your help,
>> mike
>
|
|
|
Re: How to open a second window programmatically? [message #657523 is a reply to message #654967] |
Thu, 03 March 2011 02:44  |
Eclipse User |
|
|
|
Hi,
I finally found the problem:
When one defines a not visible window in the Application.e4xmi, the "To Be Rendered" checkbox must not be checked!
As soon as i unchecked it my command handler did his job.
I still don't know why it behaves like that. maybe one of you guys knows the answer?
thanks for your help and for eclipse 4/e4! I love using it!
mike
|
|
|
Powered by
FUDForum. Page generated in 0.03782 seconds