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

Last change on this file since 9074 was 8512, checked in by Don-vip, 9 years ago

checkstyle: redundant modifiers

  • Property svn:eol-style set to native
File size: 5.2 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.tools;
3
4import java.io.File;
5import java.io.IOException;
6import java.security.KeyStore;
7import java.security.KeyStoreException;
8import java.security.NoSuchAlgorithmException;
9import java.security.cert.CertificateException;
10
11/**
12 * This interface allows platform (operating system) dependent code
13 * to be bundled into self-contained classes.
14 * @since 1023
15 */
16public interface PlatformHook {
17
18 /**
19 * The preStartupHook will be called extremly early. It is
20 * guaranteed to be called before the GUI setup has started.
21 *
22 * Reason: On OSX we need to inform the Swing libraries
23 * that we want to be integrated with the OS before we setup our GUI.
24 */
25 void preStartupHook();
26
27 /**
28 * The afterPrefStartupHook will be called early, but after
29 * the preferences have been loaded and basic processing of
30 * command line arguments is finished.
31 * It is guaranteed to be called before the GUI setup has started.
32 */
33 void afterPrefStartupHook();
34
35 /**
36 * The startupHook will be called early, but after the GUI
37 * setup has started.
38 *
39 * Reason: On OSX we need to register some callbacks with the
40 * OS, so we'll receive events from the system menu.
41 */
42 void startupHook();
43
44 /**
45 * The openURL hook will be used to open an URL in the
46 * default web browser.
47 * @param url The URL to open
48 * @throws IOException if any I/O error occurs
49 */
50 void openUrl(String url) throws IOException;
51
52 /**
53 * The initSystemShortcuts hook will be called by the
54 * Shortcut class after the modifier groups have been read
55 * from the config, but before any shortcuts are read from
56 * it or registered from within the application.
57 *
58 * Plese note that you are not allowed to register any
59 * shortuts from this hook, but only "systemCuts"!
60 *
61 * BTW: SystemCuts should be named "system:<whatever>",
62 * and it'd be best if sou'd recycle the names already used
63 * by the Windows and OSX hooks. Especially the later has
64 * really many of them.
65 *
66 * You should also register any and all shortcuts that the
67 * operation system handles itself to block JOSM from trying
68 * to use them---as that would just not work. Call setAutomatic
69 * on them to prevent the keyboard preferences from allowing the
70 * user to change them.
71 */
72 void initSystemShortcuts();
73
74 /**
75 * The makeTooltip hook will be called whenever a tooltip for
76 * a menu or button is created.
77 *
78 * Tooltips are usually not system dependent, unless the
79 * JVM is too dumb to provide correct names for all the keys.
80 *
81 * Another reason not to use the implementation in the *nix
82 * hook are LAFs that don't understand HTML, such as the OSX LAFs.
83 *
84 * @param name Tooltip text to display
85 * @param sc Shortcut associated (to display accelerator between parenthesis)
86 * @return Full tooltip text (name + accelerator)
87 */
88 String makeTooltip(String name, Shortcut sc);
89
90 /**
91 * Returns the default LAF to be used on this platform to look almost as a native application.
92 * @return The default native LAF for this platform
93 */
94 String getDefaultStyle();
95
96 /**
97 * Determines if the platform allows full-screen.
98 * @return {@code true} if full screen is allowed, {@code false} otherwise
99 */
100 boolean canFullscreen();
101
102 /**
103 * Renames a file.
104 * @param from Source file
105 * @param to Target file
106 * @return {@code true} if the file has been renamed, {@code false} otherwise
107 */
108 boolean rename(File from, File to);
109
110 /**
111 * Returns a detailed OS description (at least family + version).
112 * @return A detailed OS description.
113 * @since 5850
114 */
115 String getOSDescription();
116
117 /**
118 * Setup system keystore to add JOSM HTTPS certificate (for remote control).
119 * @param entryAlias The entry alias to use
120 * @param trustedCert the JOSM certificate for localhost
121 * @return {@code true} if something has changed as a result of the call (certificate installation, etc.)
122 * @throws KeyStoreException in case of error
123 * @throws IOException in case of error
124 * @throws CertificateException in case of error
125 * @throws NoSuchAlgorithmException in case of error
126 * @since 7343
127 */
128 boolean setupHttpsCertificate(String entryAlias, KeyStore.TrustedCertificateEntry trustedCert)
129 throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException;
130
131 /**
132 * Returns the platform-dependent default cache directory.
133 * @return the platform-dependent default cache directory
134 * @since 7829
135 */
136 File getDefaultCacheDirectory();
137
138 /**
139 * Returns the platform-dependent default preferences directory.
140 * @return the platform-dependent default preferences directory
141 * @since 7831
142 */
143 File getDefaultPrefDirectory();
144
145 /**
146 * Returns the platform-dependent default user data directory.
147 * @return the platform-dependent default user data directory
148 * @since 7834
149 */
150 File getDefaultUserDataDirectory();
151}
Note: See TracBrowser for help on using the repository browser.