Hi, I solved the problem: there was a trailing white space in "com.sun.star.ui.ActionTrigger". As I did not got any exception, maybe there is something wrong with it createInstance but I could not investigate on this...
Regards, Christophe ----- Message d'origine ---- De : "[email protected]" <[email protected]> À : [email protected] Envoyé le : Dimanche, 8 Mars 2009, 1h26mn 58s Objet : [api-dev] Adding menu entry within ContextMenuInterceptor Hi, I'm trying to add a menu entry within my ContextMenuInterceptor but it seems to halt without any reason nor exception. Here is the peace of code: XMultiServiceFactory xMenuElementFactory = (com.sun.star.lang.XMultiServiceFactory)UnoRuntime.queryInterface( com.sun.star.lang.XMultiServiceFactory.class, aEvent.ActionTriggerContainer ); getLogger().println("addContextMenuEntry IN"); XPropertySet xRootMenuEntry = null; try { getLogger().println(null==xMenuElementFactory?"xMenuElementFactory null":"xMenuElementFactory not null"); getLogger().println("create menu entry"); // create menu entry Object obj = xMenuElementFactory.createInstance ( "com.sun.star.ui.ActionTrigger " ); getLogger().println(null==obj?"obj null":"obj not null"); xRootMenuEntry = (XPropertySet)UnoRuntime.queryInterface(com.sun.star.beans.XPropertySet.class,obj); getLogger().println("intialize menu entry"); xRootMenuEntry.setPropertyValue( "Text", text); xRootMenuEntry.setPropertyValue( "CommandURL", command); xContextMenu.insertByIndex ( index, (Object)xRootMenuEntry ); } catch (Exception e) { e.printStackTrace(RegistrationHandler.getLogger()); } getLogger().println("addContextMenuEntry OUT"); And I get the following in my logger: addContextMenuEntry IN xMenuElementFactory not null create menu entry <END-OF-FILE> I do not get the last message (initialize menu entry), and of course I do not get the desired entry in my context menu. I can create a separator, at least it does not stop when creating it although it does not show up in the context menu. Is there any reason why the createInstance never returns or "crashes"? Am I wrong somewhere in my code? Thx Christophe --------------------------------------------------------------------- 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]
