Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » How to open a second window programmatically?
How to open a second window programmatically? [message #654894] Thu, 17 February 2011 14:37 Go to next message
Mike Moor is currently offline Mike MoorFriend
Messages: 20
Registered: November 2010
Location: Steffisburg, Switzerland
Junior Member
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 #654956 is a reply to message #654894] Thu, 17 February 2011 18:14 Go to previous messageGo to next message
Remy Suen is currently offline Remy SuenFriend
Messages: 462
Registered: July 2009
Senior Member
Does a Shell get created? Does its open() method get called? Or the setVisible(boolean) method (with a 'true' parameter)?
Re: How to open a second window programmatically? [message #654966 is a reply to message #654894] Thu, 17 February 2011 18:56 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
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 18:59 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
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 07:44 Go to previous message
Mike Moor is currently offline Mike MoorFriend
Messages: 20
Registered: November 2010
Location: Steffisburg, Switzerland
Junior Member
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
Previous Topic:e4 Javadoc
Next Topic:Setting up e4 UI source code
Goto Forum:
  


Current Time: Wed Apr 24 23:54:19 GMT 2024

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

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

Back to the top