Rony G. Flatscher wrote:
Hi Stephan,
The following Java program works just fine for me:
Thank you *very*, *very* much indeed!
This has been a total eye-opener for me and I could get over to the next
steps (still quite some miles to go, but for that I hopefully do not
need to bother anyone on this list).
Maybe one last question in this context?
XIntrospectionAccess access =
((XIntrospection) UnoRuntime.queryInterface(
XIntrospection.class,
factory.createInstanceWithContext(
"com.sun.star.beans.Introspection", context))).
inspect( (((XComponentLoader) UnoRuntime.queryInterface(
XComponentLoader.class,
factory.createInstanceWithContext(
"com.sun.star.frame.Desktop", context))).
loadComponentFromURL( "private:factory/scalc",
"_blank", FrameSearchFlag.CREATE, new PropertyValue[0])));
You are "heavily" ;) using "createInstanceWithContext()", whereas I have
been merely using "createInstance()" so far, which works as well
(including the XIntrospection object).
Is there a recommendation, a "tough" reason to use the context in
creating instances in this particular case or is this just a "habit"?
(You probably can tell by such a question, that I am a real rookie
w.r.t. OOo/UNO programming.)
XComponentContext was added late to UNO. That is why there are two ways
to create instances. Under normal circumstances, the old, less verbose
way of using createInstance instead of createInstanceWithContext should
work---after all, there is only one component context involved. (For
some neat recent features, like UnoUrlResolver.create in the program I
posted, you need a component context, however.)
Personally, so far I have been creating an initial context while
bootstrapping, and then when creating an instance of
"com.sun.star.bridge.UnoUrlResolver", which then will be used to
eventually create a XMultiServiceFactory interface object from the
remote service manager. From then on I have been using that multi
service factory with "createInstance()" to create an instance of
"com.sun.star.beans.Introspection", which works (I can now use the
XIntrospection interface to inspect the objects!).
Regards,
---rony
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]