Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Focusing windows(How to do it?)
icon8.gif  Focusing windows [message #903324] Thu, 23 August 2012 07:43 Go to next message
arek a is currently offline arek a
Messages: 6
Registered: August 2012
Junior Member
Im new i ll just say hello to u Smile

problem:

I did a loginWindow (visible=true)and i have workWindow which (visible=false).When somebody login it's change visible , but i lost focus on workWindow.
I dono how to fix this Sad

this is my code:

 
 MTrimmedWindow workingWindow = (MTrimmedWindow) app.getChildren().get(0);
 MTrimmedWindow loginWindow = (MTrimmedWindow) app.getChildren().get(1);

 loginWindow.setVisible(false);
 workingWindow.setVisible(true);
				

Re: Focusing windows [message #903549 is a reply to message #903324] Fri, 24 August 2012 09:07 Go to previous messageGo to next message
Lars Vogel is currently offline Lars Vogel
Messages: 1049
Registered: July 2009
Senior Member

IMHO you have in addition to use the PartService. See http://www.vogella.com/articles/Eclipse4Services/article.html#selectedservices_partservice for an example.
Re: Focusing windows [message #903579 is a reply to message #903324] Fri, 24 August 2012 12:01 Go to previous messageGo to next message
arek a is currently offline arek a
Messages: 6
Registered: August 2012
Junior Member
Thank you for replay Lars.

I was so laughing when i was writing this code i know it is for sure bad code but... it works Razz

first i did that tutorial and grab parts but i did grab only parts from visible TrimmedWindow (code compile from URI class-part named LoginScreen.java ).

I tried to do the same thing but in other URI class by Dependency Injection (first i made
eventBroker.post("ChangeVisble", new Object()); 


then in other URI class

void injectWindowState(@UIEventTopic("ChangeVisble") Object obj) {
		changeVisible();
		MTrimmedWindow workingWindow = (MTrimmedWindow) app.getChildren()
				.get(0);
		MTrimmedWindow loginWindow = (MTrimmedWindow) app.getChildren().get(1);
		loginWindow.setVisible(false);
		workingWindow.setVisible(true);
		
		MPart detailsTodoPart = partService.findPart("e4test.part.calendar1");
		detailsTodoPart.setVisible(true);
		partService.showPart(detailsTodoPart, PartState.VISIBLE); 
		


And it works !!! Smile


Re: Focusing windows [message #903586 is a reply to message #903579] Fri, 24 August 2012 12:28 Go to previous messageGo to next message
Lars Vogel is currently offline Lars Vogel
Messages: 1049
Registered: July 2009
Senior Member

Unfortunately it is currently not bad code, but required code. Please issue your voice on Bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=372211.
Re: Focusing windows [message #904408 is a reply to message #903586] Tue, 28 August 2012 11:36 Go to previous messageGo to next message
Thomas Kölling is currently offline Thomas Kölling
Messages: 45
Registered: December 2011
Location: Munich
Member
Hi Lars,

I get the following Message for your Link: '372211.' is not a valid bug number.

I have the same problem like arek.. i will try now his workaround
Re: Focusing windows [message #904409 is a reply to message #903586] Tue, 28 August 2012 11:37 Go to previous messageGo to next message
Thomas Kölling is currently offline Thomas Kölling
Messages: 45
Registered: December 2011
Location: Munich
Member
Hi Lars,

I get the following Message for your Link: '372211.' is not a valid bug number.

I have the same problem like arek.. i will try now his workaround
Re: Focusing windows [message #904413 is a reply to message #904408] Tue, 28 August 2012 11:43 Go to previous messageGo to next message
Lars Vogel is currently offline Lars Vogel
Messages: 1049
Registered: July 2009
Senior Member

Wink try without the dot at the end....

https://bugs.eclipse.org/bugs/show_bug.cgi?id=372211
Re: Focusing windows [message #904496 is a reply to message #904413] Tue, 28 August 2012 14:34 Go to previous messageGo to next message
Thomas Kölling is currently offline Thomas Kölling
Messages: 45
Registered: December 2011
Location: Munich
Member
time for vacation...
Re: Focusing windows [message #904651 is a reply to message #904496] Tue, 28 August 2012 22:04 Go to previous message
Thomas Kölling is currently offline Thomas Kölling
Messages: 45
Registered: December 2011
Location: Munich
Member
okay.. the workaround above doesn't work for me...

instead of that i send a force Focus on the SWT Shell..


MWindow pluginDialog = (MWindow) service.find(LOGIN_WINDOW_NAME, application);
MWindow windowModel = (MWindow) service.find(MAIN_WINDOW_NAME, application);

// close the plugin dialog
pluginDialog.setVisible(false);
pluginDialog.setToBeRendered(false);
pluginDialog.setOnTop(false);
//open main window
service.bringToTop(windowModel);
windowModel.setOnTop(true);
windowModel.setVisible(true);
//works, but dirty :/
((Shell)windowModel.getWidget()).forceActive();

Previous Topic:need EventBroker as OSGi Service
Next Topic:take advantage of e4 ContextFunction
Goto Forum:
  


Current Time: Thu Oct 02 14:34:51 GMT 2014

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

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