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