[SOLVED] Re: UNO, how to use theDesktop singleton instead of deprecated Desktop?

Alberto González Palomo alberto at matracas.org
Thu Sep 22 14:39:49 UTC 2016


Alberto González Palomo wrote on 21/09/16 at 19:45:
>
>   I have a working Java application that uses UNO with LibreOffice 5.
>   I'm using createInstanceWithContext for com.sun.star.frame.Desktop,
> but in the documentation it says that this interface is deprecated and
> we should use the "theDesktop singleton" instead:
>
> http://api.libreoffice.org/docs/idl/ref/servicecom_1_1sun_1_1star_1_1frame_1_1Desktop.html#details
>
>   However I haven't found any information on how to do that.
>
> [...]
>   Is this documented anywhere, or is there any example that uses
> theDesktop instead of Desktop?

   Ok, I got it working.

   None of the Java examples in the SDK uses theDesktop, all use the 
"deprecated" Desktop.

   Now instead of:

serviceManager.createInstanceWithContext
      ("com.sun.star.frame.Desktop", componentContext)

   I use:

com.sun.star.frame.theDesktop.get(componentContext)

   Cheers,
-- 
     Alberto González Palomo
     Toledo, España / Saarbrücken, Deutschland
     http://www.matracas.org


More information about the LibreOffice mailing list