Hi Rony,

Rony G. Flatscher wrote:
Hi Jürgen,

i haven't tested your Java program but i have tested it in Basic and it works as expected


have you had a chance to test it in the meantime (as mentioned, it doesn't work with INFINITE either)? If so, would you qualify this a bug that should get checked into the bug database?

i have slighty modified your example to make use of the simple bootstrap feature. Everything works as expected. It is no bug. There must something else wrong in your environment.

Example:
***********************
import com.sun.star.beans.PropertyValue;
import com.sun.star.container.XHierarchicalNameAccess;
import com.sun.star.frame.XComponentLoader;
import com.sun.star.lang.XComponent;
import com.sun.star.lang.XMultiComponentFactory;
import com.sun.star.reflection.TypeDescriptionSearchDepth;
import com.sun.star.reflection.XTypeDescriptionEnumeration;
import com.sun.star.reflection.XTypeDescriptionEnumerationAccess;
import com.sun.star.uno.TypeClass;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XComponentContext;

public class TestTypeDescription {

    public static void main(String[] args) {
        try {
XComponentContext xCtx = com.sun.star.comp.helper.Bootstrap.bootstrap();

            XMultiComponentFactory xMCF = xCtx.getServiceManager();

XHierarchicalNameAccess tdmgr = (XHierarchicalNameAccess) UnoRuntime.queryInterface(
                   XHierarchicalNameAccess.class,

xCtx.getValueByName("/singletons/com.sun.star.reflection.theTypeDescriptionManager"));

say("\n-------------------- ------------------ ------------------- -----------\n"); XTypeDescriptionEnumerationAccess enumerationAccess = (XTypeDescriptionEnumerationAccess)

UnoRuntime.queryInterface(XTypeDescriptionEnumerationAccess.class, tdmgr);

say("testTypeDescriptionEnumeration(): enumerationAccess:\n\t"+pp(enumerationAccess));

            TypeClass tc[] = {TypeClass.INTERFACE, TypeClass.SERVICE};

XTypeDescriptionEnumeration tdEnum1=null, tdEnum2=null, tdEnum3=null, tdEnum4=null;

            String module="com.sun.star";   // module to analyze

say("Does not work, should enumerate all TypeClass.INTERFACE, TypeClass.SERVICE types:");
            tdEnum1=enumerationAccess.createTypeDescriptionEnumeration(
                module,             // module to analyze
                tc,                 // INTERFACE, SERVICE
TypeDescriptionSearchDepth.INFINITE // enumerate all submodules as well
            );

say("tdEnum1.hasMoreElements()="+pp(""+tdEnum1.hasMoreElements())+"\n");

            say("Does work: no restriction on types to enumerate:");
            tdEnum2=enumerationAccess.createTypeDescriptionEnumeration(
                module,             // module to analyze
new TypeClass[0], // all UNOIDL types, could also use null instead TypeDescriptionSearchDepth.INFINITE // enumerate all submodules as well
            );

say("tdEnum2.hasMoreElements()="+pp(""+tdEnum2.hasMoreElements())+"\n");

            say("Does work: no restriction on types to enumerate:");
            tdEnum3=enumerationAccess.createTypeDescriptionEnumeration(
                module,             // module to analyze
new TypeClass[0], // all UNOIDL types, could also use null instead TypeDescriptionSearchDepth.ONE // enumerate given module only
            );

say("tdEnum3.hasMoreElements()="+pp(""+tdEnum3.hasMoreElements())+"\n");

say("Does NOT work: trying to enumerate interface types only:");
            tdEnum4=enumerationAccess.createTypeDescriptionEnumeration(
                module,             // module to analyze
new TypeClass[] {TypeClass.INTERFACE} , // all UNOIDL types, could also use null instead TypeDescriptionSearchDepth.ONE // enumerate given module only
            );

say("tdEnum4.hasMoreElements()="+pp(""+tdEnum4.hasMoreElements())+"\n");



        } catch(Exception e) {
            System.out.println("Error: ");
            e.printStackTrace();
        }
    }

    public static void say (String s)
    {
        System.err.println(s);
    }

    public static String pp (Object o)
    {
        if (o==null) return "<null> <-- <-- <--";
        return "<"+o+">";
    }
}***********************
Output:
***********************
-------------------- ------------------ ------------------- -----------

testTypeDescriptionEnumeration(): enumerationAccess:

<[Proxy:10519800,2092b20;msci[0];575e2d1113e111da9eee842fdb471df,Type[com.sun.star.reflection.XTypeDescriptionEnumerationAccess]]>
Does not work, should enumerate all TypeClass.INTERFACE, TypeClass.SERVICE types:
tdEnum1.hasMoreElements()=<true>

Does work: no restriction on types to enumerate:
tdEnum2.hasMoreElements()=<true>

Does work: no restriction on types to enumerate:
tdEnum3.hasMoreElements()=<true>

Does NOT work: trying to enumerate interface types only:
tdEnum4.hasMoreElements()=<false>
***********************


Juergen


Regards,

---rony



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to