XCommandEnvironment xCE = (XCommandEnvironment) UnoRuntime.queryInterface(XCommandEnvironment.class, xMCF.createInstanceWithContext("com.sun.star.ucb.CommandEnvironment", m_xContext));
XPackageManagerFactory xPMF = (XPackageManagerFactory) UnoRuntime.queryInterface(XPackageManagerFactory.class, xNameAccess.getByName("/singletons/com.sun.star.deployment.thePackageManagerFactory"));
XPackageManager xPM = null;
XPackage xPackage = xEM.getDeployedExtension("user", "org.openoffice.extensions.diagrams.Diagrams", location, xCE);
if(xPackage != null){
xPM = xPMF.getPackageManager("user");
}else{
xPackage = xEM.getDeployedExtension("share", "org.openoffice.extensions.diagrams.Diagrams", location, xCE);
if(xPackage != null)