source: josm/trunk/src/org/openstreetmap/josm/tools/PlatformHook.java@ 1058

Last change on this file since 1058 was 1047, checked in by cbrill, 16 years ago

[Cleanup] Remove unused imports and unused variables, part 2

This cleanup does not include static imports for translation

File size: 3.6 KB
Line 
1// License: GPL. Copyright 2007 by Immanuel Scholz and others
2package org.openstreetmap.josm.tools;
3
4import static org.openstreetmap.josm.tools.I18n.tr;
5import org.openstreetmap.josm.tools.ShortCut;
6
7import java.io.IOException;
8
9/**
10 * This interface allows platfrom (operating system) dependent code
11 * to be bundled into self-contained classes.
12 *
13 * For plugin authors:
14 * To implement your own PlatformHook class, implement this interface,
15 * then create the class when your plugin is loaded and store it in
16 * Main.platform. Please not that the two "startup" hooks will be
17 * called _before_ your plugin is loaded. If you need to hook there,
18 * split your class into two (one containing only the startup hooks,
19 * and one with the remainder) and send the startup class, together
20 * with propper OS detection code (see Main) for inclusion with
21 * JOSM to the JOSM team.
22 *
23 * Also, it might be a good idea to extend PlatformHookUnixoid.
24 * That class has a more or less neutral behaviour, that should
25 * work on all platforms supported by J2SE.
26 *
27 * Attention: At this time this interface is not to be considered
28 * complete.
29 */
30public interface PlatformHook {
31 /**
32 * The preStartupHook will be called extremly early. It is
33 * guaranteed to be called before the GUI setup has started.
34 *
35 * Reason: On OSX we need to inform the Swing libraries
36 * that we want to be integrated with the OS before we setup
37 * our GUI.
38 */
39 public void preStartupHook();
40
41 /**
42 * The startupHook will be called early, but after the GUI
43 * setup has started.
44 *
45 * Reason: On OSX we need to register some callbacks with the
46 * OS, so we'll receive events from the system menu.
47 */
48 public void startupHook();
49
50 /**
51 * The openURL hook will be used to open an URL in the
52 * default webbrowser.
53 */
54 public void openUrl(String url) throws IOException;
55
56 /**
57 * The initShortCutGroups hook will be called by the
58 * ShortCut class if it detects that there are no
59 * groups in teh config file. So that will happen
60 * once on each JOSM installation only.
61 *
62 * Please note that ShorCut will load its config on demand,
63 * that is, at the moment the first shortcut is registered.
64 *
65 * In this hook, you have to fill the preferences with
66 * data, not the internal structures! Also, do not try
67 * to register any shortcuts from within.
68 */
69 public void initShortCutGroups();
70
71 /**
72 * The initSystemShortCuts hook will be called by the
73 * ShortCut class after the modifier groups have been read
74 * from the config, but before any shortcuts are read from
75 * it or registered from within the application.
76 *
77 * Plese note that you are not allowed to register any
78 * shortuts from this hook, but only "systemCuts"!
79 *
80 * BTW: SystemCuts should be named "system:<whatever>",
81 * and it'd be best if sou'd recycle the names already used
82 * by the Windows and OSX hooks. Especially the later has
83 * really many of them.
84 *
85 * You should also register any and all shortcuts that the
86 * operation system handles itself to block JOSM from trying
87 * to use them---as that would just not work. Call setAutomatic
88 * on them to prevent the keyboard preferences from allowing the
89 * user to change them.
90 */
91 public void initSystemShortCuts();
92
93 /**
94 * The makeTooltip hook will be called whenever a tooltip for
95 * a menu or button is created.
96 *
97 * Tooltips are usually not system dependent, unless the
98 * JVM is to dumb to provide correct names for all the keys.
99 *
100 * Another reason not to use the implementation in the *nix
101 * hook are LAFs that don't understand HTML, such as the OSX
102 * LAFs.
103 */
104 public String makeTooltip(String name, ShortCut sc);
105}
Note: See TracBrowser for help on using the repository browser.