Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » e(fx)clipse » trouble restarting e4+javafx application(can't restart tycho built e4+javafx application )
trouble restarting e4+javafx application [message #1717998] Fri, 18 December 2015 13:26 Go to next message
Paul Mira is currently offline Paul MiraFriend
Messages: 8
Registered: December 2015
Junior Member
Hello everyone,

So I'm working on this project and I'm trying to add p2 update functionnality to an e4+javafx application. Everything works fine until the part where I need to restart my application to reflect the changes made to the application model. The application closes, and then simply doesn't restart.

I was able to link this issue to something (no idea what exactly) related to the tycho/maven I used to build my application. See, when I use the eclipse PDE build for the export, everything works fine, I'm able to restart a dummy sample app. I simply add a Main Menu the application model, then a Menu (named File) > then a handled MenuItem (named Restart), handled by some RestartHandler.java class looking like this
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.ui.workbench.IWorkbench;
public class RestartHandler {
	@Execute
	public void execute(IWorkbench workbench) {
	    workbench.restart();
	}
}

but the the same dummy app when generated by the tycho build will simply close and won't restart. I'm I missing something here? Any suggestions?
Re: trouble restarting e4+javafx application [message #1717999 is a reply to message #1717998] Fri, 18 December 2015 13:30 Go to previous messageGo to next message
Christoph Keimel is currently offline Christoph KeimelFriend
Messages: 482
Registered: December 2010
Location: Germany
Senior Member
I am not sure about Tycho, but you can use the efxclipse RestartService to restart the application.

public class RestartHandler {
	@Execute
	public void execute(RestartService restartService) {
		restartService.restart(false);
	}
}

Re: trouble restarting e4+javafx application [message #1718000 is a reply to message #1717998] Fri, 18 December 2015 13:40 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
So when you export via tycho, how do you launch it? Via java -jar? Using
the javafx-packager generated .exe?

Tom

On 18.12.15 14:26, Paul Mira wrote:
> Hello everyone,
> So I'm working on this project and I'm trying to add p2 update
> functionnality to an e4+javafx application. Everything works fine until
> the part where I need to restart my application to reflect the changes
> made to the application model. The application closes, and then simply
> doesn't restart.
> I was able to link this issue to something (no idea what exactly)
> related to the tycho/maven I used to build my application. See, when I
> use the eclipse PDE build for the export, everything works fine, I'm
> able to restart a dummy sample app. I simply add a Main Menu the
> application model, then a Menu (named File) > then a handled MenuItem
> (named Restart), handled by some RestartHandler.java class looking like
> this
> import org.eclipse.e4.core.di.annotations.Execute;
> import org.eclipse.e4.ui.workbench.IWorkbench;
> public class RestartHandler {
> @Execute
> public void execute(IWorkbench workbench) {
> workbench.restart();
> }
> }
> but the the same dummy app when generated by the tycho build will simply
> close and won't restart. I'm I missing something here? Any suggestions?
Re: trouble restarting e4+javafx application [message #1718002 is a reply to message #1717999] Fri, 18 December 2015 13:46 Go to previous messageGo to next message
Paul Mira is currently offline Paul MiraFriend
Messages: 8
Registered: December 2015
Junior Member
No luck, same result
Re: trouble restarting e4+javafx application [message #1718003 is a reply to message #1718000] Fri, 18 December 2015 13:56 Go to previous messageGo to next message
Paul Mira is currently offline Paul MiraFriend
Messages: 8
Registered: December 2015
Junior Member
after generated via tycho I launch it using the generated .exe

The whole thing is really simple to reproduce, just build a sample e4-javafx app structure using the "JavaFX > Osgi > e4 application project" new project wizard. Add a simple main menu > menu > handled menu item to the application model, create a command+handler for it, and use the simple RestartHandler.java class I gave for the handler.

Then build the whole thing with tycho and see if the app restarts when you click on that menu item

I'm working on Eclipse 4.5.1 (Mars) M20150904-0015, with efxclipse -IDE 2.1.0

[Updated on: Fri, 18 December 2015 13:58]

Report message to a moderator

Re: trouble restarting e4+javafx application [message #1718061 is a reply to message #1718003] Fri, 18 December 2015 18:50 Go to previous messageGo to next message
Paul Mira is currently offline Paul MiraFriend
Messages: 8
Registered: December 2015
Junior Member
So thanks again everyone, I got a hunch from this Tom's advice
Quote:
If you are targeting Linux & Windows just check the include native
launcher artifacts, fix the p2-repos in your tycho build to include
those natives, fix the platform-section and run tycho.


which he gave here : https://www.eclipse.org/forums/index.php/t/1000801/

so what I did precisely (for anyone interested) is configure my parent pom.xml (in the releng project) and changed the target-platform-configuration related plugin. So I replaced this
<environments>
						<environment>
							<os>noenv</os>
							<ws>noenv</ws>
							<arch>noenv</arch>
						</environment>
					</environments>

with this
<environments>
						<environment>
							<os>win32</os>
							<ws>win32</ws>
							<arch>x86_64</arch>
						</environment>
					</environments>

Then I did the same in the build.xml ant file (also in the releng project) and replaced
/noenv/noenv/noenv 
by
/win32/win32/x86_64
in the values of eclipse-app-dir property and equinox-launcher dir.

Then I checked "The product includes native launcher artifacts" in the product config file.

The tycho built app restarts just fine now.

So now I guess my app uses "native launchers", and can't be used on a different system. Suits me fine at this point, but I think there should be a more multi-system solution to this.
Re: trouble restarting e4+javafx application [message #1718147 is a reply to message #1718003] Sun, 20 December 2015 18:36 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
The exe you talk about is generated by the java-packager and it is quite
likely that it does not support the restart!

Tom

On 18.12.15 14:56, Paul Mira wrote:
> after generated via tycho I launch it using the generated .exe
>
> The whole thing is really simple to reproduce, just build a sample
> e4-javafx app structure using the "JavaFX > Osgi > e4 application
> project" new project wizard. Add a simple main menu > menu > handled
> menu item to the application model, create a command+handler for it, and
> use the simple RestartHandler.java class I gave for the handler.
> Then build the whole thing with tycho and see if the app restarts when
> you click on that menu item
Re: trouble restarting e4+javafx application [message #1718148 is a reply to message #1718061] Sun, 20 December 2015 18:37 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Right now the exe it the one from Eclipse, which works fine on windows
but fails on OS-X because JavaFX does not get a hand on the event loop.

Tom

On 18.12.15 19:50, Paul Mira wrote:
> So thanks again everyone, I got a hunch from this Tom's advice Quote:
>> If you are targeting Linux & Windows just check the include native
>> launcher artifacts, fix the p2-repos in your tycho build to include
>> those natives, fix the platform-section and run tycho.
>
>
> which he gave here : https://www.eclipse.org/forums/index.php/t/1000801/
>
> so what I did precisely (for anyone interested) is configure my parent
> pom.xml (in the releng project) and changed the
> target-platform-configuration related plugin. So I replaced this
> <environments>
> <environment>
> <os>noenv</os>
> <ws>noenv</ws>
> <arch>noenv</arch>
> </environment>
> </environments>
> with this <environments>
> <environment>
> <os>win32</os>
> <ws>win32</ws>
> <arch>x86_64</arch>
> </environment>
> </environments>
> Then I did the same in the build.xml ant file (also in the releng
> project) and replaced /noenv/noenv/noenv by /win32/win32/x86_64 in the
> values of eclipse-app-dir property and equinox-launcher dir.
>
> Then I checked "The product includes native launcher artifacts" in the
> product config file.
> The tycho built app restarts just fine now.
> So now I guess my app uses "native launchers", and can't be used on a
> different system. Suits me fine at this point, but I think there should
> be a more multi-system solution to this.
Previous Topic:JavaFX Codeeditors: Asciidoc demo?
Next Topic:Change in
Goto Forum:
  


Current Time: Thu Apr 25 18:08:10 GMT 2024

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

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

Back to the top