public boolean removeDiagramsExtension(){
try{
String location = m_xPIP.getPackageLocation("org.openoffice.extensions.diagrams.Diagrams");
XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, m_xContext );
XExtensionManager xEM = (XExtensionManager) UnoRuntime.queryInterface(XExtensionManager.class, xNameAccess.getByName("/singletons/com.sun.star.deployment.ExtensionManager"));
XMultiComponentFactory xMCF = m_xContext.getServiceManager();
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)
xPM = xPMF.getPackageManager("share");
}
XAbortChannel xACh = xPM.createAbortChannel();
//xEM.disableExtension(xPackage, xACh, xCE);
xEM.removeExtension("org.openoffice.extensions.diagrams.Diagrams", location, "user", xACh, xCE);
boolean isDiagramExtenisonExist = false;
String[][] str = m_xPIP.getExtensionList();
for(int i = 0; i < str.length; i++)
for(int j = 0; j < str[i].length; j++)