java - How to call constructor of Elipse 4 RCP part when application start? -
i have few parts in 1 partstack. when application start, constructor of first part called. other constructors called when click on these parts.
i have this:
public class oneofparts { @inject oneofparts(final borderpane pane) { //some initialization stuff } //other methods } how can call constructors of parts in partstack when application start?
e: or there way initialize final field parts when application start?
you try initializations during application start using lifecyclehandler. lars vogel describes how implement 1 here.
alternatively write data class , annotate @creatable , @singleton use in parts sharing data di.
@singleton @creatable public class shareddata() { private shareddata() { // initialize data here - alternatively: use @postconstruct method in class } } public class partshowinghex { @postconstruct private void initializepart(shareddata pdata) { // whatever need } } for field based approach:
public class partshowingtxt { @inject private shareddata mydata; @postconstruct private void initializepart() { // ... } } i'd recommand using data-singleton method-di approach (first code example).
Comments
Post a Comment