Hi Ariel, thx again for the example, it gave me a way better understanding for the concept of listeners and dispatch objects.
In my case I used only a base dispatch class (as created by netbeans) and an instance of it, for each control command. All I actually needed yet was a listener helper with correct synchronization and a static map/list combo to store the listeners. Right now I am trying to also disable the controls in the menubar but I think there is a good example for that in the SDK (DisableCommandsTest.java). I would like to ask one more thing related to using an external graphics library for dialogs. I am using Swing to build dialogs since I need to build more complex dialogs than possible with UNO/AWT. Since I am working on a mac I got to learn pretty fast that I have to run AWT/Swing in its own Thread in order to avoid the error: "Apple AWT Java VM was loaded on first thread -- can't start AWT." Naturally this causes that OpenOffice is still accessible while the dialog pops up. So the question is, is there anything like putting OpenOffice to sleep while a dialog is open? best, Fabian On Jan 26, 2012, at 5:29 PM, fabian wrote: > Hi Ariel, > > wow thx for the java example, I appreciate it very much! I will go through > it and figure out what I am doing wrong. > > best, > Fabian > > On Jan 26, 2012, at 2:56 PM, Ariel Constenla-Haile wrote: > >> Hi Fabian, >> >> On Tue, Jan 24, 2012 at 10:04:35PM -0300, Ariel Constenla-Haile wrote: >>> It looks as if you had some issues translating the code from C++ to >>> Java, on the other hand the C++ has some issues if you want to implement >>> it in a real-world use case (where you send status updates according to >>> the current selection, etc). >>> I see if I can write some simple example, real-world oriented. >> >> >> See http://people.apache.org/~arielch/api/ShapeComplexToolbarControl/ >> >> In a lack of imagination, I took the dummy shape example. The extensions >> add a toolbar in Writer with two edit fields, displaying the Title and >> Description of the currently selected shape. Of course, when no shape is >> selected in the current view, the controls are disabled. >> >> Notice that I wrote it fast and without much testing, so be warned. >> >> This is a complex subject, so the better way to understand it is to >> select "Debug Extension in Target OpenOffice.org" inside NetBeans, set >> break point on the ProtocolHandler implementation, and start debugging >> specially from queryDispatch(). >> >> >> Regards >> -- >> Ariel Constenla-Haile >> La Plata, Argentina >
