Search in sources :

Example 1 with XRegistryKey

use of com.sun.star.registry.XRegistryKey in project zotero-libreoffice-integration by zotero.

the class RegistrationHandler method __writeRegistryServiceInfo.

/**
 * Writes the services implementation informations to the UNO registry.
 *
 * <p>This method calls all the methods of the same name from the classes listed
 * in the <code>RegistrationHandler.classes</code> file. <strong>This method
 * should not be modified.</strong></p>
 *
 * @param pRegistryKey the root registry key where to write the informations.
 *
 * @return <code>true</code> if the informations have been successfully written
 *	  to the registry key, <code>false</code> otherwise.
 */
@SuppressWarnings("unchecked")
public static boolean __writeRegistryServiceInfo(XRegistryKey xRegistryKey) {
    Class[] classes = findServicesImplementationClasses();
    boolean success = true;
    int i = 0;
    while (i < classes.length && success) {
        Class clazz = classes[i];
        try {
            Class[] writeTypes = new Class[] { XRegistryKey.class };
            Method getFactoryMethod = clazz.getMethod("__writeRegistryServiceInfo", writeTypes);
            Object o = getFactoryMethod.invoke(null, xRegistryKey);
            success = success && ((Boolean) o).booleanValue();
        } catch (Exception e) {
            success = false;
            e.printStackTrace();
        }
        i++;
    }
    return success;
}
Also used : XRegistryKey(com.sun.star.registry.XRegistryKey) Method(java.lang.reflect.Method) IOException(java.io.IOException)

Aggregations

XRegistryKey (com.sun.star.registry.XRegistryKey)1 IOException (java.io.IOException)1 Method (java.lang.reflect.Method)1