Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsAccessing the controller instance when using FXMLLoaderFactory
https://www.eclipse.org/forums/index.php/mv/msg/544362/1131108/#msg_1131108
in a follow-up to this discussion in the old forum, I would like to know if using the Eclipse context is still the only (or best) way to access a controller instance after loading an FXML file using the FXMLLoaderFactory class.
According to this Eclipsepedia page, "it is not intended for the developer to use the IEclipseContext directly". So is there a better alternative?
The FXMLLoader class has a getController() method. Could we have a similar solution for the FXMLLoaderFactory or FXMLBuilder class?
Thanks,
Uwe]]>Uwe San2013-10-10T07:44:31-00:00Re: Accessing the controller instance when using FXMLLoaderFactory
https://www.eclipse.org/forums/index.php/mv/msg/544362/1131124/#msg_1131124
referenced only as a last resort in code.
I've been working on a related topic lately which allows you to publish
informations without the IEclipseContext but it is not yet checked into
the repo.
Tom
On 10.10.13 09:44, Uwe San wrote:
> Hi,
>
> in a follow-up to
> https://groups.google.com/forum/#!searchin/efxclipse/fxmlloaderfactory/efxclipse/BAkd68xlsNo
> in the old forum, I would like to know if using the Eclipse context is
> still the only (or best) way to access a controller instance after
> loading an FXML file using the FXMLLoaderFactory class.
>
> The example code was:
>
> @PostConstruct
> void init(BorderPane parent, @FXMLLoader FXMLLoaderFactory factory,
> IEclipseContext ctx) {
> Parent topElement = (Parent)
> factory.loadRequestorRelative("Test.fxml").load();
> my.package.Controller c = ctx.get("my.package.Controller");
> }
>
> According to this http://wiki.eclipse.org/E4/Contexts#Summary, "it is
> not intended for the developer to use the IEclipseContext directly". So
> is there a better alternative?
>
> The FXMLLoader class has a getController() method. Could we have a
> similar solution for the FXMLLoaderFactory or FXMLBuilder class?
>
> Thanks,
> Uwe]]>Thomas Schindl2013-10-10T08:01:07-00:00Re: Accessing the controller instance when using FXMLLoaderFactory
https://www.eclipse.org/forums/index.php/mv/msg/544362/1131247/#msg_1131247
Tom
On 10.10.13 10:01, Tom Schindl wrote:
> Sure file a feature request, I agree the IEclipseContext should be
> referenced only as a last resort in code.
>
> I've been working on a related topic lately which allows you to publish
> informations without the IEclipseContext but it is not yet checked into
> the repo.
>
> Tom
>
> On 10.10.13 09:44, Uwe San wrote:
>> Hi,
>>
>> in a follow-up to
>> https://groups.google.com/forum/#!searchin/efxclipse/fxmlloaderfactory/efxclipse/BAkd68xlsNo
>> in the old forum, I would like to know if using the Eclipse context is
>> still the only (or best) way to access a controller instance after
>> loading an FXML file using the FXMLLoaderFactory class.
>>
>> The example code was:
>>
>> @PostConstruct
>> void init(BorderPane parent, @FXMLLoader FXMLLoaderFactory factory,
>> IEclipseContext ctx) {
>> Parent topElement = (Parent)
>> factory.loadRequestorRelative("Test.fxml").load();
>> my.package.Controller c = ctx.get("my.package.Controller");
>> }
>>
>> According to this http://wiki.eclipse.org/E4/Contexts#Summary, "it is
>> not intended for the developer to use the IEclipseContext directly". So
>> is there a better alternative?
>>
>> The FXMLLoader class has a getController() method. Could we have a
>> similar solution for the FXMLLoaderFactory or FXMLBuilder class?
>>
>> Thanks,
>> Uwe
>]]>Thomas Schindl2013-10-10T10:43:05-00:00