Mercurial > projects > dwt-addons
comparison dwtx/core/runtime/Platform.d @ 158:25f1f92fa3df
...
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Tue, 26 Aug 2008 02:46:34 +0200 |
parents | |
children | 7926b636c282 |
comparison
equal
deleted
inserted
replaced
157:7f75eaa8103a | 158:25f1f92fa3df |
---|---|
1 /******************************************************************************* | |
2 * Copyright (c) 2000, 2008 IBM Corporation and others. | |
3 * All rights reserved. This program and the accompanying materials | |
4 * are made available under the terms of the Eclipse Public License v1.0 | |
5 * which accompanies this distribution, and is available at | |
6 * http://www.eclipse.org/legal/epl-v10.html | |
7 * | |
8 * Contributors: | |
9 * IBM Corporation - initial API and implementation | |
10 * Port to the D programming language: | |
11 * Frank Benoit <benoit@tionex.de> | |
12 *******************************************************************************/ | |
13 module dwtx.core.runtime.Platform; | |
14 | |
15 import dwt.dwthelper.utils; | |
16 | |
17 // import java.io.IOException; | |
18 // import java.lang.reflect.Method; | |
19 // import java.net.URL; | |
20 // import java.util.HashMap; | |
21 // import java.util.Map; | |
22 // import java.util.MissingResourceException; | |
23 // import java.util.ResourceBundle; | |
24 // | |
25 // import org.osgi.framework.Bundle; | |
26 // import org.osgi.service.packageadmin.PackageAdmin; | |
27 // | |
28 // import dwtx.core.internal.runtime.CompatibilityHelper; | |
29 // import dwtx.core.internal.runtime.InternalPlatform; | |
30 // import dwtx.core.internal.runtime.Messages; | |
31 // import dwtx.core.internal.runtime.PlatformActivator; | |
32 // import dwtx.core.internal.runtime.auth.AuthorizationHandler; | |
33 // import dwtx.core.runtime.content.IContentTypeManager; | |
34 // import dwtx.core.runtime.jobs.IJobManager; | |
35 // import dwtx.core.runtime.jobs.Job; | |
36 // import dwtx.core.runtime.preferences.IPreferencesService; | |
37 // import dwtx.osgi.service.datalocation.Location; | |
38 // import dwtx.osgi.service.debug.DebugOptions; | |
39 // import dwtx.osgi.service.environment.EnvironmentInfo; | |
40 // import dwtx.osgi.service.resolver.PlatformAdmin; | |
41 | |
42 /** | |
43 * The central class of the Eclipse Platform Runtime. This class cannot | |
44 * be instantiated or subclassed by clients; all functionality is provided | |
45 * by static methods. Features include: | |
46 * <ul> | |
47 * <li>the platform registry of installed plug-ins</li> | |
48 * <li>the platform adapter manager</li> | |
49 * <li>the platform log</li> | |
50 * <li>the authorization info management</li> | |
51 * </ul> | |
52 * <p> | |
53 * Most users don't have to worry about Platform's lifecycle. However, if your | |
54 * code can call methods of this class when Platform is not running, it becomes | |
55 * necessary to check {@link #isRunning()} before making the call. A runtime | |
56 * exception might be thrown or incorrect result might be returned if a method | |
57 * from this class is called while Platform is not running. | |
58 * </p> | |
59 */ | |
60 public final class Platform { | |
61 | |
62 // /** | |
63 // * The unique identifier constant (value "<code>dwtx.core.runtime</code>") | |
64 // * of the Core Runtime (pseudo-) plug-in. | |
65 // */ | |
66 // public static final String PI_RUNTIME = "dwtx.core.runtime"; //$NON-NLS-1$ | |
67 // | |
68 // /** | |
69 // * The simple identifier constant (value "<code>applications</code>") of | |
70 // * the extension point of the Core Runtime plug-in where plug-ins declare | |
71 // * the existence of runnable applications. A plug-in may define any | |
72 // * number of applications; however, the platform is only capable | |
73 // * of running one application at a time. | |
74 // * | |
75 // */ | |
76 // public static final String PT_APPLICATIONS = "applications"; //$NON-NLS-1$ | |
77 // | |
78 // /** | |
79 // * The simple identifier constant (value "<code>adapters</code>") of | |
80 // * the extension point of the Core Runtime plug-in where plug-ins declare | |
81 // * the existence of adapter factories. A plug-in may define any | |
82 // * number of adapters. | |
83 // * | |
84 // * @see IAdapterManager#hasAdapter(Object, String) | |
85 // * @since 3.0 | |
86 // */ | |
87 // public static final String PT_ADAPTERS = "adapters"; //$NON-NLS-1$ | |
88 // | |
89 // /** | |
90 // * The simple identifier constant (value "<code>preferences</code>") of | |
91 // * the extension point of the Core Runtime plug-in where plug-ins declare | |
92 // * extensions to the preference facility. A plug-in may define any number | |
93 // * of preference extensions. | |
94 // * | |
95 // * @see #getPreferencesService() | |
96 // * @since 3.0 | |
97 // */ | |
98 // public static final String PT_PREFERENCES = Preferences.PT_PREFERENCES; | |
99 // | |
100 // /** | |
101 // * The simple identifier constant (value "<code>products</code>") of | |
102 // * the extension point of the Core Runtime plug-in where plug-ins declare | |
103 // * the existence of a product. A plug-in may define any | |
104 // * number of products; however, the platform is only capable | |
105 // * of running one product at a time. | |
106 // * | |
107 // * @see #getProduct() | |
108 // * @since 3.0 | |
109 // */ | |
110 // public static final String PT_PRODUCT = "products"; //$NON-NLS-1$ | |
111 // | |
112 // /** | |
113 // * Debug option value denoting the time at which the platform runtime | |
114 // * was started. This constant can be used in conjunction with | |
115 // * <code>getDebugOption</code> to find the string value of | |
116 // * <code>System.currentTimeMillis()</code> when the platform was started. | |
117 // */ | |
118 // public static final String OPTION_STARTTIME = PI_RUNTIME + "/starttime"; //$NON-NLS-1$ | |
119 // | |
120 // /** | |
121 // * Name of a preference for configuring the performance level for this system. | |
122 // * | |
123 // * <p> | |
124 // * This value can be used by all components to customize features to suit the | |
125 // * speed of the user's machine. The platform job manager uses this value to make | |
126 // * scheduling decisions about background jobs. | |
127 // * </p> | |
128 // * <p> | |
129 // * The preference value must be an integer between the constant values | |
130 // * MIN_PERFORMANCE and MAX_PERFORMANCE | |
131 // * </p> | |
132 // * @see #MIN_PERFORMANCE | |
133 // * @see #MAX_PERFORMANCE | |
134 // * @since 3.0 | |
135 // */ | |
136 // public static final String PREF_PLATFORM_PERFORMANCE = "runtime.performance"; //$NON-NLS-1$ | |
137 // | |
138 // /** | |
139 // * Constant (value "line.separator") name of the preference used for storing | |
140 // * the line separator. | |
141 // * | |
142 // * @see #knownPlatformLineSeparators | |
143 // * @since 3.1 | |
144 // */ | |
145 // public static final String PREF_LINE_SEPARATOR = "line.separator"; //$NON-NLS-1$ | |
146 // | |
147 // /** | |
148 // * Constant (value 1) indicating the minimum allowed value for the | |
149 // * <code>PREF_PLATFORM_PERFORMANCE</code> preference setting. | |
150 // * @since 3.0 | |
151 // */ | |
152 // public static final int MIN_PERFORMANCE = 1; | |
153 // | |
154 // /** | |
155 // * Constant (value 5) indicating the maximum allowed value for the | |
156 // * <code>PREF_PLATFORM_PERFORMANCE</code> preference setting. | |
157 // * @since 3.0 | |
158 // */ | |
159 // public static final int MAX_PERFORMANCE = 5; | |
160 // | |
161 // /** | |
162 // * Status code constant (value 1) indicating a problem in a plug-in | |
163 // * manifest (<code>plugin.xml</code>) file. | |
164 // */ | |
165 // public static final int PARSE_PROBLEM = 1; | |
166 // | |
167 // /** | |
168 // * Status code constant (value 2) indicating an error occurred while running a plug-in. | |
169 // */ | |
170 // public static final int PLUGIN_ERROR = 2; | |
171 // | |
172 // /** | |
173 // * Status code constant (value 3) indicating an error internal to the | |
174 // * platform has occurred. | |
175 // */ | |
176 // public static final int INTERNAL_ERROR = 3; | |
177 // | |
178 // /** | |
179 // * Status code constant (value 4) indicating the platform could not read | |
180 // * some of its metadata. | |
181 // */ | |
182 // public static final int FAILED_READ_METADATA = 4; | |
183 // | |
184 // /** | |
185 // * Status code constant (value 5) indicating the platform could not write | |
186 // * some of its metadata. | |
187 // */ | |
188 // public static final int FAILED_WRITE_METADATA = 5; | |
189 // | |
190 // /** | |
191 // * Status code constant (value 6) indicating the platform could not delete | |
192 // * some of its metadata. | |
193 // */ | |
194 // public static final int FAILED_DELETE_METADATA = 6; | |
195 // | |
196 // /** | |
197 // * Constant string (value "win32") indicating the platform is running on a | |
198 // * Window 32-bit operating system (e.g., Windows 98, NT, 2000). | |
199 // * <p> | |
200 // * Note this constant has been moved from the deprecated | |
201 // * dwtx.core.boot.BootLoader class and its value has not changed. | |
202 // * </p> | |
203 // * @since 3.0 | |
204 // */ | |
205 // public static final String OS_WIN32 = "win32";//$NON-NLS-1$ | |
206 // | |
207 // /** | |
208 // * Constant string (value "linux") indicating the platform is running on a | |
209 // * Linux-based operating system. | |
210 // * <p> | |
211 // * Note this constant has been moved from the deprecated | |
212 // * dwtx.core.boot.BootLoader class and its value has not changed. | |
213 // * </p> | |
214 // * @since 3.0 | |
215 // */ | |
216 // public static final String OS_LINUX = "linux";//$NON-NLS-1$ | |
217 // | |
218 // /** | |
219 // * Constant string (value "aix") indicating the platform is running on an | |
220 // * AIX-based operating system. | |
221 // * <p> | |
222 // * Note this constant has been moved from the deprecated | |
223 // * dwtx.core.boot.BootLoader class and its value has not changed. | |
224 // * </p> | |
225 // * @since 3.0 | |
226 // */ | |
227 // public static final String OS_AIX = "aix";//$NON-NLS-1$ | |
228 // | |
229 // /** | |
230 // * Constant string (value "solaris") indicating the platform is running on a | |
231 // * Solaris-based operating system. | |
232 // * <p> | |
233 // * Note this constant has been moved from the deprecated | |
234 // * dwtx.core.boot.BootLoader class and its value has not changed. | |
235 // * </p> | |
236 // * @since 3.0 | |
237 // */ | |
238 // public static final String OS_SOLARIS = "solaris";//$NON-NLS-1$ | |
239 // | |
240 // /** | |
241 // * Constant string (value "hpux") indicating the platform is running on an | |
242 // * HP/UX-based operating system. | |
243 // * <p> | |
244 // * Note this constant has been moved from the deprecated | |
245 // * dwtx.core.boot.BootLoader class and its value has not changed. | |
246 // * </p> | |
247 // * @since 3.0 | |
248 // */ | |
249 // public static final String OS_HPUX = "hpux";//$NON-NLS-1$ | |
250 // | |
251 // /** | |
252 // * Constant string (value "qnx") indicating the platform is running on a | |
253 // * QNX-based operating system. | |
254 // * <p> | |
255 // * Note this constant has been moved from the deprecated | |
256 // * dwtx.core.boot.BootLoader class and its value has not changed. | |
257 // * </p> | |
258 // * @since 3.0 | |
259 // */ | |
260 // public static final String OS_QNX = "qnx";//$NON-NLS-1$ | |
261 // | |
262 // /** | |
263 // * Constant string (value "macosx") indicating the platform is running on a | |
264 // * Mac OS X operating system. | |
265 // * <p> | |
266 // * Note this constant has been moved from the deprecated | |
267 // * dwtx.core.boot.BootLoader class and its value has not changed. | |
268 // * </p> | |
269 // * @since 3.0 | |
270 // */ | |
271 // public static final String OS_MACOSX = "macosx";//$NON-NLS-1$ | |
272 // | |
273 // /** | |
274 // * Constant string (value "unknown") indicating the platform is running on a | |
275 // * machine running an unknown operating system. | |
276 // * <p> | |
277 // * Note this constant has been moved from the deprecated | |
278 // * dwtx.core.boot.BootLoader class and its value has not changed. | |
279 // * </p> | |
280 // * @since 3.0 | |
281 // */ | |
282 // public static final String OS_UNKNOWN = "unknown";//$NON-NLS-1$ | |
283 // | |
284 // /** | |
285 // * Constant string (value "x86") indicating the platform is running on an | |
286 // * x86-based architecture. | |
287 // * <p> | |
288 // * Note this constant has been moved from the deprecated | |
289 // * dwtx.core.boot.BootLoader class and its value has not changed. | |
290 // * </p> | |
291 // * @since 3.0 | |
292 // */ | |
293 // public static final String ARCH_X86 = "x86";//$NON-NLS-1$ | |
294 // | |
295 // /** | |
296 // * Constant string (value "PA_RISC") indicating the platform is running on an | |
297 // * PA_RISC-based architecture. | |
298 // * <p> | |
299 // * Note this constant has been moved from the deprecated | |
300 // * dwtx.core.boot.BootLoader class and its value has not changed. | |
301 // * </p> | |
302 // * @since 3.0 | |
303 // */ | |
304 // public static final String ARCH_PA_RISC = "PA_RISC";//$NON-NLS-1$ | |
305 // | |
306 // /** | |
307 // * Constant string (value "ppc") indicating the platform is running on an | |
308 // * PowerPC-based architecture. | |
309 // * <p> | |
310 // * Note this constant has been moved from the deprecated | |
311 // * dwtx.core.boot.BootLoader class and its value has not changed. | |
312 // * </p> | |
313 // * @since 3.0 | |
314 // */ | |
315 // public static final String ARCH_PPC = "ppc";//$NON-NLS-1$ | |
316 // | |
317 // /** | |
318 // * Constant string (value "sparc") indicating the platform is running on an | |
319 // * Sparc-based architecture. | |
320 // * <p> | |
321 // * Note this constant has been moved from the deprecated | |
322 // * dwtx.core.boot.BootLoader class and its value has not changed. | |
323 // * </p> | |
324 // * @since 3.0 | |
325 // */ | |
326 // public static final String ARCH_SPARC = "sparc";//$NON-NLS-1$ | |
327 // | |
328 // /** | |
329 // * Constant string (value "x86_64") indicating the platform is running on an | |
330 // * x86 64bit-based architecture. | |
331 // * | |
332 // * @since 3.1 | |
333 // */ | |
334 // public static final String ARCH_X86_64 = "x86_64";//$NON-NLS-1$ | |
335 // | |
336 // /** | |
337 // * Constant string (value "amd64") indicating the platform is running on an | |
338 // * AMD64-based architecture. | |
339 // * | |
340 // * @since 3.0 | |
341 // * @deprecated use <code>ARCH_X86_64</code> instead. Note the values | |
342 // * has been changed to be the value of the <code>ARCH_X86_64</code> constant. | |
343 // */ | |
344 // public static final String ARCH_AMD64 = ARCH_X86_64; | |
345 // | |
346 // /** | |
347 // * Constant string (value "ia64") indicating the platform is running on an | |
348 // * IA64-based architecture. | |
349 // * | |
350 // * @since 3.0 | |
351 // */ | |
352 // public static final String ARCH_IA64 = "ia64"; //$NON-NLS-1$ | |
353 // | |
354 // /** | |
355 // * Constant string (value "ia64_32") indicating the platform is running on an | |
356 // * IA64 32bit-based architecture. | |
357 // * | |
358 // * @since 3.1 | |
359 // */ | |
360 // public static final String ARCH_IA64_32 = "ia64_32";//$NON-NLS-1$ | |
361 // | |
362 // /** | |
363 // * Constant string (value "win32") indicating the platform is running on a | |
364 // * machine using the Windows windowing system. | |
365 // * <p> | |
366 // * Note this constant has been moved from the deprecated | |
367 // * dwtx.core.boot.BootLoader class and its value has not changed. | |
368 // * </p> | |
369 // * @since 3.0 | |
370 // */ | |
371 // public static final String WS_WIN32 = "win32";//$NON-NLS-1$ | |
372 // | |
373 // /** | |
374 // * Constant string (value "motif") indicating the platform is running on a | |
375 // * machine using the Motif windowing system. | |
376 // * <p> | |
377 // * Note this constant has been moved from the deprecated | |
378 // * dwtx.core.boot.BootLoader class and its value has not changed. | |
379 // * </p> | |
380 // * @since 3.0 | |
381 // */ | |
382 // public static final String WS_MOTIF = "motif";//$NON-NLS-1$ | |
383 // | |
384 // /** | |
385 // * Constant string (value "gtk") indicating the platform is running on a | |
386 // * machine using the GTK windowing system. | |
387 // * <p> | |
388 // * Note this constant has been moved from the deprecated | |
389 // * dwtx.core.boot.BootLoader class and its value has not changed. | |
390 // * </p> | |
391 // * @since 3.0 | |
392 // */ | |
393 // public static final String WS_GTK = "gtk";//$NON-NLS-1$ | |
394 // | |
395 // /** | |
396 // * Constant string (value "photon") indicating the platform is running on a | |
397 // * machine using the Photon windowing system. | |
398 // * <p> | |
399 // * Note this constant has been moved from the deprecated | |
400 // * dwtx.core.boot.BootLoader class and its value has not changed. | |
401 // * </p> | |
402 // * @since 3.0 | |
403 // */ | |
404 // public static final String WS_PHOTON = "photon";//$NON-NLS-1$ | |
405 // | |
406 // /** | |
407 // * Constant string (value "carbon") indicating the platform is running on a | |
408 // * machine using the Carbon windowing system (Mac OS X). | |
409 // * <p> | |
410 // * Note this constant has been moved from the deprecated | |
411 // * dwtx.core.boot.BootLoader class and its value has not changed. | |
412 // * </p> | |
413 // * @since 3.0 | |
414 // */ | |
415 // public static final String WS_CARBON = "carbon";//$NON-NLS-1$ | |
416 // | |
417 // /** | |
418 // * Constant string (value "wpf") indicating the platform is running on a | |
419 // * machine using the WPF windowing system. | |
420 // * @since 3.3 | |
421 // */ | |
422 // public static final String WS_WPF = "wpf";//$NON-NLS-1$ | |
423 // | |
424 // /** | |
425 // * Constant string (value "unknown") indicating the platform is running on a | |
426 // * machine running an unknown windowing system. | |
427 // * <p> | |
428 // * Note this constant has been moved from the deprecated | |
429 // * dwtx.core.boot.BootLoader class and its value has not changed. | |
430 // * </p> | |
431 // * @since 3.0 | |
432 // */ | |
433 // public static final String WS_UNKNOWN = "unknown";//$NON-NLS-1$ | |
434 // | |
435 // // private constants for platform line separators and their associated platform names | |
436 // private static final String LINE_SEPARATOR_KEY_MAC_OS_9 = Messages.line_separator_platform_mac_os_9; | |
437 // private static final String LINE_SEPARATOR_KEY_UNIX = Messages.line_separator_platform_unix; | |
438 // private static final String LINE_SEPARATOR_KEY_WINDOWS = Messages.line_separator_platform_windows; | |
439 // | |
440 // private static final String LINE_SEPARATOR_VALUE_CR = "\r"; //$NON-NLS-1$ | |
441 // private static final String LINE_SEPARATOR_VALUE_LF = "\n"; //$NON-NLS-1$ | |
442 // private static final String LINE_SEPARATOR_VALUE_CRLF = "\r\n"; //$NON-NLS-1$ | |
443 // | |
444 // /** | |
445 // * Private constructor to block instance creation. | |
446 // */ | |
447 // private Platform() { | |
448 // super(); | |
449 // } | |
450 // | |
451 // /** | |
452 // * Adds the given authorization information to the key ring. The | |
453 // * information is relevant for the specified protection space and the | |
454 // * given authorization scheme. The protection space is defined by the | |
455 // * combination of the given server URL and realm. The authorization | |
456 // * scheme determines what the authorization information contains and how | |
457 // * it should be used. The authorization information is a <code>Map</code> | |
458 // * of <code>String</code> to <code>String</code> and typically | |
459 // * contains information such as user names and passwords. | |
460 // * | |
461 // * @param serverUrl the URL identifying the server for this authorization | |
462 // * information. For example, "http://www.example.com/". | |
463 // * @param realm the subsection of the given server to which this | |
464 // * authorization information applies. For example, | |
465 // * "realm1@example.com" or "" for no realm. | |
466 // * @param authScheme the scheme for which this authorization information | |
467 // * applies. For example, "Basic" or "" for no authorization scheme | |
468 // * @param info a <code>Map</code> containing authorization information | |
469 // * such as user names and passwords (key type : <code>String</code>, | |
470 // * value type : <code>String</code>) | |
471 // * @exception CoreException if there are problems setting the | |
472 // * authorization information. Reasons include: | |
473 // * <ul> | |
474 // * <li>The keyring could not be saved.</li> | |
475 // * </ul> | |
476 // * @deprecated Authorization database is superseded by the Equinox secure storage. | |
477 // * Use <code>dwtx.equinox.security.storage.SecurePreferencesFactory</code> | |
478 // * to obtain secure preferences and <code>dwtx.equinox.security.storage.ISecurePreferences</code> | |
479 // * for data access and modifications. | |
480 // * Consider using <code>ISecurePreferences#put(String, String, bool)</code> as a replacement of this method. | |
481 // */ | |
482 // public static void addAuthorizationInfo(URL serverUrl, String realm, String authScheme, Map info) throws CoreException { | |
483 // try { | |
484 // AuthorizationHandler.addAuthorizationInfo(serverUrl, realm, authScheme, info); | |
485 // } catch (NoClassDefFoundError e) { | |
486 // // The authorization code is not available so just log and continue | |
487 // logAuthNotAvailable(e); | |
488 // } | |
489 // } | |
490 // | |
491 // /** | |
492 // * Adds the given log listener to the notification list of the platform. | |
493 // * <p> | |
494 // * Once registered, a listener starts receiving notification as entries | |
495 // * are added to plug-in logs via <code>ILog.log()</code>. The listener continues to | |
496 // * receive notifications until it is replaced or removed. | |
497 // * </p> | |
498 // * | |
499 // * @param listener the listener to register | |
500 // * @see ILog#addLogListener(ILogListener) | |
501 // * @see #removeLogListener(ILogListener) | |
502 // * XXX Use the LogMgr service. | |
503 // */ | |
504 // public static void addLogListener(ILogListener listener) { | |
505 // InternalPlatform.getDefault().addLogListener(listener); | |
506 // } | |
507 // | |
508 // /** | |
509 // * Adds the specified resource to the protection space specified by the | |
510 // * given realm. All targets at or deeper than the depth of the last | |
511 // * symbolic element in the path of the given resource URL are assumed to | |
512 // * be in the same protection space. | |
513 // * | |
514 // * @param resourceUrl the URL identifying the resources to be added to | |
515 // * the specified protection space. For example, | |
516 // * "http://www.example.com/folder/". | |
517 // * @param realm the name of the protection space. For example, | |
518 // * "realm1@example.com" | |
519 // * @exception CoreException if there are problems setting the | |
520 // * authorization information. Reasons include: | |
521 // * <ul> | |
522 // * <li>The key ring could not be saved.</li> | |
523 // * </ul> | |
524 // * @deprecated Authorization database is superseded by the Equinox secure storage. | |
525 // * Use <code>dwtx.equinox.security.storage.SecurePreferencesFactory</code> | |
526 // * to obtain secure preferences and <code>dwtx.equinox.security.storage.ISecurePreferences</code> | |
527 // * for data access and modifications. | |
528 // */ | |
529 // public static void addProtectionSpace(URL resourceUrl, String realm) throws CoreException { | |
530 // try { | |
531 // AuthorizationHandler.addProtectionSpace(resourceUrl, realm); | |
532 // } catch (NoClassDefFoundError e) { | |
533 // // The authorization code is not available so just log and continue | |
534 // logAuthNotAvailable(e); | |
535 // } | |
536 // } | |
537 // | |
538 // /** | |
539 // * Returns a URL that is the local equivalent of the | |
540 // * supplied URL. This method is expected to be used with the | |
541 // * plug-in-relative URLs returned by IPluginDescriptor, Bundle.getEntry() | |
542 // * and Platform.find(). | |
543 // * If the specified URL is not a plug-in-relative URL, it | |
544 // * is returned as is. If the specified URL is a plug-in-relative | |
545 // * URL of a file (including .jar archive), it is returned as | |
546 // * a locally accessible URL using "file:" protocol | |
547 // * (extracting/caching the file locally, if required). If the specified URL | |
548 // * is a plug-in-relative URL of a directory, the directory and any files and directories | |
549 // * under it are made locally accessible likewise. | |
550 // * | |
551 // * @param url original plug-in-relative URL. | |
552 // * @return the resolved URL | |
553 // * @exception IOException if unable to resolve URL | |
554 // * @see #resolve(URL) | |
555 // * @see #find(Bundle, IPath) | |
556 // * @see Bundle#getEntry(String) | |
557 // * @deprecated use {@link FileLocator#toFileURL(URL)} instead | |
558 // */ | |
559 // public static URL asLocalURL(URL url) throws IOException { | |
560 // return FileLocator.toFileURL(url); | |
561 // } | |
562 // | |
563 // /** | |
564 // * Takes down the splash screen if one was put up. | |
565 // * XXX this is application life cycle. Need to have the appropriate method on IApplication. | |
566 // */ | |
567 // public static void endSplash() { | |
568 // InternalPlatform.getDefault().endSplash(); | |
569 // } | |
570 // | |
571 // /** | |
572 // * Removes the authorization information for the specified protection | |
573 // * space and given authorization scheme. The protection space is defined | |
574 // * by the given server URL and realm. | |
575 // * | |
576 // * @param serverUrl the URL identifying the server to remove the | |
577 // * authorization information for. For example, | |
578 // * "http://www.example.com/". | |
579 // * @param realm the subsection of the given server to remove the | |
580 // * authorization information for. For example, | |
581 // * "realm1@example.com" or "" for no realm. | |
582 // * @param authScheme the scheme for which the authorization information | |
583 // * to remove applies. For example, "Basic" or "" for no | |
584 // * authorization scheme. | |
585 // * @exception CoreException if there are problems removing the | |
586 // * authorization information. Reasons include: | |
587 // * <ul> | |
588 // * <li>The keyring could not be saved.</li> | |
589 // * </ul> | |
590 // * @deprecated Authorization database is superseded by the Equinox secure storage. | |
591 // * Use <code>dwtx.equinox.security.storage.SecurePreferencesFactory</code> | |
592 // * to obtain secure preferences and <code>dwtx.equinox.security.storage.ISecurePreferences</code> | |
593 // * for data access and modifications. | |
594 // * Consider using <code>ISecurePreferences#clear()</code> as a replacement of this method. | |
595 // */ | |
596 // public static void flushAuthorizationInfo(URL serverUrl, String realm, String authScheme) throws CoreException { | |
597 // try { | |
598 // AuthorizationHandler.flushAuthorizationInfo(serverUrl, realm, authScheme); | |
599 // } catch (NoClassDefFoundError e) { | |
600 // // The authorization code is not available so just log and continue | |
601 // logAuthNotAvailable(e); | |
602 // } | |
603 // } | |
604 // | |
605 // private static void logAuthNotAvailable(Throwable e) { | |
606 // InternalPlatform.getDefault().log(new Status(IStatus.WARNING, Platform.PI_RUNTIME, 0, Messages.auth_notAvailable, null)); | |
607 // } | |
608 // | |
609 // /** | |
610 // * Returns the adapter manager used for extending | |
611 // * <code>IAdaptable</code> objects. | |
612 // * | |
613 // * @return the adapter manager for this platform | |
614 // * @see IAdapterManager | |
615 // * XXX register as a service (same pattern than Jobs) | |
616 // * Do we want to make it available as a singleton? | |
617 // */ | |
618 // public static IAdapterManager getAdapterManager() { | |
619 // return InternalPlatform.getDefault().getAdapterManager(); | |
620 // } | |
621 // | |
622 // /** | |
623 // * Returns the authorization information for the specified protection | |
624 // * space and given authorization scheme. The protection space is defined | |
625 // * by the given server URL and realm. Returns <code>null</code> if no | |
626 // * such information exists. | |
627 // * | |
628 // * @param serverUrl the URL identifying the server for the authorization | |
629 // * information. For example, "http://www.example.com/". | |
630 // * @param realm the subsection of the given server to which the | |
631 // * authorization information applies. For example, | |
632 // * "realm1@example.com" or "" for no realm. | |
633 // * @param authScheme the scheme for which the authorization information | |
634 // * applies. For example, "Basic" or "" for no authorization scheme | |
635 // * @return the authorization information for the specified protection | |
636 // * space and given authorization scheme, or <code>null</code> if no | |
637 // * such information exists | |
638 // * @deprecated Authorization database is superseded by the Equinox secure storage. | |
639 // * Use <code>dwtx.equinox.security.storage.SecurePreferencesFactory</code> | |
640 // * to obtain secure preferences and <code>dwtx.equinox.security.storage.ISecurePreferences</code> | |
641 // * for data access and modifications. | |
642 // * Consider using <code>ISecurePreferences#get(String, String)</code> as a replacement of this method. | |
643 // */ | |
644 // public static Map getAuthorizationInfo(URL serverUrl, String realm, String authScheme) { | |
645 // try { | |
646 // return AuthorizationHandler.getAuthorizationInfo(serverUrl, realm, authScheme); | |
647 // } catch (NoClassDefFoundError e) { | |
648 // // The authorization code is not available so just log and continue | |
649 // logAuthNotAvailable(e); | |
650 // } | |
651 // return null; | |
652 // } | |
653 // | |
654 // /** | |
655 // * Returns the command line args provided to the Eclipse runtime layer when it was first run. | |
656 // * The returned value does not include arguments consumed by the lower levels of Eclipse | |
657 // * (e.g., OSGi or the launcher). | |
658 // * Note that individual platform runnables may be provided with different arguments | |
659 // * if they are being run individually rather than with <code>Platform.run()</code>. | |
660 // * <p> | |
661 // * Clients are also able to acquire the {@link EnvironmentInfo} service and query it for | |
662 // * the command-line arguments. | |
663 // * </p> | |
664 // * @return the command line used to start the platform | |
665 // */ | |
666 // public static String[] getCommandLineArgs() { | |
667 // return InternalPlatform.getDefault().getCommandLineArgs(); | |
668 // } | |
669 // | |
670 // /** | |
671 // * Returns the content type manager. | |
672 // * <p> | |
673 // * Clients are also able to acquire the {@link IContentTypeManager} service. | |
674 // * </p> | |
675 // * @return the content type manager | |
676 // * @since 3.0 | |
677 // */ | |
678 // public static IContentTypeManager getContentTypeManager() { | |
679 // return InternalPlatform.getDefault().getContentTypeManager(); | |
680 // } | |
681 | |
682 /** | |
683 * Returns the identified option. <code>null</code> | |
684 * is returned if no such option is found. Options are specified | |
685 * in the general form <i><plug-in id>/<option-path></i>. | |
686 * For example, <code>dwtx.core.runtime/debug</code> | |
687 * <p> | |
688 * Clients are also able to acquire the {@link DebugOptions} service | |
689 * and query it for debug options. | |
690 * </p> | |
691 * @param option the name of the option to lookup | |
692 * @return the value of the requested debug option or <code>null</code> | |
693 */ | |
694 public static String getDebugOption(String option) { | |
695 return true; | |
696 // DWT FIXME: impl | |
697 // return InternalPlatform.getDefault().getOption(option); | |
698 } | |
699 | |
700 // /** | |
701 // * Returns the location of the platform working directory. | |
702 // * <p> | |
703 // * Callers of this method should consider using <code>getInstanceLocation</code> | |
704 // * instead. In various, typically non IDE-related configurations of Eclipse, the platform | |
705 // * working directory may not be on the local file system. As such, the more general | |
706 // * form of this location is as a URL. | |
707 // * </p><p> | |
708 // * Alternatively, instead of calling <code>getInstanceLocation</code> clients are | |
709 // * able to acquire the {@link Location} service (with the type {@link Location#INSTANCE_FILTER}) | |
710 // * and then change the resulting URL to a path. See the javadoc for <code>getInstanceLocation</code> | |
711 // * for more details. | |
712 // * </p> | |
713 // * @return the location of the platform | |
714 // * @see #getInstanceLocation() | |
715 // */ | |
716 // public static IPath getLocation() throws IllegalStateException { | |
717 // return InternalPlatform.getDefault().getLocation(); | |
718 // } | |
719 // | |
720 // /** | |
721 // * Returns the location of the platform log file. This file may contain information | |
722 // * about errors that have previously occurred during this invocation of the Platform. | |
723 // * <p> | |
724 // * It is recommended not to keep this value, as the log location may vary when an instance | |
725 // * location is being set.</p> | |
726 // * <p> | |
727 // * Note: it is very important that users of this method do not leave the log | |
728 // * file open for extended periods of time. Doing so may prevent others | |
729 // * from writing to the log file, which could result in important error messages | |
730 // * being lost. It is strongly recommended that clients wanting to read the | |
731 // * log file for extended periods should copy the log file contents elsewhere, | |
732 // * and immediately close the original file.</p> | |
733 // * @return the path of the log file on disk. | |
734 // * | |
735 // * XXX consider making an ILogger interface that listeners can implements and it allows | |
736 // * us to implement Platform.getLogLocation() | |
737 // */ | |
738 // public static IPath getLogFileLocation() { | |
739 // return InternalPlatform.getDefault().getMetaArea().getLogLocation(); | |
740 // } | |
741 // | |
742 // /** | |
743 // * Returns the plug-in runtime object for the identified plug-in | |
744 // * or <code>null</code> if no such plug-in can be found. If | |
745 // * the plug-in is defined but not yet activated, the plug-in will | |
746 // * be activated before being returned. | |
747 // * <p> | |
748 // * <b>Note</b>: This method is only able to find and return plug-in | |
749 // * objects for plug-ins described using plugin.xml according to the | |
750 // * traditional Eclipse conventions. Eclipse 3.0 permits plug-ins to be | |
751 // * described in manifest.mf files and to define their own bundle | |
752 // * activators. Such plug-ins cannot be discovered by this method.</p> | |
753 // * | |
754 // * @param id the unique identifier of the desired plug-in | |
755 // * (e.g., <code>"com.example.acme"</code>). | |
756 // * @return the plug-in runtime object, or <code>null</code> | |
757 // * @deprecated | |
758 // * This method only works if the compatibility layer is installed and must not be used otherwise. | |
759 // * See the comments on {@link IPluginDescriptor#getPlugin()} for details. | |
760 // */ | |
761 // public static Plugin getPlugin(String id) { | |
762 // try { | |
763 // IPluginRegistry registry = getPluginRegistry(); | |
764 // if (registry is null) | |
765 // throw new IllegalStateException(); | |
766 // IPluginDescriptor pd = registry.getPluginDescriptor(id); | |
767 // if (pd is null) | |
768 // return null; | |
769 // return pd.getPlugin(); | |
770 // } catch (CoreException e) { | |
771 // // TODO log the exception | |
772 // } | |
773 // return null; | |
774 // } | |
775 // | |
776 // /** | |
777 // * Returns the plug-in registry for this platform. | |
778 // * | |
779 // * @return the plug-in registry | |
780 // * @see IPluginRegistry | |
781 // * @deprecated <code>IPluginRegistry</code> was refactored in Eclipse 3.0. | |
782 // * This method only works if the compatibility layer is installed and must not be used otherwise. | |
783 // * See the comments on {@link IPluginRegistry} and its methods for details. | |
784 // */ | |
785 // public static IPluginRegistry getPluginRegistry() { | |
786 // Bundle compatibility = InternalPlatform.getDefault().getBundle(CompatibilityHelper.PI_RUNTIME_COMPATIBILITY); | |
787 // if (compatibility is null) | |
788 // throw new IllegalStateException(); | |
789 // | |
790 // Class oldInternalPlatform = null; | |
791 // try { | |
792 // oldInternalPlatform = compatibility.loadClass("dwtx.core.internal.plugins.InternalPlatform"); //$NON-NLS-1$ | |
793 // Method getPluginRegistry = oldInternalPlatform.getMethod("getPluginRegistry", null); //$NON-NLS-1$ | |
794 // return (IPluginRegistry) getPluginRegistry.invoke(oldInternalPlatform, null); | |
795 // } catch (Exception e) { | |
796 // //Ignore the exceptions, return null | |
797 // } | |
798 // return null; | |
799 // | |
800 // } | |
801 // | |
802 // /** | |
803 // * Returns the location in the local file system of the plug-in | |
804 // * state area for the given plug-in. | |
805 // * The platform must be running. | |
806 // * <p> | |
807 // * The plug-in state area is a file directory within the | |
808 // * platform's metadata area where a plug-in is free to create files. | |
809 // * The content and structure of this area is defined by the plug-in, | |
810 // * and the particular plug-in is solely responsible for any files | |
811 // * it puts there. It is recommended for plug-in preference settings. | |
812 // * </p> | |
813 // * | |
814 // * @param plugin the plug-in whose state location is returned | |
815 // * @return a local file system path | |
816 // * @deprecated clients should call <code>getStateLocation</code> instead | |
817 // */ | |
818 // public static IPath getPluginStateLocation(Plugin plugin) { | |
819 // return plugin.getStateLocation(); | |
820 // } | |
821 // | |
822 // /** | |
823 // * Returns the protection space (realm) for the specified resource, or | |
824 // * <code>null</code> if the realm is unknown. | |
825 // * | |
826 // * @param resourceUrl the URL of the resource whose protection space is | |
827 // * returned. For example, "http://www.example.com/folder/". | |
828 // * @return the protection space (realm) for the specified resource, or | |
829 // * <code>null</code> if the realm is unknown | |
830 // * @deprecated Authorization database is superseded by the Equinox secure storage. | |
831 // * Use <code>dwtx.equinox.security.storage.SecurePreferencesFactory</code> | |
832 // * to obtain secure preferences and <code>dwtx.equinox.security.storage.ISecurePreferences</code> | |
833 // * for data access and modifications. | |
834 // */ | |
835 // public static String getProtectionSpace(URL resourceUrl) { | |
836 // try { | |
837 // return AuthorizationHandler.getProtectionSpace(resourceUrl); | |
838 // } catch (NoClassDefFoundError e) { | |
839 // // The authorization code is not available so just log and continue | |
840 // logAuthNotAvailable(e); | |
841 // } | |
842 // return null; | |
843 // } | |
844 // | |
845 // /** | |
846 // * Removes the indicated (identical) log listener from the notification list | |
847 // * of the platform. If no such listener exists, no action is taken. | |
848 // * | |
849 // * @param listener the listener to de-register | |
850 // * @see ILog#removeLogListener(ILogListener) | |
851 // * @see #addLogListener(ILogListener) | |
852 // * XXX Use the LogMgr service. | |
853 // */ | |
854 // public static void removeLogListener(ILogListener listener) { | |
855 // InternalPlatform.getDefault().removeLogListener(listener); | |
856 // } | |
857 // | |
858 // /** | |
859 // * Returns a URL which is the resolved equivalent of the | |
860 // * supplied URL. This method is expected to be used with the | |
861 // * plug-in-relative URLs returned by IPluginDescriptor, Bundle.getEntry() | |
862 // * and Platform.find(). | |
863 // * <p> | |
864 // * If the specified URL is not a plug-in-relative URL, it is returned | |
865 // * as is. If the specified URL is a plug-in-relative URL, this method | |
866 // * attempts to reduce the given URL to one which is native to the Java | |
867 // * class library (eg. file, http, etc). | |
868 // * </p><p> | |
869 // * Note however that users of this API should not assume too much about the | |
870 // * results of this method. While it may consistently return a file: URL in certain | |
871 // * installation configurations, others may result in jar: or http: URLs. | |
872 // * </p> | |
873 // * @param url original plug-in-relative URL. | |
874 // * @return the resolved URL | |
875 // * @exception IOException if unable to resolve URL | |
876 // * @see #asLocalURL(URL) | |
877 // * @see #find(Bundle, IPath) | |
878 // * @see Bundle#getEntry(String) | |
879 // * @deprecated use {@link FileLocator#resolve(URL)} instead | |
880 // */ | |
881 // public static URL resolve(URL url) throws IOException { | |
882 // return FileLocator.resolve(url); | |
883 // } | |
884 // | |
885 // /** | |
886 // * Runs the given runnable in a protected mode. Exceptions | |
887 // * thrown in the runnable are logged and passed to the runnable's | |
888 // * exception handler. Such exceptions are not rethrown by this method. | |
889 // * | |
890 // * @param runnable the runnable to run | |
891 // * @deprecated clients should use <code>SafeRunner#run</code> instead | |
892 // */ | |
893 // public static void run(ISafeRunnable runnable) { | |
894 // SafeRunner.run(runnable); | |
895 // } | |
896 // | |
897 // /** | |
898 // * Returns the platform job manager. | |
899 // * | |
900 // * @return the platform's job manager | |
901 // * @since 3.0 | |
902 // * @deprecated The method {@link Job#getJobManager()} should be used instead. | |
903 // */ | |
904 // public static IJobManager getJobManager() { | |
905 // return Job.getJobManager(); | |
906 // } | |
907 // | |
908 // /** | |
909 // * Returns the extension registry for this platform. | |
910 // * | |
911 // * @return the extension registry | |
912 // * @see IExtensionRegistry | |
913 // * @since 3.0 | |
914 // */ | |
915 // public static IExtensionRegistry getExtensionRegistry() { | |
916 // return InternalPlatform.getDefault().getRegistry(); | |
917 // } | |
918 // | |
919 // /** | |
920 // * Returns a URL for the given path in the given bundle. Returns <code>null</code> if the URL | |
921 // * could not be computed or created. | |
922 // * | |
923 // * @param bundle the bundle in which to search | |
924 // * @param path path relative to plug-in installation location | |
925 // * @return a URL for the given path or <code>null</code>. The actual form | |
926 // * of the returned URL is not specified. | |
927 // * @see #find(Bundle, IPath, Map) | |
928 // * @see #resolve(URL) | |
929 // * @see #asLocalURL(URL) | |
930 // * @since 3.0 | |
931 // * @deprecated use {@link FileLocator#find(Bundle, IPath, Map)} | |
932 // */ | |
933 // public static URL find(Bundle bundle, IPath path) { | |
934 // return FileLocator.find(bundle, path, null); | |
935 // } | |
936 // | |
937 // /** | |
938 // * Returns a URL for the given path in the given bundle. Returns <code>null</code> if the URL | |
939 // * could not be computed or created. | |
940 // * <p> | |
941 // * find looks for this path in given bundle and any attached fragments. | |
942 // * <code>null</code> is returned if no such entry is found. Note that | |
943 // * there is no specific order to the fragments. | |
944 // * </p><p> | |
945 // * The following arguments may also be used | |
946 // * <pre> | |
947 // * $nl$ - for language specific information | |
948 // * $os$ - for operating system specific information | |
949 // * $ws$ - for windowing system specific information | |
950 // * </pre> | |
951 // * </p><p> | |
952 // * A path of $nl$/about.properties in an environment with a default | |
953 // * locale of en_CA will return a URL corresponding to the first place | |
954 // * about.properties is found according to the following order: | |
955 // * <pre> | |
956 // * plugin root/nl/en/CA/about.properties | |
957 // * fragment1 root/nl/en/CA/about.properties | |
958 // * fragment2 root/nl/en/CA/about.properties | |
959 // * ... | |
960 // * plugin root/nl/en/about.properties | |
961 // * fragment1 root/nl/en/about.properties | |
962 // * fragment2 root/nl/en/about.properties | |
963 // * ... | |
964 // * plugin root/about.properties | |
965 // * fragment1 root/about.properties | |
966 // * fragment2 root/about.properties | |
967 // * ... | |
968 // * </pre> | |
969 // * </p><p> | |
970 // * The current environment variable values can be overridden using | |
971 // * the override map argument. | |
972 // * </p> | |
973 // * | |
974 // * @param bundle the bundle in which to search | |
975 // * @param path file path relative to plug-in installation location | |
976 // * @param override map of override substitution arguments to be used for | |
977 // * any $arg$ path elements. The map keys correspond to the substitution | |
978 // * arguments (eg. "$nl$" or "$os$"). The resulting | |
979 // * values must be of type java.lang.String. If the map is <code>null</code>, | |
980 // * or does not contain the required substitution argument, the default | |
981 // * is used. | |
982 // * @return a URL for the given path or <code>null</code>. The actual form | |
983 // * of the returned URL is not specified. | |
984 // * @see #resolve(URL) | |
985 // * @see #asLocalURL(URL) | |
986 // * @since 3.0 | |
987 // * @deprecated use {@link FileLocator#find(Bundle, IPath, Map)} instead | |
988 // */ | |
989 // public static URL find(Bundle bundle, IPath path, Map override) { | |
990 // return FileLocator.find(bundle, path, override); | |
991 // } | |
992 // | |
993 // /** | |
994 // * Returns the location in the local file system of the | |
995 // * plug-in state area for the given bundle. | |
996 // * If the plug-in state area did not exist prior to this call, | |
997 // * it is created. | |
998 // * <p> | |
999 // * The plug-in state area is a file directory within the | |
1000 // * platform's metadata area where a plug-in is free to create files. | |
1001 // * The content and structure of this area is defined by the plug-in, | |
1002 // * and the particular plug-in is solely responsible for any files | |
1003 // * it puts there. It is recommended for plug-in preference settings and | |
1004 // * other configuration parameters. | |
1005 // * </p> | |
1006 // * | |
1007 // * @param bundle the bundle whose state location if returned | |
1008 // * @return a local file system path | |
1009 // * @since 3.0 | |
1010 // * XXX Investigate the usage of a service factory | |
1011 // */ | |
1012 // public static IPath getStateLocation(Bundle bundle) { | |
1013 // return InternalPlatform.getDefault().getStateLocation(bundle); | |
1014 // } | |
1015 // | |
1016 // /** | |
1017 // * Returns a number that changes whenever the set of installed plug-ins | |
1018 // * changes. This can be used for invalidating caches that are based on | |
1019 // * the set of currently installed plug-ins. (e.g. extensions) | |
1020 // * <p> | |
1021 // * Clients are also able to acquire the {@link PlatformAdmin} service | |
1022 // * and get the timestamp from its state object. | |
1023 // * </p> | |
1024 // * @return a number related to the set of installed plug-ins | |
1025 // * @since 3.1 | |
1026 // */ | |
1027 // public static long getStateStamp() { | |
1028 // return InternalPlatform.getDefault().getStateTimeStamp(); | |
1029 // } | |
1030 // | |
1031 // /** | |
1032 // * Returns the log for the given bundle. If no such log exists, one is created. | |
1033 // * | |
1034 // * @param bundle the bundle whose log is returned | |
1035 // * @return the log for the given bundle | |
1036 // * @since 3.0 | |
1037 // * XXX change this into a LogMgr service that would keep track of the map. See if it can be a service factory. | |
1038 // * It would contain all the methods that are here. | |
1039 // * Relate to RuntimeLog if appropriate. | |
1040 // * The system log listener needs to be optional: turned on or off. What about a system property? :-) | |
1041 // */ | |
1042 // public static ILog getLog(Bundle bundle) { | |
1043 // return InternalPlatform.getDefault().getLog(bundle); | |
1044 // } | |
1045 // | |
1046 // /** | |
1047 // * Returns the given bundle's resource bundle for the current locale. | |
1048 // * <p> | |
1049 // * This resource bundle is typically stored as the plugin.properties file | |
1050 // * in the plug-in itself, and contains any translatable strings used in the | |
1051 // * plug-in manifest file (plugin.xml). | |
1052 // * </p> | |
1053 // * <p> | |
1054 // * This mechanism is intended only for | |
1055 // * externalizing strings found in the plug-in manifest file. Using this | |
1056 // * method for externalizing strings in your code may result in degraded | |
1057 // * memory performance. | |
1058 // * </p> | |
1059 // * | |
1060 // * @param bundle the bundle whose resource bundle is being queried | |
1061 // * @return the resource bundle | |
1062 // * @exception MissingResourceException if the resource bundle was not found | |
1063 // * @since 3.0 | |
1064 // * XXX this is deprecated. use NLS or BundleFinder.find() | |
1065 // */ | |
1066 // public static ResourceBundle getResourceBundle(Bundle bundle) throws MissingResourceException { | |
1067 // return InternalPlatform.getDefault().getResourceBundle(bundle); | |
1068 // } | |
1069 // | |
1070 // /** | |
1071 // * Returns a resource string corresponding to the given argument value. | |
1072 // * If the argument value specifies a resource key, the string | |
1073 // * is looked up in the default resource bundle for the given runtime bundle. If the argument does not | |
1074 // * specify a valid key, the argument itself is returned as the | |
1075 // * resource string. The key lookup is performed in the | |
1076 // * file referenced in the Bundle-Localization header of the bundle manifest. If a resource string | |
1077 // * corresponding to the key is not found in the resource bundle | |
1078 // * the key value, or any default text following the key in the | |
1079 // * argument value is returned as the resource string. | |
1080 // * A key is identified as a string beginning with the "%" character. | |
1081 // * Note, that the "%" character is stripped off prior to lookup | |
1082 // * in the resource bundle. | |
1083 // * <p> | |
1084 // * Equivalent to <code>getResourceString(bundle, value, getResourceBundle())</code> | |
1085 // * </p> | |
1086 // * | |
1087 // * @param bundle the bundle whose resource bundle is being queried | |
1088 // * @param value the value to look for | |
1089 // * @return the resource string | |
1090 // * @see #getResourceBundle(Bundle) | |
1091 // * @since 3.0 | |
1092 // * XXX this is deprecated. use NLS or BundleFinder.find() | |
1093 // */ | |
1094 // public static String getResourceString(Bundle bundle, String value) { | |
1095 // return InternalPlatform.getDefault().getResourceString(bundle, value); | |
1096 // } | |
1097 // | |
1098 // /** | |
1099 // * Returns a resource string corresponding to the given argument | |
1100 // * value and resource bundle in the given runtime bundle. | |
1101 // * If the argument value specifies a resource key, the string | |
1102 // * is looked up in the given resource bundle. If the argument does not | |
1103 // * specify a valid key, the argument itself is returned as the | |
1104 // * resource string. The key lookup is performed against the | |
1105 // * specified resource bundle. If a resource string | |
1106 // * corresponding to the key is not found in the resource bundle | |
1107 // * the key value, or any default text following the key in the | |
1108 // * argument value is returned as the resource string. | |
1109 // * A key is identified as a string beginning with the "%" character. | |
1110 // * Note that the "%" character is stripped off prior to lookup | |
1111 // * in the resource bundle. | |
1112 // * <p> | |
1113 // * For example, assume resource bundle plugin.properties contains | |
1114 // * name = Project Name | |
1115 // * <pre> | |
1116 // * getResourceString("Hello World") returns "Hello World"</li> | |
1117 // * getResourceString("%name") returns "Project Name"</li> | |
1118 // * getResourceString("%name Hello World") returns "Project Name"</li> | |
1119 // * getResourceString("%abcd Hello World") returns "Hello World"</li> | |
1120 // * getResourceString("%abcd") returns "%abcd"</li> | |
1121 // * getResourceString("%%name") returns "%name"</li> | |
1122 // * </pre> | |
1123 // * </p> | |
1124 // * | |
1125 // * @param bundle the bundle whose resource bundle is being queried | |
1126 // * @param value the value | |
1127 // * @param resourceBundle the resource bundle to query | |
1128 // * @return the resource string | |
1129 // * @see #getResourceBundle(Bundle) | |
1130 // * @since 3.0 | |
1131 // * XXX this is deprecated. use NLS or BundleFinder.find() | |
1132 // */ | |
1133 // public static String getResourceString(Bundle bundle, String value, ResourceBundle resourceBundle) { | |
1134 // return InternalPlatform.getDefault().getResourceString(bundle, value, resourceBundle); | |
1135 // } | |
1136 // | |
1137 // /** | |
1138 // * Returns the string name of the current system architecture. | |
1139 // * The value is a user-defined string if the architecture is | |
1140 // * specified on the command line, otherwise it is the value | |
1141 // * returned by <code>java.lang.System.getProperty("os.arch")</code>. | |
1142 // * <p> | |
1143 // * Clients are also able to acquire the {@link EnvironmentInfo} service and query it for | |
1144 // * the operating-system architecture. | |
1145 // * </p> | |
1146 // * @return the string name of the current system architecture | |
1147 // * @since 3.0 | |
1148 // */ | |
1149 // public static String getOSArch() { | |
1150 // return InternalPlatform.getDefault().getOSArch(); | |
1151 // } | |
1152 // | |
1153 // /** | |
1154 // * Returns the string name of the current locale for use in finding files | |
1155 // * whose path starts with <code>$nl$</code>. | |
1156 // * <p> | |
1157 // * Clients are also able to acquire the {@link EnvironmentInfo} service and query it for | |
1158 // * the NL. | |
1159 // * </p> | |
1160 // * @return the string name of the current locale | |
1161 // * @since 3.0 | |
1162 // */ | |
1163 // public static String getNL() { | |
1164 // return InternalPlatform.getDefault().getNL(); | |
1165 // } | |
1166 // | |
1167 // /** | |
1168 // * Returns the string name of the current operating system for use in finding | |
1169 // * files whose path starts with <code>$os$</code>. <code>OS_UNKNOWN</code> is | |
1170 // * returned if the operating system cannot be determined. | |
1171 // * The value may indicate one of the operating systems known to the platform | |
1172 // * (as specified in <code>knownOSValues</code>) or a user-defined string if | |
1173 // * the operating system name is specified on the command line. | |
1174 // * <p> | |
1175 // * Clients are also able to acquire the {@link EnvironmentInfo} service and query it for | |
1176 // * the operating-system. | |
1177 // * </p> | |
1178 // * @return the string name of the current operating system | |
1179 // * @since 3.0 | |
1180 // */ | |
1181 // public static String getOS() { | |
1182 // return InternalPlatform.getDefault().getOS(); | |
1183 // } | |
1184 // | |
1185 // /** | |
1186 // * Returns the string name of the current window system for use in finding files | |
1187 // * whose path starts with <code>$ws$</code>. <code>null</code> is returned | |
1188 // * if the window system cannot be determined. | |
1189 // * <p> | |
1190 // * Clients are also able to acquire the {@link EnvironmentInfo} service and query it for | |
1191 // * the windowing system. | |
1192 // * </p> | |
1193 // * @return the string name of the current window system or <code>null</code> | |
1194 // * @since 3.0 | |
1195 // */ | |
1196 // public static String getWS() { | |
1197 // return InternalPlatform.getDefault().getWS(); | |
1198 // } | |
1199 // | |
1200 // /** | |
1201 // * Returns the arguments not consumed by the framework implementation itself. Which | |
1202 // * arguments are consumed is implementation specific. These arguments are available | |
1203 // * for use by the application. | |
1204 // * | |
1205 // * @return the array of command line arguments not consumed by the framework. | |
1206 // * @since 3.0 | |
1207 // * XXX Use the Environment info service. Need to see how to set the value of the app args. | |
1208 // */ | |
1209 // public static String[] getApplicationArgs() { | |
1210 // return InternalPlatform.getDefault().getApplicationArgs(); | |
1211 // } | |
1212 // | |
1213 // /** | |
1214 // * Returns the platform administrator for this running Eclipse. | |
1215 // * <p> | |
1216 // * Note: This is an internal method and <em>must not</em> | |
1217 // * be used by clients which are not part of the Eclipse Platform. | |
1218 // * This method allows access to classes which are not Eclipse | |
1219 // * Platform API but are part of the OSGi runtime that the Eclipse | |
1220 // * Platform is built on. Even as the Eclipse Platform evolves | |
1221 // * in compatible ways from release to release, the details of | |
1222 // * the OSGi implementation might not. | |
1223 // * </p><p> | |
1224 // * Clients can also acquire the {@link PlatformAdmin} service | |
1225 // * to retrieve this object. | |
1226 // * </p> | |
1227 // * @return the platform admin for this instance of Eclipse | |
1228 // * @since 3.0 | |
1229 // */ | |
1230 // public static PlatformAdmin getPlatformAdmin() { | |
1231 // return InternalPlatform.getDefault().getPlatformAdmin(); | |
1232 // } | |
1233 // | |
1234 // /** | |
1235 // * Returns the location of the platform's working directory (also known as the instance data area). | |
1236 // * <code>null</code> is returned if the platform is running without an instance location. | |
1237 // * <p> | |
1238 // * This method is equivalent to acquiring the <code>dwtx.osgi.service.datalocation.Location</code> | |
1239 // * service with the property "type" equal to {@link Location#INSTANCE_FILTER}. | |
1240 // *</p> | |
1241 // * @return the location of the platform's instance data area or <code>null</code> if none | |
1242 // * @since 3.0 | |
1243 // * @see Location#INSTANCE_FILTER | |
1244 // */ | |
1245 // public static Location getInstanceLocation() { | |
1246 // return InternalPlatform.getDefault().getInstanceLocation(); | |
1247 // } | |
1248 // | |
1249 // /** | |
1250 // * Returns the currently registered bundle group providers. | |
1251 // * <p> | |
1252 // * Clients are also able to acquire the {@link IBundleGroupProvider} service and query it for | |
1253 // * the registered bundle group providers. | |
1254 // * </p> | |
1255 // * @return the currently registered bundle group providers | |
1256 // * @since 3.0 | |
1257 // */ | |
1258 // public static IBundleGroupProvider[] getBundleGroupProviders() { | |
1259 // return InternalPlatform.getDefault().getBundleGroupProviders(); | |
1260 // } | |
1261 // | |
1262 // /** | |
1263 // * Return the interface into the preference mechanism. The returned | |
1264 // * object can be used for such operations as searching for preference | |
1265 // * values across multiple scopes and preference import/export. | |
1266 // * <p> | |
1267 // * Clients are also able to acquire the {@link IPreferencesService} service via | |
1268 // * OSGi mechanisms and use it for preference functions. | |
1269 // * </p> | |
1270 // * @return an object to interface into the preference mechanism | |
1271 // * @since 3.0 | |
1272 // */ | |
1273 // public static IPreferencesService getPreferencesService() { | |
1274 // return InternalPlatform.getDefault().getPreferencesService(); | |
1275 // } | |
1276 // | |
1277 // /** | |
1278 // * Returns the product which was selected when running this Eclipse instance | |
1279 // * or <code>null</code> if none | |
1280 // * @return the current product or <code>null</code> if none | |
1281 // * @since 3.0 | |
1282 // * XXX move this into the app model. | |
1283 // */ | |
1284 // public static IProduct getProduct() { | |
1285 // return InternalPlatform.getDefault().getProduct(); | |
1286 // } | |
1287 // | |
1288 // /** | |
1289 // * Registers the given bundle group provider with the platform. | |
1290 // * <p> | |
1291 // * Clients are also able to use the {@link IBundleGroupProvider} service to | |
1292 // * register themselves as a bundle group provider. | |
1293 // * </p> | |
1294 // * @param provider a provider to register | |
1295 // * @since 3.0 | |
1296 // */ | |
1297 // public static void registerBundleGroupProvider(IBundleGroupProvider provider) { | |
1298 // InternalPlatform.getDefault().registerBundleGroupProvider(provider); | |
1299 // } | |
1300 // | |
1301 // /** | |
1302 // * De-registers the given bundle group provider with the platform. | |
1303 // * <p> | |
1304 // * Clients are also able to use the {@link IBundleGroupProvider} service mechanism | |
1305 // * for unregistering themselves. | |
1306 // * </p> | |
1307 // * @param provider a provider to de-register | |
1308 // * @since 3.0 | |
1309 // * @see #registerBundleGroupProvider(IBundleGroupProvider) | |
1310 // */ | |
1311 // public static void unregisterBundleGroupProvider(IBundleGroupProvider provider) { | |
1312 // InternalPlatform.getDefault().unregisterBundleGroupProvider(provider); | |
1313 // } | |
1314 // | |
1315 // /** | |
1316 // * Returns the location of the configuration information | |
1317 // * used to run this instance of Eclipse. The configuration area typically | |
1318 // * contains the list of plug-ins available for use, various settings | |
1319 // * (those shared across different instances of the same configuration) | |
1320 // * and any other such data needed by plug-ins. | |
1321 // * <code>null</code> is returned if the platform is running without a configuration location. | |
1322 // * <p> | |
1323 // * This method is equivalent to acquiring the <code>dwtx.osgi.service.datalocation.Location</code> | |
1324 // * service with the property "type" equal to {@link Location#CONFIGURATION_FILTER}. | |
1325 // *</p> | |
1326 // * @return the location of the platform's configuration data area or <code>null</code> if none | |
1327 // * @since 3.0 | |
1328 // * @see Location#CONFIGURATION_FILTER | |
1329 // */ | |
1330 // public static Location getConfigurationLocation() { | |
1331 // return InternalPlatform.getDefault().getConfigurationLocation(); | |
1332 // } | |
1333 // | |
1334 // /** | |
1335 // * Returns the location of the platform's user data area. The user data area is a location on the system | |
1336 // * which is specific to the system's current user. By default it is located relative to the | |
1337 // * location given by the System property "user.home". | |
1338 // * <code>null</code> is returned if the platform is running without an user location. | |
1339 // * <p> | |
1340 // * This method is equivalent to acquiring the <code>dwtx.osgi.service.datalocation.Location</code> | |
1341 // * service with the property "type" equal to {@link Location#USER_FILTER}. | |
1342 // *</p> | |
1343 // * @return the location of the platform's user data area or <code>null</code> if none | |
1344 // * @since 3.0 | |
1345 // * @see Location#USER_FILTER | |
1346 // */ | |
1347 // public static Location getUserLocation() { | |
1348 // return InternalPlatform.getDefault().getUserLocation(); | |
1349 // } | |
1350 // | |
1351 // /** | |
1352 // * Returns the location of the base installation for the running platform | |
1353 // * <code>null</code> is returned if the platform is running without a configuration location. | |
1354 // * <p> | |
1355 // * This method is equivalent to acquiring the <code>dwtx.osgi.service.datalocation.Location</code> | |
1356 // * service with the property "type" equal to {@link Location#INSTALL_FILTER}. | |
1357 // *</p> | |
1358 // * @return the location of the platform's installation area or <code>null</code> if none | |
1359 // * @since 3.0 | |
1360 // * @see Location#INSTALL_FILTER | |
1361 // */ | |
1362 // public static Location getInstallLocation() { | |
1363 // return InternalPlatform.getDefault().getInstallLocation(); | |
1364 // } | |
1365 // | |
1366 // /** | |
1367 // * Checks if the specified bundle is a fragment bundle. | |
1368 // * <p> | |
1369 // * Clients are also able to acquire the {@link PackageAdmin} service | |
1370 // * to query if the given bundle is a fragment by asking for the bundle type | |
1371 // * and checking against constants on the service interface. | |
1372 // * </p> | |
1373 // * @param bundle the bundle to query | |
1374 // * @return true if the specified bundle is a fragment bundle; otherwise false is returned. | |
1375 // * @since 3.0 | |
1376 // */ | |
1377 // public static bool isFragment(Bundle bundle) { | |
1378 // return InternalPlatform.getDefault().isFragment(bundle); | |
1379 // } | |
1380 // | |
1381 // /** | |
1382 // * Returns an array of attached fragment bundles for the specified bundle. If the | |
1383 // * specified bundle is a fragment then <tt>null</tt> is returned. If no fragments are | |
1384 // * attached to the specified bundle then <tt>null</tt> is returned. | |
1385 // * <p> | |
1386 // * Clients are also able to acquire the {@link PackageAdmin} service and query | |
1387 // * it for the fragments of the given bundle. | |
1388 // * </p> | |
1389 // * @param bundle the bundle to get the attached fragment bundles for. | |
1390 // * @return an array of fragment bundles or <tt>null</tt> if the bundle does not | |
1391 // * have any attached fragment bundles. | |
1392 // * @since 3.0 | |
1393 // */ | |
1394 // public static Bundle[] getFragments(Bundle bundle) { | |
1395 // return InternalPlatform.getDefault().getFragments(bundle); | |
1396 // } | |
1397 // | |
1398 // /** | |
1399 // * Returns the resolved bundle with the specified symbolic name that has the | |
1400 // * highest version. If no resolved bundles are installed that have the | |
1401 // * specified symbolic name then null is returned. | |
1402 // * <p> | |
1403 // * Clients are also able to acquire the {@link PackageAdmin} service and query | |
1404 // * it for the bundle with the specified symbolic name. Clients can ask the | |
1405 // * service for all bundles with that particular name and then determine the | |
1406 // * one with the highest version. Note that clients may want to filter | |
1407 // * the results based on the state of the bundles. | |
1408 // * </p> | |
1409 // * @param symbolicName the symbolic name of the bundle to be returned. | |
1410 // * @return the bundle that has the specified symbolic name with the | |
1411 // * highest version, or <tt>null</tt> if no bundle is found. | |
1412 // * @since 3.0 | |
1413 // */ | |
1414 // public static Bundle getBundle(String symbolicName) { | |
1415 // return InternalPlatform.getDefault().getBundle(symbolicName); | |
1416 // } | |
1417 // | |
1418 // /** | |
1419 // * Returns all bundles with the specified symbolic name. If no resolved bundles | |
1420 // * with the specified symbolic name can be found, <tt>null</tt> is returned. | |
1421 // * If the version argument is not null then only the Bundles that have | |
1422 // * the specified symbolic name and a version greater than or equal to the | |
1423 // * specified version are returned. The returned bundles are ordered in | |
1424 // * descending bundle version order. | |
1425 // * <p> | |
1426 // * Clients are also able to acquire the {@link PackageAdmin} service and query | |
1427 // * it for all bundle versions with the given symbolic name, after turning the | |
1428 // * specific version into a version range. Note that clients may want to filter | |
1429 // * the results based on the state of the bundles. | |
1430 // * </p> | |
1431 // * @param symbolicName the symbolic name of the bundles that are to be returned. | |
1432 // * @param version the version that the return bundle versions must match, | |
1433 // * or <tt>null</tt> if no version matching is to be done. | |
1434 // * @return the array of Bundles with the specified name that match the | |
1435 // * specified version and match rule, or <tt>null</tt> if no bundles are found. | |
1436 // */ | |
1437 // public static Bundle[] getBundles(String symbolicName, String version) { | |
1438 // return InternalPlatform.getDefault().getBundles(symbolicName, version); | |
1439 // } | |
1440 // | |
1441 // /** | |
1442 // * Returns an array of host bundles that the specified fragment bundle is | |
1443 // * attached to or <tt>null</tt> if the specified bundle is not attached to a host. | |
1444 // * If the bundle is not a fragment bundle then <tt>null</tt> is returned. | |
1445 // * <p> | |
1446 // * Clients are also able to acquire the {@link PackageAdmin} service and query | |
1447 // * it for the hosts for the given bundle. | |
1448 // * </p> | |
1449 // * @param bundle the bundle to get the host bundles for. | |
1450 // * @return an array of host bundles or null if the bundle does not have any | |
1451 // * host bundles. | |
1452 // * @since 3.0 | |
1453 // */ | |
1454 // public static Bundle[] getHosts(Bundle bundle) { | |
1455 // return InternalPlatform.getDefault().getHosts(bundle); | |
1456 // } | |
1457 // | |
1458 // /** | |
1459 // * Returns whether the platform is running. | |
1460 // * | |
1461 // * @return <code>true</code> if the platform is running, | |
1462 // * and <code>false</code> otherwise | |
1463 // *@since 3.0 | |
1464 // *XXX do what you want to do. track osgi, track runtime, or whatever. | |
1465 // */ | |
1466 // public static bool isRunning() { | |
1467 // return InternalPlatform.getDefault().isRunning(); | |
1468 // } | |
1469 // | |
1470 // /** | |
1471 // * Returns a list of known system architectures. | |
1472 // * <p> | |
1473 // * Note that this list is not authoritative; there may be legal values | |
1474 // * not included in this list. Indeed, the value returned by | |
1475 // * <code>getOSArch</code> may not be in this list. Also, this list may | |
1476 // * change over time as Eclipse comes to run on more operating environments. | |
1477 // * </p> | |
1478 // * | |
1479 // * @return the list of system architectures known to the system | |
1480 // * @see #getOSArch() | |
1481 // * @since 3.0 | |
1482 // * XXX This is useless | |
1483 // */ | |
1484 // public static String[] knownOSArchValues() { | |
1485 // return InternalPlatform.getDefault().knownOSArchValues(); | |
1486 // } | |
1487 // | |
1488 // /** | |
1489 // * Returns a list of known operating system names. | |
1490 // * <p> | |
1491 // * Note that this list is not authoritative; there may be legal values | |
1492 // * not included in this list. Indeed, the value returned by | |
1493 // * <code>getOS</code> may not be in this list. Also, this list may | |
1494 // * change over time as Eclipse comes to run on more operating environments. | |
1495 // * </p> | |
1496 // * | |
1497 // * @return the list of operating systems known to the system | |
1498 // * @see #getOS() | |
1499 // * @since 3.0 | |
1500 // * XXX This is useless | |
1501 // */ | |
1502 // public static String[] knownOSValues() { | |
1503 // return InternalPlatform.getDefault().knownOSValues(); | |
1504 // } | |
1505 // | |
1506 // /** | |
1507 // * Returns a map of known platform line separators. The keys are | |
1508 // * translated names of platforms and the values are their associated | |
1509 // * line separator strings. | |
1510 // * | |
1511 // * @return a map of platform to their line separator string | |
1512 // * @since 3.1 | |
1513 // */ | |
1514 // public static Map knownPlatformLineSeparators() { | |
1515 // Map result = new HashMap(); | |
1516 // result.put(LINE_SEPARATOR_KEY_MAC_OS_9, LINE_SEPARATOR_VALUE_CR); | |
1517 // result.put(LINE_SEPARATOR_KEY_UNIX, LINE_SEPARATOR_VALUE_LF); | |
1518 // result.put(LINE_SEPARATOR_KEY_WINDOWS, LINE_SEPARATOR_VALUE_CRLF); | |
1519 // return result; | |
1520 // } | |
1521 // | |
1522 // /** | |
1523 // * Returns a list of known windowing system names. | |
1524 // * <p> | |
1525 // * Note that this list is not authoritative; there may be legal values | |
1526 // * not included in this list. Indeed, the value returned by | |
1527 // * <code>getWS</code> may not be in this list. Also, this list may | |
1528 // * change over time as Eclipse comes to run on more operating environments. | |
1529 // * </p> | |
1530 // * | |
1531 // * @return the list of window systems known to the system | |
1532 // * @see #getWS() | |
1533 // * @since 3.0 | |
1534 // * XXX This is useless | |
1535 // */ | |
1536 // public static String[] knownWSValues() { | |
1537 // return InternalPlatform.getDefault().knownWSValues(); | |
1538 // } | |
1539 // | |
1540 // /** | |
1541 // * Returns <code>true</code> if the platform is currently running in | |
1542 // * debug mode. The platform is typically put in debug mode using the | |
1543 // * "-debug" command line argument. | |
1544 // * <p> | |
1545 // * Clients are also able to acquire the {@link EnvironmentInfo} service and query it | |
1546 // * to see if they are in debug mode. | |
1547 // * </p> | |
1548 // * @return whether or not the platform is running in debug mode | |
1549 // * @since 3.0 | |
1550 // */ | |
1551 // public static bool inDebugMode() { | |
1552 // return PlatformActivator.getContext().getProperty("osgi.debug") !is null; //$NON-NLS-1$ | |
1553 // } | |
1554 // | |
1555 // /** | |
1556 // * Returns <code>true</code> if the platform is currently running in | |
1557 // * development mode. That is, if special procedures are to be | |
1558 // * taken when defining plug-in class paths. The platform is typically put in | |
1559 // * development mode using the "-dev" command line argument. | |
1560 // * <p> | |
1561 // * Clients are also able to acquire the {@link EnvironmentInfo} service and query it | |
1562 // * to see if they are in development mode. | |
1563 // * </p> | |
1564 // * @return whether or not the platform is running in development mode | |
1565 // * @since 3.0 | |
1566 // */ | |
1567 // public static bool inDevelopmentMode() { | |
1568 // return PlatformActivator.getContext().getProperty("osgi.dev") !is null; //$NON-NLS-1$ | |
1569 // } | |
1570 } |