1Using the Eclipse project SwtMenuBar 2------------------------------------ 3 4This project provides a platform-specific way to hook into 5the default OS menu bar. 6 7On MacOS, it allows an SWT app to have an About menu item 8and to hook into the default Preferences menu item. 9 10On Windows and Linux, an SWT Menu should be provided (typically 11named "Tools") into which the About and Options menu items 12will be added. 13 14 15Consequently the implementation contains platform-specific source 16folders for the Java files that rely on a platform-specific version 17of SWT.jar. 18 19Right now we have the following source folders: 20- src/ - Generic implementation for all platforms. 21- src-darwin/ - Implementation for MacOS Carbon. 22 23*Only* the default "src/" folder is declared in the project .classpath 24so that the project can be opened in Eclipse on any platform and still 25work. However that means that on MacOS the custom src-darwin folder is 26not used by default. 27 28 29 301- To build the library: 31 32Do not use Eclipse to build the library. Instead use the makefile: 33 34$ cd $TOP_OF_ANDROID_TREE 35$ . build/envsetup.sh && lunch sdk-eng 36$ make swtmenubar 37 38This will create a Jar in <Android tree>/out/host/<platform>/framework/ 39that can then be included in the target application. 40 41 422- To use the library in a target application: 43 44Build the swtmenubar library as explained in step 1. 45 46In the target application, define a classpath variable in Eclipse: 47- Open Preferences > Java > Build Path > Classpath Variables 48- Create a new classpath variable named ANDROID_OUT_FRAMEWORK 49- Set its folder value to <Android tree>/out/host/<platform>/framework 50 51Then add a variable to the Build Path of the target project: 52- Open Project > Properties > Java Build Path 53- Select the "Libraries" tab 54- Use "Add Variable" 55- Select ANDROID_OUT_FRAMEWORK 56- Select "Extend..." 57- Select swtmenubar.jar (which you previously built at step 1) 58 59 603- Tip for developing this library: 61 62Keep in mind that src-darwin folder must not be added to the 63source folder list, otherwise the library would not compile 64on Windows or Linux. 65 66If you change anything to IMenuBarCallback, make sure to test 67on a Mac to be sure you're not breaking the API. 68 69To work on this on a Mac, you can either: 70a- simply temporarily add src-darwin as a source folder to the 71 build path and remove it before submitting. 72b- or directly edit the java files and rebuild the library using 73 'make swtmenubar' from a shell. 74 75To test the library, use 'make swtmenubar'. This will build the 76library in out/... and the sdkmanager project is already setup 77to find it there. 78 79-- 80EOF 81