Lines Matching refs:AppContext

52  * The AppContext is a table referenced by ThreadGroup which stores
55 * The AppContext allows applet access to what would otherwise be
62 * The AppContext works with the former method by extending the concept
64 * lookup their singleton in the AppContext.<p>
66 * For example, here we have a Foo service, with its pre-AppContext
86 * Here's the Foo class written to use the AppContext:<p>
90 * Foo foo = (Foo)AppContext.getAppContext().get(Foo.class);
101 * Since a separate AppContext can exist for each ThreadGroup, trusted
104 * within the AppContext "sandbox". For example, say a malicious applet
110 * an AppContext, the applet's look-and-feel will change without
113 * Because the AppContext is a facility for safely extending application
122 * AppContext based on the execution context, in the case where
123 * the default ThreadGroup-based AppContext indexing would return
124 * the main "system" AppContext. For example, in an applet situation,
126 * main "system" AppContext (the one corresponding to the system thread),
127 * an installed AWTSecurityManager may return the applet's AppContext
133 public final class AppContext {
134 private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.AppContext");
136 /* Since the contents of an AppContext are unique to each Java
140 * The key to put()/get() the Java EventQueue into/from the AppContext.
152 private static final Map<ThreadGroup, AppContext> threadGroup2appContext =
153 Collections.synchronizedMap(new IdentityHashMap<ThreadGroup, AppContext>());
156 * Returns a set containing all <code>AppContext</code>s.
158 public static Set<AppContext> getAppContexts() {
160 return new HashSet<AppContext>(threadGroup2appContext.values());
164 /* The main "system" AppContext, used by everything not otherwise
165 contained in another AppContext. It is implicitly created for
168 private static volatile AppContext mainAppContext = null;
171 * The hash map associated with this AppContext. A private delegate
209 * number is 1. If so, it returns the sole AppContext without
215 * The context ClassLoader that was used to create this AppContext.
220 * Constructor for AppContext. This method is <i>not</i> public,
222 * an AppContext is through the use of SunToolkit.createNewAppContext.
223 * A ThreadGroup is created for the new AppContext, a Thread is
226 * That creates both the new AppContext and its EventQueue.
228 * @param threadGroup The ThreadGroup for the new AppContext
232 AppContext(ThreadGroup threadGroup) {
246 // EventQueues within this AppContext
253 private static final ThreadLocal<AppContext> threadAppContext =
254 new ThreadLocal<AppContext>();
258 // AppContext, and instantiate the Java EventQueue. This way, legacy
259 // code is unaffected by the move to multiple AppContext ability.
266 // Find the root ThreadGroup to construct our main AppContext
278 * Returns the appropriate AppContext for the caller,
279 * as determined by its ThreadGroup. If the main "system" AppContext
281 * is called to get the proper AppContext based on the execution
284 * @return the AppContext for the caller.
288 public final static AppContext getAppContext() {
294 AppContext appContext = threadAppContext.get();
297 appContext = AccessController.doPrivileged(new PrivilegedAction<AppContext>()
299 public AppContext run() {
301 // parents in the hash from ThreadGroup to AppContext --
303 // when new AppContext objects are created.
320 AppContext context = threadGroup2appContext.get(threadGroup);
348 * Returns true if the specified AppContext is the main AppContext.
351 * @return true if the specified AppContext is the main AppContext.
354 public final static boolean isMainContext(AppContext ctx) {
358 private final static AppContext getExecutionAppContext() {
364 AppContext secAppContext = awtSecMgr.getAppContext();
382 * Disposes of this AppContext, all of its top-level Frames, and
386 * within this AppContext.
389 * contained within this AppContext
393 // Check to be sure that the current Thread isn't in this AppContext
396 "Current Thread is contained within AppContext to be disposed."
543 private final AppContext appContext;
545 public PostShutdownEventRunnable(AppContext ac) {
558 private final AppContext appContext;
561 public CreateThreadAction(AppContext ac, Runnable r) {
576 for (AppContext appContext: getAppContexts()) {
583 if (appContext != AppContext.getAppContext()) {
585 // with the AppContext and invokes EventQueue.postEvent.
601 * @param key a key in the AppContext.
602 * @return the value to which the key is mapped in this AppContext;
641 * <code>value</code> in this AppContext. Neither the key nor the
647 * @param key the AppContext key.
650 * AppContext, or <code>null</code> if it did not have one.
667 * AppContext. This method does nothing if the key is not in the
668 * AppContext.
671 * @return the value to which the key had been mapped in this AppContext,
686 * this AppContext.
695 * AppContext.
704 * Returns a string representation of this AppContext.
737 * <li>if this AppContext is disposed ("disposed")</li>
740 * <li>if this AppContext's unowned Windows have been disposed
816 AppContext ac = getAppContext();
820 AppContext ac = getAppContext();
826 AppContext ac = getAppContext();
832 AppContext ac = getAppContext();
845 return ((AppContext)context).get(key);
848 ((AppContext)context).put(key, value);
851 ((AppContext)context).remove(key);