README
1 Using the Eclipse project SwtMenuBar
2 ------------------------------------
3
4 This project provides a platform-specific way to hook into
5 the default OS menu bar.
6
7 On MacOS, it allows an SWT app to have an About menu item
8 and to hook into the default Preferences menu item.
9
10 On Windows and Linux, an SWT Menu should be provided (typically
11 named "Tools") into which the About and Options menu items
12 will be added.
13
14
15 Consequently the implementation contains platform-specific source
16 folders for the Java files that rely on a platform-specific version
17 of SWT.jar.
18
19 Right 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
24 so that the project can be opened in Eclipse on any platform and still
25 work. However that means that on MacOS the custom src-darwin folder is
26 not used by default.
27
28
29
30 1- To build the library:
31
32 Do 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
38 This will create a Jar in <Android tree>/out/host/<platform>/framework/
39 that can then be included in the target application.
40
41
42 2- To use the library in a target application:
43
44 Build the swtmenubar library as explained in step 1.
45
46 In 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
51 Then 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
60 3- Tip for developing this library:
61
62 Keep in mind that src-darwin folder must not be added to the
63 source folder list, otherwise the library would not compile
64 on Windows or Linux.
65
66 If you change anything to IMenuBarCallback, make sure to test
67 on a Mac to be sure you're not breaking the API.
68
69 To work on this on a Mac, you can either:
70 a- simply temporarily add src-darwin as a source folder to the
71 build path and remove it before submitting.
72 b- or directly edit the java files and rebuild the library using
73 'make swtmenubar' from a shell.
74
75 To test the library, use 'make swtmenubar'. This will build the
76 library in out/... and the sdkmanager project is already setup
77 to find it there.
78
79 --
80 EOF
81