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

Last change on this file since 4203 was 4203, checked in by stoecker, 13 years ago

fix #6544 - fix NPE

  • Property svn:eol-style set to native
File size: 3.9 KB
Line 
1// License: GPL. Copyright 2007 by Immanuel Scholz and others
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 initShortcutGroups hook will be called by the
56 * Shortcut class if it detects that there are no
57 * groups in teh config file. So that will happen
58 * once on each JOSM installation only.
59 *
60 * Please note that ShorCut will load its config on demand,
61 * that is, at the moment the first shortcut is registered.
62 *
63 * In this hook, you have to fill the preferences with
64 * data, not the internal structures! Also, do not try
65 * to register any shortcuts from within.
66 */
67 public void initShortcutGroups();
68
69 /**
70 * The initSystemShortcuts hook will be called by the
71 * Shortcut class after the modifier groups have been read
72 * from the config, but before any shortcuts are read from
73 * it or registered from within the application.
74 *
75 * Plese note that you are not allowed to register any
76 * shortuts from this hook, but only "systemCuts"!
77 *
78 * BTW: SystemCuts should be named "system:<whatever>",
79 * and it'd be best if sou'd recycle the names already used
80 * by the Windows and OSX hooks. Especially the later has
81 * really many of them.
82 *
83 * You should also register any and all shortcuts that the
84 * operation system handles itself to block JOSM from trying
85 * to use them---as that would just not work. Call setAutomatic
86 * on them to prevent the keyboard preferences from allowing the
87 * user to change them.
88 */
89 public void initSystemShortcuts();
90
91 /**
92 * The makeTooltip hook will be called whenever a tooltip for
93 * a menu or button is created.
94 *
95 * Tooltips are usually not system dependent, unless the
96 * JVM is to dumb to provide correct names for all the keys.
97 *
98 * Another reason not to use the implementation in the *nix
99 * hook are LAFs that don't understand HTML, such as the OSX
100 * LAFs.
101 */
102 public String makeTooltip(String name, Shortcut sc);
103
104 public String getDefaultStyle();
105
106 public boolean canFullscreen();
107
108 public boolean rename(File from, File to);
109}
Note: See TracBrowser for help on using the repository browser.