Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » How to auto start command ?
How to auto start command ? [message #1785860] Fri, 20 April 2018 19:34 Go to next message
Jan Bárta is currently offline Jan BártaFriend
Messages: 1
Registered: April 2018
Junior Member
Hello,

I have returned to java&rcp after several years so I forgot many most of things and e4 is very different too. I'm working on small rcp e4 application for collecting data from OPC server into database. There is simple window with two parts with tables to display processed data into first one and some events/errors into second one.

Processing is started manually from tollbar or menu (command-handler). It works without problems, but I need that processing will starts automatically after application starts - without user interraction.

I have found some examples but nothing works for me and I must say I have no idea how to do it, resp. where (into what class) to put code.

Can you help me please ?
Re: How to auto start command ? [message #1785972 is a reply to message #1785860] Mon, 23 April 2018 16:43 Go to previous messageGo to next message
py e4 is currently offline py e4Friend
Messages: 9
Registered: June 2016
Junior Member
maybe you could detail a bit this "... nothing works for me" ;)

anyhow, a basic example for UI here : https://www.programcreek.com/java-api-examples/?code=CloudScale-Project/Environment/Environment-master/plugins/eu.cloudscaleproject.env.product/src/eu/cloudscaleproject/env/product/addons/BottomTrimbarAddon.java

or for the activator :
https://stackoverflow.com/questions/32184873/eclipse-e4-rcp-bundleactivator?rq=1


Re: How to auto start command ? [message #1786004 is a reply to message #1785972] Tue, 24 April 2018 05:46 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Before using an Activator you could think about an OSGi immediate component via Declarative Services.

The real question is, when to autostart the command. Typically some prerequisite needs to be fulfilled before you can autostart the command. If a part needs to be visible or something similar you could use dependency injection mechanisms or even create the commandhandler (which should be typically a POJO) and call it manually. Since you make it dependent on the application start, you could register a lifecycle handler where you get the commandhandler in @PostContextCreate via injection and execute the command handler there. Not sure what other prerequisites need to be met in your scenario.
Previous Topic:npe in ModelServiceImpl (IEventBroker == null) when starting e4 application
Next Topic:User defined key binding in e4 RCP
Goto Forum:
  


Current Time: Thu Apr 18 13:37:23 GMT 2024

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

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

Back to the top