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

Last change on this file since 6380 was 6380, checked in by Don-vip, 11 years ago

update license/copyright information

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